diff mbox

[U-Boot,PATCHv2,2/2] powerpc: Stack Pointer not properly aligned

Message ID 1343077083-13983-2-git-send-email-Joakim.Tjernlund@transmode.se
State Accepted, archived
Delegated to: Andy Fleming
Headers show

Commit Message

Joakim Tjernlund July 23, 2012, 8:58 p.m. UTC
The code first aligns the SP to 16 then subtract 8, making it
8 bytes aligned. Furthermore the initial stack frame not
quite correct either.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
---

 v2 - Address Scott Wood's comments

 arch/powerpc/lib/board.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

Comments

Joakim Tjernlund Aug. 14, 2012, 8:55 p.m. UTC | #1
Ping?

>
> The code first aligns the SP to 16 then subtract 8, making it
> 8 bytes aligned. Furthermore the initial stack frame not
> quite correct either.
>
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> ---
>
>  v2 - Address Scott Wood's comments
>
>  arch/powerpc/lib/board.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git arch/powerpc/lib/board.c arch/powerpc/lib/board.c
> index d5b75e5..a46942c 100644
> --- arch/powerpc/lib/board.c
> +++ arch/powerpc/lib/board.c
> @@ -521,9 +521,8 @@ void board_init_f(ulong bootflag)
>     addr_sp -= 16;
>     addr_sp &= ~0xF;
>     s = (ulong *) addr_sp;
> -   *s-- = 0;
> -   *s-- = 0;
> -   addr_sp = (ulong) s;
> +   *s = 0; /* Terminate back chain */
> +   *++s = 0; /* NULL return address */
>     debug("Stack Pointer at: %08lx\n", addr_sp);
>
>     /*
> --
> 1.7.3.4
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
diff mbox

Patch

diff --git arch/powerpc/lib/board.c arch/powerpc/lib/board.c
index d5b75e5..a46942c 100644
--- arch/powerpc/lib/board.c
+++ arch/powerpc/lib/board.c
@@ -521,9 +521,8 @@  void board_init_f(ulong bootflag)
 	addr_sp -= 16;
 	addr_sp &= ~0xF;
 	s = (ulong *) addr_sp;
-	*s-- = 0;
-	*s-- = 0;
-	addr_sp = (ulong) s;
+	*s = 0; /* Terminate back chain */
+	*++s = 0; /* NULL return address */
 	debug("Stack Pointer at: %08lx\n", addr_sp);
 
 	/*