Revision: 14500
http://sourceforge.net/p/edk2/code/14500
Author: oliviermartin
Date: 2013-07-24 11:50:31 +0000 (Wed, 24 Jul 2013)
Log Message:
-----------
ArmPkg/ArmLib/AArch64: Fixed the calculation of the last entry in the
Translation Table
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <[email protected]>
Modified Paths:
--------------
trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c
Modified: trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c
===================================================================
--- trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c 2013-07-23
18:51:51 UTC (rev 14499)
+++ trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c 2013-07-24
11:50:31 UTC (rev 14500)
@@ -273,13 +273,13 @@
ASSERT ((*BlockEntrySize & (SIZE_4KB - 1)) == 0);
//
- // Calculate LastBlockEntry from T0SZ
+ // Calculate LastBlockEntry from T0SZ - this is the last block entry of the
root Translation table
//
T0SZ = ArmGetTCR () & TCR_T0SZ_MASK;
// Get the Table info from T0SZ
GetRootTranslationTableInfo (T0SZ, &RootTableLevel, &RootTableEntryCount);
// The last block of the root table depends on the number of entry in this
table
- *LastBlockEntry = (UINT64*)((UINTN)RootTable + (RootTableEntryCount *
sizeof(UINT64)));
+ *LastBlockEntry = (UINT64*)((UINTN)RootTable + ((RootTableEntryCount - 1) *
sizeof(UINT64)));
// If the start address is 0x0 then we use the size of the region to
identify the alignment
if (RegionStart == 0) {
@@ -331,7 +331,7 @@
BlockEntry = (UINT64*)TT_GET_ENTRY_FOR_ADDRESS (TranslationTable,
IndexLevel + 1, RegionStart);
// Set the last block for this new table
- *LastBlockEntry = (UINT64*)((UINTN)TranslationTable + (TT_ENTRY_COUNT
* sizeof(UINT64)));
+ *LastBlockEntry = (UINT64*)((UINTN)TranslationTable + ((TT_ENTRY_COUNT
- 1) * sizeof(UINT64)));
}
} else if ((*BlockEntry & TT_TYPE_MASK) == TT_TYPE_BLOCK_ENTRY) {
// If we are not at the last level then we need to split this BlockEntry
@@ -373,6 +373,8 @@
// Fill the new BlockEntry with the TranslationTable
*BlockEntry = ((UINTN)TranslationTable &
TT_ADDRESS_MASK_DESCRIPTION_TABLE) | TableAttributes | TT_TYPE_TABLE_ENTRY;
+ // Update the last block entry with the newly created translation table
+ *LastBlockEntry = (UINT64*)((UINTN)TranslationTable + ((TT_ENTRY_COUNT
- 1) * sizeof(UINT64)));
// Populate the newly created lower level table
BlockEntry = TranslationTable;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits