[U-Boot] [PATCH v5 16/23] Adjust board_f.c for ppc

Scott Wood scottwood at freescale.com
Tue Feb 12 23:32:20 CET 2013


On 02/08/2013 09:12:12 AM, Simon Glass wrote:
>  #ifndef CONFIG_SPL_BUILD
>  static int reserve_stacks(void)
>  {
> +#ifdef CONFIG_PPC
> +	ulong *s;
> +#endif
> +
>  	/* setup stack pointer for exceptions */
>  	gd->dest_addr_sp -= 16;
>  	gd->dest_addr_sp &= ~0xf;
> @@ -398,6 +532,14 @@ static int reserve_stacks(void)
>  	/* leave 3 words for abort-stack, plus 1 for alignment */
>  	gd->dest_addr_sp -= 16;
> 
> +#ifdef CONFIG_PPC
> +	/* Clear initial stack frame */
> +	s = (ulong *) gd->dest_addr_sp;
> +	*s = 0; /* Terminate back chain */
> +	*++s = 0; /* NULL return address */
> +	gd->dest_addr_sp = (ulong) s;
> +#endif
> +

PPC ABI requires 16-byte stack alignment, which would be broken by the  
CONFIG_USE_IRQ section (which even still has an "ARM ABI" comment).

I think this entire function should be kept in arch code.  Stack layout  
is inherently architecture/ABI specific.  Some architectures even have  
a stack that grows upward (not sure if any such are supported by  
U-Boot).

-Scott


More information about the U-Boot mailing list