diff options
author | dzwdz | 2021-07-06 19:44:15 +0200 |
---|---|---|
committer | dzwdz | 2021-07-06 19:44:15 +0200 |
commit | 89537c396393c8569b39f14cb8e2c73e676a3e00 (patch) | |
tree | 41ab74848b422e51c104dd8598916a1894344eca /kernel/mem.c | |
parent | 7e8a831e1fa1fb98d2486f0c262c2609c176abab (diff) |
stub page allocator
the malloc stub didn't even make sense
Diffstat (limited to 'kernel/mem.c')
-rw-r--r-- | kernel/mem.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/kernel/mem.c b/kernel/mem.c index 8fcaf26..08eb285 100644 --- a/kernel/mem.c +++ b/kernel/mem.c @@ -1,19 +1,19 @@ #include <kernel/mem.h> extern void *_kernel_end; -static void *highest; +static void *highest_page; void mem_init() { - highest = &_kernel_end; + highest_page = &_kernel_end; } -// should always succeed, there are no error checks anywhere -void *malloc(size_t size) { - void *block = highest; - highest += size; - return block; +void *page_alloc(size_t pages) { + void *bottom = highest_page; + highest_page += pages * PAGE_SIZE; + return bottom; } -void free(void *ptr) { +// frees `pages` consecutive pages starting from *first +void page_free(void *first, size_t pages) { // not implemented } |