diff options
author | Freya Murphy <freya@freyacat.org> | 2025-04-24 12:38:28 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-04-24 12:38:28 -0400 |
commit | 8a81340b78def3895c119d5ada63cbe3a8452985 (patch) | |
tree | 48715bf57b6a76f97e5d60c5fd84afbf49d57d4f /kernel/include | |
parent | only backtrace on valid kernel frames (diff) | |
download | comus-8a81340b78def3895c119d5ada63cbe3a8452985.tar.gz comus-8a81340b78def3895c119d5ada63cbe3a8452985.tar.bz2 comus-8a81340b78def3895c119d5ada63cbe3a8452985.zip |
const pointers on free & kmapuseraddr
Diffstat (limited to 'kernel/include')
-rw-r--r-- | kernel/include/comus/memory.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/kernel/include/comus/memory.h b/kernel/include/comus/memory.h index 942e7a8..255eca2 100644 --- a/kernel/include/comus/memory.h +++ b/kernel/include/comus/memory.h @@ -121,7 +121,7 @@ void *mem_mapaddr(mem_ctx_t ctx, void *phys, void *virt, size_t len, * Unmaps mapped address from the kmapaddr function * @param virt - the vitural address returned from kmapaddr */ -void mem_unmapaddr(mem_ctx_t ctx, void *virt); +void mem_unmapaddr(mem_ctx_t ctx, const void *virt); /** * Allocate a single page of memory with the given paging structure @@ -169,7 +169,7 @@ void *mem_alloc_pages_at(mem_ctx_t ctx, size_t count, void *virt, * * @param ptr - the pointer provided by alloc_page or alloc_pages */ -void mem_free_pages(mem_ctx_t ctx, void *ptr); +void mem_free_pages(mem_ctx_t ctx, const void *ptr); /** * Allocates at least len bytes of memory starting at @@ -185,10 +185,20 @@ void mem_free_pages(mem_ctx_t ctx, void *ptr); void *kmapaddr(void *phys, void *virt, size_t len, unsigned int flags); /** + * Map a vitural address in a userspace context to kernel space + * + * @param ctx - the userspace memory context to map from + * @param virt - the vitural address given by userspace + * @param len - the length of the buffer to map + * @returns vitural address mapped in kernel context + */ +void *kmapuseraddr(mem_ctx_t ctx, const void *virt, size_t len); + +/** * Unmaps mapped address from the kmapaddr function * @param virt - the vitural address returned from kmapaddr */ -void kunmapaddr(void *virt); +void kunmapaddr(const void *virt); /** * Allocate a single page of memory @@ -210,6 +220,6 @@ void *kalloc_pages(size_t count); * * @param ptr - the pointer provided by alloc_page or alloc_pages */ -void kfree_pages(void *ptr); +void kfree_pages(const void *ptr); #endif /* memory.h */ |