summaryrefslogtreecommitdiff
path: root/ArmPkg
diff options
context:
space:
mode:
authorGarrett Kirkendall <garrett.kirkendall@amd.com>2014-01-24 13:10:54 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2014-01-24 13:10:54 +0000
commit7017c2699de96b20cef4076a561036bb017461d6 (patch)
treeb5d79c8884cc9eec9e6cd3e07fcf5a0ddafe7833 /ArmPkg
parentace287611f35b7525bc8e7468e9093ea32d2464e (diff)
downloadedk2-platforms-7017c2699de96b20cef4076a561036bb017461d6.tar.xz
ArmPkg/ArmLib: Fix AARCH64 page table entry filling overrun
Update the LastBlockEntry return value when allocating a new page table block and the parent page table entry is not valid. Discovered when producing page table entries for a memory region that spans multiple page table entries of a parent page table block. Not very memory space efficient because the rest of the code could calculate a required page level that is deeper than some blocks of the memory region might require. Case that found the problem: MemoryRegion->VirtualBase = 0 MemoryRegion->Length = 0x7F000000 This fix will create an un-needed level of page table for address range 0 -> 0x40000000 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Garrett Kirkendall <garrett.kirkendall@amd.com> Reviewed-By: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15177 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg')
-rw-r--r--ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c b/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c
index bca397dcff..42b4963913 100644
--- a/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c
+++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c
@@ -401,6 +401,8 @@ GetBlockEntryListFromAddress (
// Fill the new BlockEntry with the TranslationTable
*BlockEntry = ((UINTN)TranslationTable & TT_ADDRESS_MASK_DESCRIPTION_TABLE) | TT_TYPE_TABLE_ENTRY;
+ // Update the last block entry with the newly created translation table
+ *LastBlockEntry = TT_LAST_BLOCK_ADDRESS(TranslationTable, TT_ENTRY_COUNT);
}
}
}