ArmPkg/ArmMmuLib: take MAX_ALLOC_ADDRESS into account
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 7 Dec 2018 10:57:22 +0000 (11:57 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 20 Dec 2018 10:02:07 +0000 (11:02 +0100)
When creating the page tables for the 1:1 mapping, ensure that we don't
attempt to map more than what is architecturally permitted when running
with 4 KB pages, which is 48 bits of VA. This will be reflected in the
value of MAX_ALLOC_ADDRESS once we override it for AArch64, so use that
macro instead of MAX_ADDRESS.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c

index 5403b8d..e410441 100644 (file)
@@ -612,7 +612,7 @@ ArmConfigureMmu (
   // use of 4 KB pages.\r
   //\r
   MaxAddress = MIN (LShiftU64 (1ULL, ArmGetPhysicalAddressBits ()) - 1,\r
-                    MAX_ADDRESS);\r
+                    MAX_ALLOC_ADDRESS);\r
 \r
   // Lookup the Table Level to get the information\r
   LookupAddresstoRootTable (MaxAddress, &T0SZ, &RootTableEntryCount);\r