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

Simon Kagstrom simon.kagstrom at netinsight.net
Thu Oct 29 04:26:27 EDT 2009


Regular U-boot recently added this patch,

  http://git.denx.de/?p=u-boot.git;a=commitdiff;h=8003c361deec3ee651451662efd05352f1abdd40

and while browsing the U-boot v2 tree (the layout looks very nice
indeed!), I saw that it was leaving the stack unaligned. This caused me
a lot of problems in regular U-boot and quite a bit of headache, so it
would be nice to have it fixed in v2 as well.

This is completely untested, and if I misunderstood something about the
code so that the stack is aligned elsewhere, please ignore the patch.

Signed-off-by: Simon Kagstrom <simon.kagstrom at netinsight.net>
---
 arch/arm/cpu/start-arm.S |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/start-arm.S b/arch/arm/cpu/start-arm.S
index 408944a..9981ef0 100644
--- a/arch/arm/cpu/start-arm.S
+++ b/arch/arm/cpu/start-arm.S
@@ -231,6 +231,7 @@ copy_loop:
 stack_setup:
 	ldr	r0, _STACK_START
 	sub	sp, r0, #12		/* leave 3 words for abort-stack    */
+	bic     sp, r0, #7              /* 8-byte align stack for ABI compliance */
 
 clear_bss:
 	ldr	r0, _bss_start		/* find start of bss segment        */
-- 
1.6.0.4





More information about the u-boot-v2 mailing list