diff --git a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c index 95bf10bcb2..6cba1218c6 100644 --- a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c +++ b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c @@ -32,9 +32,8 @@ GetFirstPageAttribute ( // Get the first entry of the table FirstEntry = *FirstLevelTableAddress; - if ((FirstEntry & TT_TYPE_MASK) == TT_TYPE_TABLE_ENTRY) { + if ((TableLevel != 3) && (FirstEntry & TT_TYPE_MASK) == TT_TYPE_TABLE_ENTRY) { // Only valid for Levels 0, 1 and 2 - ASSERT (TableLevel < 3); // Get the attribute of the subsequent table return GetFirstPageAttribute ((UINT64*)(FirstEntry & TT_ADDRESS_MASK_DESCRIPTION_TABLE), TableLevel + 1);