diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/include/comus/memory.h | 20 | ||||
-rw-r--r-- | kernel/memory/memory.c | 19 |
2 files changed, 36 insertions, 3 deletions
diff --git a/kernel/include/comus/memory.h b/kernel/include/comus/memory.h index ee413e3..dec872d 100644 --- a/kernel/include/comus/memory.h +++ b/kernel/include/comus/memory.h @@ -11,6 +11,7 @@ #include <stdint.h> #include <stddef.h> +#include <stdbool.h> #define MMAP_MAX_ENTRY 64 #define PAGE_SIZE 4096 @@ -63,7 +64,24 @@ uint64_t memory_used(void); * * @returns pointer context or NULL on failure */ -mem_ctx_t alloc_mem_ctx(void); +mem_ctx_t mem_ctx_alloc(void); + +/** + * Clone a current memory context into a new one + * + * @param ctx - the memory context + * @param cow - mark all of the pages as copy on write + * + * @returns pointer context or NULL on failure + */ +mem_ctx_t mem_ctx_clone(mem_ctx_t ctx, bool cow); + +/** + * Free a memory context into a new one + * + * @param ctx - the memory context + */ +void mem_ctx_free(mem_ctx_t ctx); /** * Free a memory context diff --git a/kernel/memory/memory.c b/kernel/memory/memory.c index b4ecb0d..208001b 100644 --- a/kernel/memory/memory.c +++ b/kernel/memory/memory.c @@ -44,9 +44,24 @@ int kload_page(void *virt) return mem_load_page(kernel_mem_ctx, virt); } -mem_ctx_t alloc_mem_ctx(void) +mem_ctx_t mem_ctx_alloc(void) { - panic("alloc_mem_ctx not yet implemented"); + panic("not yet implemented"); +} + +mem_ctx_t mem_ctx_clone(mem_ctx_t ctx, bool cow) +{ + (void) ctx; + (void) cow; + + panic("not yet implemented"); +} + +void mem_ctx_free(mem_ctx_t ctx) +{ + (void) ctx; + + panic("not yet implemented"); } void memory_init(void) |