diff mbox series

[edk2,RFC,4/7] ArmPkg/ArmMmuLib: take MAX_ALLOC_ADDRESS into account

Message ID 20181207112304.19765-5-ard.biesheuvel@linaro.org
State Superseded
Headers show
Series introduce MAX_ALLOC_ADDRESS to limit boot time allocations | expand

Commit Message

Ard Biesheuvel Dec. 7, 2018, 11:23 a.m. UTC
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>

---
 ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.19.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Laszlo Ersek Dec. 7, 2018, 12:42 p.m. UTC | #1
On 12/07/18 12:23, Ard Biesheuvel wrote:
> 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>

> ---

>  ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c

> index 5403b8d4070e..e41044142ef4 100644

> --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c

> +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c

> @@ -612,7 +612,7 @@ ArmConfigureMmu (

>    // use of 4 KB pages.

>    //

>    MaxAddress = MIN (LShiftU64 (1ULL, ArmGetPhysicalAddressBits ()) - 1,

> -                    MAX_ADDRESS);

> +                    MAX_ALLOC_ADDRESS);

>  

>    // Lookup the Table Level to get the information

>    LookupAddresstoRootTable (MaxAddress, &T0SZ, &RootTableEntryCount);

> 


Reviewed-by: Laszlo Ersek <lersek@redhat.com>


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
index 5403b8d4070e..e41044142ef4 100644
--- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
+++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
@@ -612,7 +612,7 @@  ArmConfigureMmu (
   // use of 4 KB pages.
   //
   MaxAddress = MIN (LShiftU64 (1ULL, ArmGetPhysicalAddressBits ()) - 1,
-                    MAX_ADDRESS);
+                    MAX_ALLOC_ADDRESS);
 
   // Lookup the Table Level to get the information
   LookupAddresstoRootTable (MaxAddress, &T0SZ, &RootTableEntryCount);