summaryrefslogtreecommitdiff
path: root/src/kernel/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/mem.c')
-rw-r--r--src/kernel/mem.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/kernel/mem.c b/src/kernel/mem.c
new file mode 100644
index 0000000..08eb285
--- /dev/null
+++ b/src/kernel/mem.c
@@ -0,0 +1,19 @@
+#include <kernel/mem.h>
+
+extern void *_kernel_end;
+static void *highest_page;
+
+void mem_init() {
+ highest_page = &_kernel_end;
+}
+
+void *page_alloc(size_t pages) {
+ void *bottom = highest_page;
+ highest_page += pages * PAGE_SIZE;
+ return bottom;
+}
+
+// frees `pages` consecutive pages starting from *first
+void page_free(void *first, size_t pages) {
+ // not implemented
+}