diff options
author | dzwdz | 2022-05-29 17:58:52 +0200 |
---|---|---|
committer | dzwdz | 2022-05-29 17:58:52 +0200 |
commit | a6ed7a20a823e67c19b93309706c57ddee1933c6 (patch) | |
tree | 64edc0e8915c7b7ef2c7460cc3d13dfb0acf4b00 | |
parent | 2e0c1fb24d79b36ae9017591ecb2d10c6729240c (diff) |
init/malloc: use FINDFREE
-rw-r--r-- | src/init/malloc.c | 8 |
1 files 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; |