[edk2] [ArmPlatformPkg][Patch] reset x11 before use

Udit Kumar posted 1 patch 6 years, 11 months ago
Failed in applying to current master (apply log)
ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S | 1 +
1 file changed, 1 insertion(+)
[edk2] [ArmPlatformPkg][Patch] reset x11 before use
Posted by Udit Kumar 6 years, 11 months ago
This patch reset x11 to zero before using it.
x11 is marked as caller saved register, therefore before using it
default (reset) value should be assigned.

If ArmPlatformPeiBootAction function is using x11 then some of
calculation in this routine may go wrong.

Contributed-under: TianoCore Contribution Agreement 1.1

Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
---
 ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S b/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S
index a81709d..d391fc1 100644
--- a/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S
+++ b/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S
@@ -60,6 +60,7 @@ _SetupStack:
   // Because the 'push' instruction is equivalent to 'stmdb' (decrement before), we need to increment
   // one to the top of the stack. We check if incrementing one does not overflow (case of DRAM at the
   // top of the memory space)
+  mov x11, 0
   adds  x11, x1, #1
   b.cs  _SetupOverflowStack
 
-- 
1.9.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [ArmPlatformPkg][Patch] reset x11 before use
Posted by Ard Biesheuvel 6 years, 11 months ago
On 16 January 2018 at 21:51, Udit Kumar <udit.kumar@nxp.com> wrote:
> This patch reset x11 to zero before using it.
> x11 is marked as caller saved register, therefore before using it
> default (reset) value should be assigned.
>
> If ArmPlatformPeiBootAction function is using x11 then some of
> calculation in this routine may go wrong.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
>
> Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
> ---
>  ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S b/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S
> index a81709d..d391fc1 100644
> --- a/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S
> +++ b/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S
> @@ -60,6 +60,7 @@ _SetupStack:
>    // Because the 'push' instruction is equivalent to 'stmdb' (decrement before), we need to increment
>    // one to the top of the stack. We check if incrementing one does not overflow (case of DRAM at the
>    // top of the memory space)
> +  mov x11, 0
>    adds  x11, x1, #1
>    b.cs  _SetupOverflowStack
>

x11 is used as an output only by the adds instruction, so there is no
point in setting a value first.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel