[edk2] [PATCH 4/4] ArmPkg/ArmMmuLib: AARCH64: enable stack alignment checking

Ard Biesheuvel posted 4 patches 7 years, 8 months ago
[edk2] [PATCH 4/4] ArmPkg/ArmMmuLib: AARCH64: enable stack alignment checking
Posted by Ard Biesheuvel 7 years, 8 months ago
Enable the hardware stack alignment check, as mandated by the UEFI spec.
This ensures that the stack pointer is 16 byte aligned at each instance
where it is used as the base address in a load/store operation.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
index 9e0593ce598b..2f8f99d44a31 100644
--- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
+++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
@@ -734,6 +734,7 @@ ArmConfigureMmu (
               MAIR_ATTR(TT_ATTR_INDX_MEMORY_WRITE_BACK, MAIR_ATTR_NORMAL_MEMORY_WRITE_BACK));       // mapped to EFI_MEMORY_WB
 
   ArmDisableAlignmentCheck ();
+  ArmEnableStackAlignmentCheck ();
   ArmEnableInstructionCache ();
   ArmEnableDataCache ();
 
-- 
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 4/4] ArmPkg/ArmMmuLib: AARCH64: enable stack alignment checking
Posted by Leif Lindholm 7 years, 8 months ago
On Wed, Feb 22, 2017 at 09:38:21AM +0000, Ard Biesheuvel wrote:
> Enable the hardware stack alignment check, as mandated by the UEFI spec.
> This ensures that the stack pointer is 16 byte aligned at each instance
> where it is used as the base address in a load/store operation.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
>  ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
> index 9e0593ce598b..2f8f99d44a31 100644
> --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
> +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
> @@ -734,6 +734,7 @@ ArmConfigureMmu (
>                MAIR_ATTR(TT_ATTR_INDX_MEMORY_WRITE_BACK, MAIR_ATTR_NORMAL_MEMORY_WRITE_BACK));       // mapped to EFI_MEMORY_WB
>  
>    ArmDisableAlignmentCheck ();
> +  ArmEnableStackAlignmentCheck ();
>    ArmEnableInstructionCache ();
>    ArmEnableDataCache ();
>  
> -- 
> 2.7.4
> 
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel