Revision: 18900
http://sourceforge.net/p/edk2/code/18900
Author: abiesheuvel
Date: 2015-11-18 16:18:40 +0000 (Wed, 18 Nov 2015)
Log Message:
-----------
ArmPkg/ArmV7Mmu: handle memory regions over 4 GB correctly
The ARM_MEMORY_REGION_DESCRIPTOR array provided by the platform may
contain entries that extend beyond the 4 GB boundary, above which
we can't map anything on 32-bit ARM. If this is the case, map only
the 1:1 addressable part.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <[email protected]>
Reviewed-by: Leif Lindholm <[email protected]>
Modified Paths:
--------------
trunk/edk2/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c
Modified: trunk/edk2/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c
===================================================================
--- trunk/edk2/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c 2015-11-18 15:59:59 UTC
(rev 18899)
+++ trunk/edk2/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c 2015-11-18 16:18:40 UTC
(rev 18900)
@@ -147,11 +147,18 @@
{
UINT32 *SectionEntry;
UINT32 Attributes;
- UINT32 PhysicalBase = MemoryRegion->PhysicalBase;
- UINT32 RemainLength = MemoryRegion->Length;
+ UINT32 PhysicalBase;
+ UINT32 RemainLength;
ASSERT(MemoryRegion->Length > 0);
+ if (MemoryRegion->PhysicalBase >= SIZE_4GB) {
+ return;
+ }
+
+ PhysicalBase = MemoryRegion->PhysicalBase;
+ RemainLength = MIN(MemoryRegion->Length, SIZE_4GB - PhysicalBase);
+
switch (MemoryRegion->Attributes) {
case ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK:
Attributes = TT_DESCRIPTOR_SECTION_WRITE_BACK(0);
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits