fix/kernel: Fixed valloc/vallocat
This commit is contained in:
parent
f83961432e
commit
9970bc53e4
2 changed files with 4 additions and 3 deletions
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -17,6 +17,7 @@
|
|||
"cpu.h": "c",
|
||||
"nanoprintf.h": "c",
|
||||
"flanterm.h": "c",
|
||||
"serial.h": "c"
|
||||
"serial.h": "c",
|
||||
"kpanic.h": "c"
|
||||
}
|
||||
}
|
|
@ -52,7 +52,7 @@ void *valloc(vctx_t *ctx, size_t pages, uint64_t flags)
|
|||
|
||||
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);
|
||||
if (!new)
|
||||
|
@ -112,7 +112,7 @@ void *vallocat(vctx_t *ctx, size_t pages, uint64_t flags, uint64_t phys)
|
|||
|
||||
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);
|
||||
if (!new)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue