From b75d7605b4c09d5d431c2d57f70341c2f43de3c3 Mon Sep 17 00:00:00 2001 From: Olivier Martin Date: Mon, 2 Sep 2013 13:12:17 +0000 Subject: [PATCH] ArmPkg/CpuDxe: Fixed calculation of the Page Table Index (Level 2 Descriptor) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ArmPkg/Drivers/CpuDxe/ArmV6/Mmu.c b/ArmPkg/Drivers/CpuDxe/ArmV6/Mmu.c index 474f105d22..2896f708a4 100644 --- a/ArmPkg/Drivers/CpuDxe/ArmV6/Mmu.c +++ b/ArmPkg/Drivers/CpuDxe/ArmV6/Mmu.c @@ -768,7 +768,7 @@ GetMemoryRegionPage ( PageAttributes = ConvertSectionAttributesToPageAttributes (*RegionAttributes, 0); // Calculate index into first level translation table for start of modification - TableIndex = TT_DESCRIPTOR_PAGE_BASE_ADDRESS(*BaseAddress) >> TT_DESCRIPTOR_PAGE_BASE_SHIFT; + TableIndex = ((*BaseAddress) & TT_DESCRIPTOR_PAGE_INDEX_MASK) >> TT_DESCRIPTOR_PAGE_BASE_SHIFT; ASSERT (TableIndex < TRANSLATION_TABLE_PAGE_COUNT); // Go through the page table to find the end of the section @@ -838,7 +838,7 @@ GetMemoryRegion ( PageTable = (UINT32*)(SectionDescriptor & TT_DESCRIPTOR_SECTION_PAGETABLE_ADDRESS_MASK); // Calculate index into first level translation table for start of modification - PageTableIndex = TT_DESCRIPTOR_PAGE_BASE_ADDRESS (*BaseAddress) >> TT_DESCRIPTOR_PAGE_BASE_SHIFT; + PageTableIndex = ((*BaseAddress) & TT_DESCRIPTOR_PAGE_INDEX_MASK) >> TT_DESCRIPTOR_PAGE_BASE_SHIFT; ASSERT (PageTableIndex < TRANSLATION_TABLE_PAGE_COUNT); PageAttributes = PageTable[PageTableIndex] & TT_DESCRIPTOR_PAGE_ATTRIBUTE_MASK; -- 2.39.2