Kernel/VMM: Add support for larger pages to getFlags()

This commit is contained in:
apio 2022-10-12 20:05:27 +02:00
parent 69a9f7f06a
commit 52944ba5d8

View File

@ -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;