diff mbox

[U-Boot,1/2] powerpc: Stack Pointer must be 16 aligned

Message ID 1342776046-25513-1-git-send-email-Joakim.Tjernlund@transmode.se
State Superseded, archived
Delegated to: Andy Fleming
Headers show

Commit Message

Joakim Tjernlund July 20, 2012, 9:20 a.m. UTC
The PowerPC ABI mandates the SP to be 16 bytes aligned, make is so.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
---
 arch/powerpc/lib/board.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

Comments

Scott Wood July 20, 2012, 9:12 p.m. UTC | #1
On 07/20/2012 04:20 AM, Joakim Tjernlund wrote:
> The PowerPC ABI mandates the SP to be 16 bytes aligned, make is so.
> 
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> ---
>  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..dc7cc40 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;   /* NULL Back Chain */
> +	*--s = 0; /* NULL LR */

Same problems as in patch 2/2.

-Scott
Joakim Tjernlund July 21, 2012, 3:10 p.m. UTC | #2
Scott Wood <scottwood@freescale.com> wrote on 2012/07/20 23:12:49:

> From: Scott Wood <scottwood@freescale.com>
> To: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>,
> Cc: <u-boot@lists.denx.de>
> Date: 2012/07/20 23:12
> Subject: Re: [U-Boot] [PATCH 1/2] powerpc: Stack Pointer must be 16 aligned
>
> On 07/20/2012 04:20 AM, Joakim Tjernlund wrote:
> > The PowerPC ABI mandates the SP to be 16 bytes aligned, make is so.
> >
> > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> > ---
> >  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..dc7cc40 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;   /* NULL Back Chain */
> > +   *--s = 0; /* NULL LR */
>
> Same problems as in patch 2/2.

Right, that should be
    *s = 0;		/* NULL Back Chain */
    *++s = 0;	/* NULL LR */

 Jocke
diff mbox

Patch

diff --git arch/powerpc/lib/board.c arch/powerpc/lib/board.c
index d5b75e5..dc7cc40 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;   /* NULL Back Chain */
+	*--s = 0; /* NULL LR */
 	debug("Stack Pointer at: %08lx\n", addr_sp);
 
 	/*