Revision: 14506
http://sourceforge.net/p/edk2/code/14506
Author: oliviermartin
Date: 2013-07-26 17:10:51 +0000 (Fri, 26 Jul 2013)
Log Message:
-----------
ArmPkg/ArmLib/AArch64: Use the appropriate macros and update comments
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-26
03:14:08 UTC (rev 14505)
+++ trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c 2013-07-26
17:10:51 UTC (rev 14506)
@@ -301,8 +301,10 @@
// Identify the Page Level the RegionStart must belongs to
PageLevel = 3 - ((BaseAddressAlignment - 12) / 9);
- // If the required size is smaller than the current block size then we need
to go to the page bellow.
- if (*BlockEntrySize < TT_ADDRESS_AT_LEVEL(PageLevel)) {
+ // If the required size is smaller than the current block size then we need
to go to the page below.
+ // The PageLevel was calculated on the Base Address alignment but did not
take in account the alignment
+ // of the allocation size
+ if (*BlockEntrySize < TT_BLOCK_ENTRY_SIZE_AT_LEVEL (PageLevel)) {
// It does not fit so we need to go a page level above
PageLevel++;
}
@@ -311,7 +313,7 @@
*TableLevel = PageLevel;
// Now, we have the Table Level we can get the Block Size associated to this
table
- *BlockEntrySize = TT_ADDRESS_AT_LEVEL(PageLevel);
+ *BlockEntrySize = TT_BLOCK_ENTRY_SIZE_AT_LEVEL (PageLevel);
//
// Get the Table Descriptor for the corresponding PageLevel. We need to
decompose RegionStart to get appropriate entries
@@ -357,8 +359,8 @@
// Shift back to right to set zero before the effective address
BlockEntryAddress = BlockEntryAddress <<
TT_ADDRESS_OFFSET_AT_LEVEL(IndexLevel);
- // Set the correct entry type
- if (IndexLevel + 1 == 3) {
+ // Set the correct entry type for the next page level
+ if ((IndexLevel + 1) == 3) {
Attributes |= TT_TYPE_BLOCK_ENTRY_LEVEL3;
} else {
Attributes |= TT_TYPE_BLOCK_ENTRY;
@@ -371,7 +373,7 @@
}
TranslationTable = (UINT64*)((UINTN)TranslationTable &
TT_ADDRESS_MASK_DESCRIPTION_TABLE);
- // Fill the new BlockEntry with the TranslationTable
+ // Fill the BlockEntry with the new 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)));
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