diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2015-11-18 16:18:40 +0000 |
---|---|---|
committer | abiesheuvel <abiesheuvel@Edk2> | 2015-11-18 16:18:40 +0000 |
commit | 55df704dd24928b60b10bbb9dec5bfa7682910de (patch) | |
tree | 9880b58b82987c1e0bcab5f759776db96d8dd57f /ArmPkg | |
parent | 72143137f4ea558757cb7933b1f3a0c21252126b (diff) | |
download | edk2-platforms-55df704dd24928b60b10bbb9dec5bfa7682910de.tar.xz |
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 <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18900 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg')
-rw-r--r-- | ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c b/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c index b2cfdba900..2e39ce00fe 100644 --- a/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c +++ b/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c @@ -147,11 +147,18 @@ FillTranslationTable ( {
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);
|