From a6ed7a20a823e67c19b93309706c57ddee1933c6 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 29 May 2022 17:58:52 +0200 Subject: init/malloc: use FINDFREE --- src/init/malloc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/init/malloc.c b/src/init/malloc.c index 35b1741..eb63d82 100644 --- a/src/init/malloc.c +++ b/src/init/malloc.c @@ -47,12 +47,8 @@ void free(void *ptr) { } static struct mblock *expand(size_t size) { - size = (size + 4095) & ~4095; // round up to nearest page - - static void *start = (void*)0x80000000; // TODO workaround for unimplemented feature - _syscall_memflag(start, size, MEMFLAG_PRESENT); - struct mblock *block = start; - start += size; + struct mblock *block = _syscall_memflag(0, size, MEMFLAG_PRESENT | MEMFLAG_FINDFREE); + if (!block) return NULL; block->magic = MBLOCK_MAGIC; block->length = size; -- cgit v1.2.3