Patchwork [U-Boot,1/2] MIPS: fix a latent bug on initialize $gp

login
register
mail settings
Submitter Zhi-zhou Zhang
Date Nov. 24, 2012, 3:07 p.m.
Message ID <1353769633-31374-3-git-send-email-zhizhou.zh@gmail.com>
Download mbox | patch
Permalink /patch/201489/
State Accepted
Delegated to: Daniel Schwierzeck
Headers show

Comments

Zhi-zhou Zhang - Nov. 24, 2012, 3:07 p.m.
If bal is 8 bytes aligned, the _gp will not be 8 bytes aligned.
then the following ld insntrustion generates a Adel exception.
So here make _gp be always aligned in 8 bytes.

Signed-off-by: Zhi-zhou Zhang <zhizhou.zh@gmail.com>
---
 arch/mips/cpu/mips64/start.S |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch

diff --git a/arch/mips/cpu/mips64/start.S b/arch/mips/cpu/mips64/start.S
index 4112de7..8e8cc33 100644
--- a/arch/mips/cpu/mips64/start.S
+++ b/arch/mips/cpu/mips64/start.S
@@ -108,7 +108,10 @@  reset:
 	mtc0	t0, CP0_CONFIG
 #endif
 
-	/* Initialize $gp */
+	/* Initialize $gp, _gp must be 8 bytes algined. */
+	.align 3
+	nop
+	nop
 	bal	1f
 	 nop
 	.dword	_gp