diff options
-rw-r--r-- | include/kernel/mem.h | 4 | ||||
-rw-r--r-- | kernel/mem.c | 18 |
2 files changed, 7 insertions, 15 deletions
diff --git a/include/kernel/mem.h b/include/kernel/mem.h index cf162ab..dfbcf23 100644 --- a/include/kernel/mem.h +++ b/include/kernel/mem.h @@ -1,9 +1,9 @@ -#ifndef MEM_H +#ifndef KERNEL_MEM_H -#include <kernel/alloc.h> #include <kernel/paging.h> #include <stddef.h> +int init_kmalloc(void); void* kmalloc(size_t sz); #endif diff --git a/kernel/mem.c b/kernel/mem.c index e2f1889..e977f6a 100644 --- a/kernel/mem.c +++ b/kernel/mem.c @@ -1,22 +1,14 @@ #include <kernel/mem.h> -#include <kernel/alloc.h> #include <kernel/paging.h> -extern uint32_t _kernel_end; -static uint32_t *heap_start = &_kernel_end; -static uint32_t *heap_end = &_kernel_end; - -int _alloc_new_page(void) { - uint32_t paddr = pfa_alloc_frame(); - if (paddr == 0xFFFFFFFF) - return -1; - map_page(paddr, heap_end, 0x003); -} +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 *ret = heap_end; + void *tmp = heap_end; heap_end += sz; - return ret; + return tmp; } void kfree(void *ptr) { |