summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordzwdz2022-05-29 17:58:52 +0200
committerdzwdz2022-05-29 17:58:52 +0200
commita6ed7a20a823e67c19b93309706c57ddee1933c6 (patch)
tree64edc0e8915c7b7ef2c7460cc3d13dfb0acf4b00 /src
parent2e0c1fb24d79b36ae9017591ecb2d10c6729240c (diff)
init/malloc: use FINDFREE
Diffstat (limited to 'src')
-rw-r--r--src/init/malloc.c8
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;