summaryrefslogtreecommitdiff
path: root/kernel/mem.c
diff options
context:
space:
mode:
authordzwdz2021-06-25 21:57:30 +0200
committerdzwdz2021-06-25 21:57:30 +0200
commit7e8a831e1fa1fb98d2486f0c262c2609c176abab (patch)
treead3304a0d16281e019b1e33f7383ed4b97f89afb /kernel/mem.c
parent654ca8603381ffa385350242cfb96906cf612279 (diff)
malloc stub + processes
well, there's only one process, but shh
Diffstat (limited to 'kernel/mem.c')
-rw-r--r--kernel/mem.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/mem.c b/kernel/mem.c
new file mode 100644
index 0000000..8fcaf26
--- /dev/null
+++ b/kernel/mem.c
@@ -0,0 +1,19 @@
+#include <kernel/mem.h>
+
+extern void *_kernel_end;
+static void *highest;
+
+void mem_init() {
+ highest = &_kernel_end;
+}
+
+// should always succeed, there are no error checks anywhere
+void *malloc(size_t size) {
+ void *block = highest;
+ highest += size;
+ return block;
+}
+
+void free(void *ptr) {
+ // not implemented
+}