public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [ArmPlatformPkg][Patch] reset x11 before use
@ 2018-01-16 21:51 Udit Kumar
  2018-01-17  9:55 ` Ard Biesheuvel
  0 siblings, 1 reply; 2+ messages in thread
From: Udit Kumar @ 2018-01-16 21:51 UTC (permalink / raw)
  To: edk2-devel, ard.biesheuvel, leif.lindholm; +Cc: varun.sethi, Udit Kumar

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [ArmPlatformPkg][Patch] reset x11 before use
  2018-01-16 21:51 [ArmPlatformPkg][Patch] reset x11 before use Udit Kumar
@ 2018-01-17  9:55 ` Ard Biesheuvel
  0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2018-01-17  9:55 UTC (permalink / raw)
  To: Udit Kumar; +Cc: edk2-devel@lists.01.org, Leif Lindholm, varun.sethi

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-17  9:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-16 21:51 [ArmPlatformPkg][Patch] reset x11 before use Udit Kumar
2018-01-17  9:55 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox