1
0
Fork 0

fix/kernel: Fixed valloc/vallocat

This commit is contained in:
Kevin Alavik 2025-05-16 18:30:31 +02:00
parent f83961432e
commit 9970bc53e4
Signed by: cmpsb
GPG key ID: 10D1CC0526FDC6D7
2 changed files with 4 additions and 3 deletions

View file

@ -17,6 +17,7 @@
"cpu.h": "c", "cpu.h": "c",
"nanoprintf.h": "c", "nanoprintf.h": "c",
"flanterm.h": "c", "flanterm.h": "c",
"serial.h": "c" "serial.h": "c",
"kpanic.h": "c"
} }
} }

View file

@ -52,7 +52,7 @@ void *valloc(vctx_t *ctx, size_t pages, uint64_t flags)
while (region) while (region)
{ {
if (region->next == NULL || region->start + region->pages < region->next->start) if (region->next == NULL || region->start + (region->pages * PAGE_SIZE) < region->next->start)
{ {
new = (vregion_t *)palloc(1, true); new = (vregion_t *)palloc(1, true);
if (!new) if (!new)
@ -112,7 +112,7 @@ void *vallocat(vctx_t *ctx, size_t pages, uint64_t flags, uint64_t phys)
while (region) while (region)
{ {
if (region->next == NULL || region->start + region->pages < region->next->start) if (region->next == NULL || region->start + (region->pages * PAGE_SIZE) < region->next->start)
{ {
new = (vregion_t *)palloc(1, true); new = (vregion_t *)palloc(1, true);
if (!new) if (!new)