[U-Boot] [PATCH] arm: bugfix: replace ble with blo in start.S files

Albert Aribaud albert.aribaud at free.fr
Tue Oct 5 14:57:12 CEST 2010


Generalized misuse of ble within relocation and bss
initialization loops caused one iiteration too many.
Instead of ble ('branch if lower or equal'), use
blo ('branch if lower').

Signed-off-by: Albert Aribaud <albert.aribaud at free.fr>
---
 arch/arm/cpu/arm1136/start.S   |    4 ++--
 arch/arm/cpu/arm1176/start.S   |    6 +++---
 arch/arm/cpu/arm720t/start.S   |    6 +++---
 arch/arm/cpu/arm920t/start.S   |    6 +++---
 arch/arm/cpu/arm925t/start.S   |    6 +++---
 arch/arm/cpu/arm926ejs/start.S |    8 ++++----
 arch/arm/cpu/arm946es/start.S  |    4 ++--
 arch/arm/cpu/arm_intcm/start.S |    6 +++---
 arch/arm/cpu/armv7/start.S     |    4 ++--
 arch/arm/cpu/ixp/start.S       |    6 +++---
 arch/arm/cpu/lh7a40x/start.S   |    9 ++++-----
 arch/arm/cpu/pxa/start.S       |    6 +++---
 arch/arm/cpu/s3c44b0/start.S   |    8 ++++----
 arch/arm/cpu/sa1100/start.S    |    6 +++---
 14 files changed, 42 insertions(+), 43 deletions(-)

diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S
index 8b63192..3c65f32 100644
--- a/arch/arm/cpu/arm1136/start.S
+++ b/arch/arm/cpu/arm1136/start.S
@@ -236,7 +236,7 @@ copy_loop:
 	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
 	stmia	r6!, {r9-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 
 #ifndef CONFIG_PRELOADER
 	/* fix got entries */
@@ -356,7 +356,7 @@ copy_loop:
 	ldmia	r0!, {r3-r10}		/* copy from source address [r0]    */
 	stmia	r1!, {r3-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 #endif	/* CONFIG_SKIP_RELOCATE_UBOOT */
 
 	/* Set up the stack						    */
diff --git a/arch/arm/cpu/arm1176/start.S b/arch/arm/cpu/arm1176/start.S
index e5e7913..7b2c6cc 100644
--- a/arch/arm/cpu/arm1176/start.S
+++ b/arch/arm/cpu/arm1176/start.S
@@ -285,7 +285,7 @@ copy_loop:
 	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
 	stmia	r6!, {r9-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 
 #ifndef CONFIG_PRELOADER
 	/* fix got entries */
@@ -501,7 +501,7 @@ copy_loop:
 	ldmia	r0!, {r3-r10}		/* copy from source address [r0]    */
 	stmia	r1!, {r3-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 #endif	/* CONFIG_SKIP_RELOCATE_UBOOT */
 
 #ifdef CONFIG_ENABLE_MMU
@@ -559,7 +559,7 @@ clbss_l:
 	str	r2, [r0]		/* clear loop...                    */
 	add	r0, r0, #4
 	cmp	r0, r1
-	ble	clbss_l
+	blo	clbss_l
 
 #ifndef CONFIG_NAND_SPL
 	ldr	pc, _start_armboot
diff --git a/arch/arm/cpu/arm720t/start.S b/arch/arm/cpu/arm720t/start.S
index 0f5f6c4..39567fa 100644
--- a/arch/arm/cpu/arm720t/start.S
+++ b/arch/arm/cpu/arm720t/start.S
@@ -202,7 +202,7 @@ copy_loop:
 	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
 	stmia	r6!, {r9-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 
 #ifndef CONFIG_PRELOADER
 	/* fix got entries */
@@ -319,7 +319,7 @@ copy_loop:
 	ldmia	r0!, {r3-r10}		/* copy from source address [r0]    */
 	stmia	r1!, {r3-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 
 #endif	/* CONFIG_SKIP_RELOCATE_UBOOT */
 
@@ -342,7 +342,7 @@ clear_bss:
 clbss_l:str	r2, [r0]		/* clear loop...		    */
 	add	r0, r0, #4
 	cmp	r0, r1
-	ble	clbss_l
+	blo	clbss_l
 
 	ldr	pc, _start_armboot
 
diff --git a/arch/arm/cpu/arm920t/start.S b/arch/arm/cpu/arm920t/start.S
index a079bb2..06f5623 100644
--- a/arch/arm/cpu/arm920t/start.S
+++ b/arch/arm/cpu/arm920t/start.S
@@ -247,7 +247,7 @@ copy_loop:
 	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
 	stmia	r6!, {r9-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 
 #ifndef CONFIG_PRELOADER
 	/* fix got entries */
@@ -407,7 +407,7 @@ copy_loop:
 	ldmia	r0!, {r3-r10}		/* copy from source address [r0]    */
 	stmia	r1!, {r3-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 #endif	/* CONFIG_SKIP_RELOCATE_UBOOT */
 
 	/* Set up the stack						    */
@@ -429,7 +429,7 @@ clear_bss:
 clbss_l:str	r2, [r0]		/* clear loop...                    */
 	add	r0, r0, #4
 	cmp	r0, r1
-	ble	clbss_l
+	blo	clbss_l
 
 	ldr	pc, _start_armboot
 
diff --git a/arch/arm/cpu/arm925t/start.S b/arch/arm/cpu/arm925t/start.S
index c0a856d..982a4e6 100644
--- a/arch/arm/cpu/arm925t/start.S
+++ b/arch/arm/cpu/arm925t/start.S
@@ -239,7 +239,7 @@ copy_loop:
 	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
 	stmia	r6!, {r9-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 
 #ifndef CONFIG_PRELOADER
 	/* fix got entries */
@@ -378,7 +378,7 @@ copy_loop:
 	ldmia	r0!, {r3-r10}		/* copy from source address [r0]    */
 	stmia	r1!, {r3-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 #endif	/* CONFIG_SKIP_RELOCATE_UBOOT */
 
 	/* Set up the stack						    */
@@ -400,7 +400,7 @@ clear_bss:
 clbss_l:str	r2, [r0]		/* clear loop...                    */
 	add	r0, r0, #4
 	cmp	r0, r1
-	ble	clbss_l
+	blo	clbss_l
 
 	ldr	pc, _start_armboot
 
diff --git a/arch/arm/cpu/arm926ejs/start.S b/arch/arm/cpu/arm926ejs/start.S
index 16ee972..85dbf15 100644
--- a/arch/arm/cpu/arm926ejs/start.S
+++ b/arch/arm/cpu/arm926ejs/start.S
@@ -236,8 +236,8 @@ stack_setup:
 copy_loop:
 	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
 	stmia	r6!, {r9-r10}		/* copy to   target address [r1]    */
-	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	cmp	r0, r2			/* until source end address [r2]    */
+	blo	copy_loop
 
 #ifndef CONFIG_PRELOADER
 	/* fix got entries */
@@ -342,7 +342,7 @@ copy_loop:
 	ldmia	r0!, {r3-r10}		/* copy from source address [r0]    */
 	stmia	r1!, {r3-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 #endif	/* CONFIG_SKIP_RELOCATE_UBOOT */
 
 	/* Set up the stack						    */
@@ -368,7 +368,7 @@ clear_bss:
 clbss_l:str	r2, [r0]		/* clear loop...                    */
 	add	r0, r0, #4
 	cmp	r0, r1
-	ble	clbss_l
+	blo	clbss_l
 
 	bl coloured_LED_init
 	bl red_LED_on
diff --git a/arch/arm/cpu/arm946es/start.S b/arch/arm/cpu/arm946es/start.S
index 18ed0b2..374bf1e 100644
--- a/arch/arm/cpu/arm946es/start.S
+++ b/arch/arm/cpu/arm946es/start.S
@@ -208,7 +208,7 @@ copy_loop:
 	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
 	stmia	r6!, {r9-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 
 #ifndef CONFIG_PRELOADER
 	/* fix got entries */
@@ -310,7 +310,7 @@ copy_loop:
 	ldmia	r0!, {r3-r10}		/* copy from source address [r0]    */
 	stmia	r1!, {r3-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 
 	/* Set up the stack						    */
 stack_setup:
diff --git a/arch/arm/cpu/arm_intcm/start.S b/arch/arm/cpu/arm_intcm/start.S
index b39fdc6..aa3707e 100644
--- a/arch/arm/cpu/arm_intcm/start.S
+++ b/arch/arm/cpu/arm_intcm/start.S
@@ -206,7 +206,7 @@ copy_loop:
 	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
 	stmia	r6!, {r9-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 
 #ifndef CONFIG_PRELOADER
 	/* fix got entries */
@@ -306,7 +306,7 @@ copy_loop:
 	ldmia	r0!, {r3-r10}		/* copy from source address [r0]    */
 	stmia	r1!, {r3-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 
 	/* Set up the stack						    */
 stack_setup:
@@ -327,7 +327,7 @@ clear_bss:
 clbss_l:str	r2, [r0]		/* clear loop...                    */
 	add	r0, r0, #4
 	cmp	r0, r1
-	ble	clbss_l
+	blo	clbss_l
 
 	ldr	pc, _start_armboot
 
diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
index f411c0f..53a356e 100644
--- a/arch/arm/cpu/armv7/start.S
+++ b/arch/arm/cpu/armv7/start.S
@@ -210,7 +210,7 @@ copy_loop:
 	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
 	stmia	r6!, {r9-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 
 #ifndef CONFIG_PRELOADER
 	/* fix got entries */
@@ -325,7 +325,7 @@ copy_loop:				@ copy 32 bytes at a time
 	ldmia	r0!, {r3 - r10}		@ copy from source address [r0]
 	stmia	r1!, {r3 - r10}		@ copy to   target address [r1]
 	cmp	r0, r2			@ until source end addreee [r2]
-	ble	copy_loop
+	blo	copy_loop
 #endif	/* CONFIG_SKIP_RELOCATE_UBOOT */
 
 	/* Set up the stack */
diff --git a/arch/arm/cpu/ixp/start.S b/arch/arm/cpu/ixp/start.S
index b2c8255..cd42e9c 100644
--- a/arch/arm/cpu/ixp/start.S
+++ b/arch/arm/cpu/ixp/start.S
@@ -331,7 +331,7 @@ copy_loop:
 	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
 	stmia	r6!, {r9-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 
 #ifndef CONFIG_PRELOADER
 	/* fix got entries */
@@ -548,7 +548,7 @@ copy_loop:
 	ldmia	r0!, {r3-r10}		/* copy from source address [r0]    */
 	stmia	r1!, {r3-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 #endif	/* CONFIG_SKIP_RELOCATE_UBOOT */
 
 	/* Set up the stack						    */
@@ -570,7 +570,7 @@ clear_bss:
 clbss_l:str	r2, [r0]		/* clear loop...                    */
 	add	r0, r0, #4
 	cmp	r0, r1
-	ble	clbss_l
+	blo	clbss_l
 
 	ldr	pc, _start_armboot
 
diff --git a/arch/arm/cpu/lh7a40x/start.S b/arch/arm/cpu/lh7a40x/start.S
index 002116a..bb0b850 100644
--- a/arch/arm/cpu/lh7a40x/start.S
+++ b/arch/arm/cpu/lh7a40x/start.S
@@ -219,8 +219,8 @@ stack_setup:
 copy_loop:
 	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
 	stmia	r6!, {r9-r10}		/* copy to   target address [r1]    */
-	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	cmp	r0, r2			/* until source end address [r2]    */
+	blo	copy_loop
 
 #ifndef CONFIG_PRELOADER
 	/* fix got entries */
@@ -342,8 +342,7 @@ copy_loop:
 	ldmia	r0!, {r3-r10}		/* copy from source address [r0]    */
 	stmia	r1!, {r3-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	blt	copy_loop		/* a 'ble' here actually copies     */
-					/*   four bytes of bss              */
+	blo	copy_loop
 #endif	/* CONFIG_SKIP_RELOCATE_UBOOT */
 
 	/* Set up the stack						    */
@@ -367,7 +366,7 @@ clear_bss:
 clbss_l:str	r2, [r0]		/* clear loop...                    */
 	add	r0, r0, #4
 	cmp	r0, r1
-	ble	clbss_l
+	blo	clbss_l
 
 	ldr	pc, _start_armboot
 
diff --git a/arch/arm/cpu/pxa/start.S b/arch/arm/cpu/pxa/start.S
index 064ddbc..4cf8856 100644
--- a/arch/arm/cpu/pxa/start.S
+++ b/arch/arm/cpu/pxa/start.S
@@ -205,7 +205,7 @@ copy_loop:
 	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
 	stmia	r6!, {r9-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 
 #ifndef CONFIG_PRELOADER
 	/* fix got entries */
@@ -310,7 +310,7 @@ copy_loop:
 	ldmia	r0!, {r3-r10}		/* copy from source address [r0]    */
 	stmia	r1!, {r3-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end address [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 #endif /* !CONFIG_SKIP_RELOCATE_UBOOT */
 
 	/* Set up the stack						    */
@@ -337,7 +337,7 @@ clear_bss:
 clbss_l:str	r2, [r0]		/* clear loop...		    */
 	add	r0, r0, #4
 	cmp	r0, r1
-	ble	clbss_l
+	blo	clbss_l
 #endif
 
 	ldr	pc, _start_armboot
diff --git a/arch/arm/cpu/s3c44b0/start.S b/arch/arm/cpu/s3c44b0/start.S
index e1ab5cc..7acc8f6 100644
--- a/arch/arm/cpu/s3c44b0/start.S
+++ b/arch/arm/cpu/s3c44b0/start.S
@@ -192,7 +192,7 @@ copy_loop:
 	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
 	stmia	r6!, {r9-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 
 #ifndef CONFIG_PRELOADER
 	/* fix got entries */
@@ -225,7 +225,7 @@ vector_copy_loop:
 	ldmia	r0!, {r3-r10}
 	stmia	r1!, {r3-r10}
 	cmp	r0, r2
-	ble	vector_copy_loop
+	blo	vector_copy_loop
 #endif	/* #ifndef CONFIG_SKIP_RELOCATE_UBOOT */
 
 clear_bss:
@@ -311,7 +311,7 @@ copy_loop:
 	ldmia	r0!, {r3-r10}		/* copy from source address [r0]    */
 	stmia	r1!, {r3-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 
 /*
 	now copy to sram the interrupt vector
@@ -324,7 +324,7 @@ vector_copy_loop:
 	ldmia	r0!, {r3-r10}
 	stmia	r1!, {r3-r10}
 	cmp	r0, r2
-	ble	vector_copy_loop
+	blo	vector_copy_loop
 #endif	/* CONFIG_SKIP_RELOCATE_UBOOT */
 
 	/* Set up the stack						    */
diff --git a/arch/arm/cpu/sa1100/start.S b/arch/arm/cpu/sa1100/start.S
index 4730e5a..b4f3356 100644
--- a/arch/arm/cpu/sa1100/start.S
+++ b/arch/arm/cpu/sa1100/start.S
@@ -196,7 +196,7 @@ copy_loop:
 	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
 	stmia	r6!, {r9-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 
 #ifndef CONFIG_PRELOADER
 	/* fix got entries */
@@ -294,7 +294,7 @@ copy_loop:
 	ldmia	r0!, {r3-r10}		/* copy from source address [r0]    */
 	stmia	r1!, {r3-r10}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end addreee [r2]    */
-	ble	copy_loop
+	blo	copy_loop
 #endif	/* CONFIG_SKIP_RELOCATE_UBOOT */
 
 	/* Set up the stack						    */
@@ -316,7 +316,7 @@ clear_bss:
 clbss_l:str	r2, [r0]		/* clear loop...                    */
 	add	r0, r0, #4
 	cmp	r0, r1
-	ble	clbss_l
+	blo	clbss_l
 
 	ldr	pc, _start_armboot
 
-- 
1.7.0.4



More information about the U-Boot mailing list