diff options
author | Danny Holman <dholman@gymli.org> | 2024-03-28 21:30:12 -0500 |
---|---|---|
committer | Danny Holman <dholman@gymli.org> | 2024-03-28 21:30:12 -0500 |
commit | cbe2690cd5d1b290633c466ebb4df7b64b09b037 (patch) | |
tree | 99f77ef19f303c42c028be11cbb4210245b8a583 /kernel | |
parent | 891f1010bbdc1351bda8d2a6139094a14bdfd5e1 (diff) |
arch: i386: kernel: add mostly finished PFA and paging system
Add the mostly finished physical memory allocator and expose its
functions to the paging system.
Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/init.c | 4 | ||||
-rw-r--r-- | kernel/mem.c | 15 |
2 files changed, 3 insertions, 16 deletions
diff --git a/kernel/init.c b/kernel/init.c index 86567a4..8512988 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -1,5 +1,5 @@ #include <kernel/io.h> -#include <kernel/mem.h> +#include <kernel/kmalloc.h> #include <kernel/string.h> #include <kernel/serial.h> @@ -8,6 +8,7 @@ void jump_userspace(void); char rootfs[1024]; int start_init(int argc, char* argv[]) { + while (1); return 0; } @@ -22,4 +23,5 @@ void process_cmd(char *cmdline) { void kernel_main(char *cmdline) { kprintf("Box Kernel version %s\n", VERSION); serial_init(); + kmalloc_init(); } diff --git a/kernel/mem.c b/kernel/mem.c deleted file mode 100644 index e977f6a..0000000 --- a/kernel/mem.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <kernel/mem.h> -#include <kernel/paging.h> - -extern uintptr_t _kernel_end; -static uintptr_t heap_start = (uintptr_t)&_kernel_end; -static uintptr_t heap_end = (uintptr_t)&_kernel_end; - -void* kmalloc(size_t sz) { - void *tmp = heap_end; - heap_end += sz; - return tmp; -} - -void kfree(void *ptr) { -} |