]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/CpuDxe: Fixed calculation of the Page Table Index (Level 2 Descriptor)
authorOlivier Martin <olivier.martin@arm.com>
Mon, 2 Sep 2013 13:12:17 +0000 (13:12 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 2 Sep 2013 13:12:17 +0000 (13:12 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14617 6f19259b-4bc3-4df7-8a09-765794883524

ArmPkg/Drivers/CpuDxe/ArmV6/Mmu.c

index 474f105d229b05315141e7cc9f4527e24f14fd3d..2896f708a44c773e93d5801de6fe7c259c47c7c4 100644 (file)
@@ -768,7 +768,7 @@ GetMemoryRegionPage (
   PageAttributes = ConvertSectionAttributesToPageAttributes (*RegionAttributes, 0);\r
 \r
   // Calculate index into first level translation table for start of modification\r
-  TableIndex = TT_DESCRIPTOR_PAGE_BASE_ADDRESS(*BaseAddress) >> TT_DESCRIPTOR_PAGE_BASE_SHIFT;\r
+  TableIndex = ((*BaseAddress) & TT_DESCRIPTOR_PAGE_INDEX_MASK)  >> TT_DESCRIPTOR_PAGE_BASE_SHIFT;\r
   ASSERT (TableIndex < TRANSLATION_TABLE_PAGE_COUNT);\r
 \r
   // Go through the page table to find the end of the section\r
@@ -838,7 +838,7 @@ GetMemoryRegion (
     PageTable = (UINT32*)(SectionDescriptor & TT_DESCRIPTOR_SECTION_PAGETABLE_ADDRESS_MASK);\r
 \r
     // Calculate index into first level translation table for start of modification\r
-    PageTableIndex = TT_DESCRIPTOR_PAGE_BASE_ADDRESS (*BaseAddress) >> TT_DESCRIPTOR_PAGE_BASE_SHIFT;\r
+    PageTableIndex = ((*BaseAddress) & TT_DESCRIPTOR_PAGE_INDEX_MASK)  >> TT_DESCRIPTOR_PAGE_BASE_SHIFT;\r
     ASSERT (PageTableIndex < TRANSLATION_TABLE_PAGE_COUNT);\r
 \r
     PageAttributes = PageTable[PageTableIndex] & TT_DESCRIPTOR_PAGE_ATTRIBUTE_MASK;\r