summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-04-15 22:49:39 -0400
committerFreya Murphy <freya@freyacat.org>2025-04-15 22:49:39 -0400
commitfea6e5f3d527e3fb33209d437f130c02c9e83680 (patch)
treecc71bfcdf893ff31882795994d7ce29f483a72bc
parentmove error.h out of symlink (diff)
downloadcomus-fea6e5f3d527e3fb33209d437f130c02c9e83680.tar.gz
comus-fea6e5f3d527e3fb33209d437f130c02c9e83680.tar.bz2
comus-fea6e5f3d527e3fb33209d437f130c02c9e83680.zip
more stub mem_ctx fns
-rw-r--r--kernel/include/comus/memory.h20
-rw-r--r--kernel/memory/memory.c19
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)