diff --git a/kernel/src/memory/VMM.cpp b/kernel/src/memory/VMM.cpp index bd954b01..c04ee44f 100644 --- a/kernel/src/memory/VMM.cpp +++ b/kernel/src/memory/VMM.cpp @@ -164,7 +164,11 @@ uint64_t VMM::getFlags(uint64_t virtualAddress) // FIXME: Add support for larger { return 0; // Not mapped } - else { PDP = (PageTable*)((uint64_t)PDE.Address << 12); } + else + { + if (PDE.LargerPages) goto read_flags; + PDP = (PageTable*)((uint64_t)PDE.Address << 12); + } PDE = PDP->entries[PD_i]; PageTable* PD; @@ -172,7 +176,11 @@ uint64_t VMM::getFlags(uint64_t virtualAddress) // FIXME: Add support for larger { return 0; // Not mapped } - else { PD = (PageTable*)((uint64_t)PDE.Address << 12); } + else + { + if (PDE.LargerPages) goto read_flags; + PD = (PageTable*)((uint64_t)PDE.Address << 12); + } PDE = PD->entries[PT_i]; PageTable* PT; @@ -180,11 +188,16 @@ uint64_t VMM::getFlags(uint64_t virtualAddress) // FIXME: Add support for larger { return 0; // Not mapped } - else { PT = (PageTable*)((uint64_t)PDE.Address << 12); } - - uint64_t flags = 0; + else + { + if (PDE.LargerPages) goto read_flags; + PT = (PageTable*)((uint64_t)PDE.Address << 12); + } PDE = PT->entries[P_i]; + +read_flags: + uint64_t flags = 0; if (PDE.UserSuper) flags |= User; if (PDE.ReadWrite) flags |= ReadWrite; return flags;