diff mbox series

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

Message ID 1487756301-15646-5-git-send-email-ard.biesheuvel@linaro.org
State Accepted
Commit 526f160f311c6d1540df68590712fdd70c2df0bc
Headers show
Series AARCH64: enable stack alignment check | expand

Commit Message

Ard Biesheuvel Feb. 22, 2017, 9:38 a.m. UTC
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(+)

-- 
2.7.4

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

Comments

Leif Lindholm Feb. 22, 2017, 12:14 p.m. UTC | #1
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
diff mbox series

Patch

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 ();