[PATCH] arm: 8-byte align stack to avoid LDRD/STRD problems

Simon Kagstrom simon.kagstrom at netinsight.net
Thu Oct 29 05:33:32 EDT 2009


On Thu, 29 Oct 2009 10:14:41 +0100
Sascha Hauer <s.hauer at pengutronix.de> wrote:

> _STACK_START:
> 	.word STACK_BASE + STACK_SIZE - 4
> 
> [...]
> 
> 	ldr	r0, _STACK_START
> 	sub	sp, r0, #12		/* leave 3 words for abort-stack */
> 
> STACK_BASE and STACK_SIZE should be aligned, so the stack pointer
> should also be 16byte aligned. Of course it is aligned by accident which
> is not very good.
> 
> Instead of using another instruction for ensuring alignment how about
> saving some instructions. I'm not sure about the abort stack though.
> Does it have to be 8byte aligned aswell?

I'm not sure about the abort stack either. But I would guess that there
just needs to be some space for it - alignment is probably not
important, although someone more proficient in ARM than me should
clarify that.

You are right though: It's a better idea to just setup _STACK_START to
some good value and just set the stack pointer there. So ignore this
patch for now :-)

// Simon




More information about the u-boot-v2 mailing list