[PATCH] MIPS: starts.S fixup

Antony Pavlov antonynpavlov at gmail.com
Fri Jul 8 03:29:27 EDT 2011


---
 arch/mips/boot/start.S |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/mips/boot/start.S b/arch/mips/boot/start.S
index 53077e9..6996b33 100644
--- a/arch/mips/boot/start.S
+++ b/arch/mips/boot/start.S
@@ -70,10 +70,14 @@ _start:
 	mtc0	zero, CP0_COUNT
 	mtc0	zero, CP0_COMPARE
 
-	ADR	a0, _start, t1	/* a0 <- current position of _start */
+	/* copy barebox to link location */
+	ADR	a0, _start, t1	/* a0 <- pc-relative position of _start */
 
 	la	a1, _start	/* link (RAM) _start address */
 
+	beq	a0, a1, clear_bss
+	 nop
+
 	la	t0, _start
 	la	t1, __bss_start
 	subu	t2, t1, t0	/* t2 <- size of barebox */
@@ -82,11 +86,13 @@ _start:
 #define LONGSIZE	4
 
 copy_loop:
-	lw		t4, LONGSIZE * 0(a0)	# copy from source address [t0]
+	/* copy from source address [a0] */
+	lw		t4, LONGSIZE * 0(a0)
 	lw		t5, LONGSIZE * 1(a0)
 	lw		t6, LONGSIZE * 2(a0)
 	lw		t7, LONGSIZE * 3(a0)
-	sw		t4, LONGSIZE * 0(a1)	# copy fo target address [t1]
+	/* copy fo target address [a1] */
+	sw		t4, LONGSIZE * 0(a1)
 	sw		t5, LONGSIZE * 1(a1)
 	sw		t6, LONGSIZE * 2(a1)
 	sw		t7, LONGSIZE * 3(a1)
@@ -100,7 +106,7 @@ clear_bss:
 	sw	zero, (t0)
 	la	t1, _end - 4
 1:
-	addiu	t0, 4
+	addiu	t0, LONGSIZE
 	sw	zero, (t0)
 	bne	t0, t1, 1b
 	 nop
-- 
1.7.5.4




More information about the barebox mailing list