VMM: Do not map recursively

This commit is contained in:
apio 2022-10-12 14:34:12 +02:00
parent 8daffa876c
commit 15f340dbbe

View File

@ -222,7 +222,6 @@ namespace Paging
{ {
unmap(virtualAddress); unmap(virtualAddress);
PDE.LargerPages = false; PDE.LargerPages = false;
PML4->entries[PDP_i] = PDE;
PDP = (PageTable*)PMM::request_page(); PDP = (PageTable*)PMM::request_page();
ASSERT(!(PMM_DID_FAIL(PDP))); ASSERT(!(PMM_DID_FAIL(PDP)));
memset(PDP, 0, PAGE_SIZE); memset(PDP, 0, PAGE_SIZE);
@ -230,7 +229,7 @@ namespace Paging
PDE.Present = true; PDE.Present = true;
PDE.ReadWrite = true; PDE.ReadWrite = true;
if (flags & User) PDE.UserSuper = true; if (flags & User) PDE.UserSuper = true;
return map(virtualAddress, physicalAddress, flags); PML4->entries[PDP_i] = PDE;
} }
PDP = (PageTable*)((uint64_t)PDE.Address << 12); PDP = (PageTable*)((uint64_t)PDE.Address << 12);
} }
@ -259,7 +258,6 @@ namespace Paging
{ {
unmap(virtualAddress); unmap(virtualAddress);
PDE.LargerPages = false; PDE.LargerPages = false;
PDP->entries[PD_i] = PDE;
PD = (PageTable*)PMM::request_page(); PD = (PageTable*)PMM::request_page();
ASSERT(!(PMM_DID_FAIL(PD))); ASSERT(!(PMM_DID_FAIL(PD)));
memset(PD, 0, PAGE_SIZE); memset(PD, 0, PAGE_SIZE);
@ -267,7 +265,7 @@ namespace Paging
PDE.Present = true; PDE.Present = true;
PDE.ReadWrite = true; PDE.ReadWrite = true;
if (flags & User) PDE.UserSuper = true; if (flags & User) PDE.UserSuper = true;
return map(virtualAddress, physicalAddress, flags); PDP->entries[PD_i] = PDE;
} }
PD = (PageTable*)((uint64_t)PDE.Address << 12); PD = (PageTable*)((uint64_t)PDE.Address << 12);
} }