[U-Boot] [PATCH 3/3] arm: fix incorrect monitor protection region in FLASH

Po-Yu Chuang ratbert.chuang at gmail.com
Wed Mar 2 07:02:09 CET 2011


From: Po-Yu Chuang <ratbert at faraday-tech.com>

Monitor protection region in FLASH did not cover .rel.dyn section
and .dynsym sections, because it uses __bss_start to compute
monitor_flash_len. Use _end instead.

Add _end_ofs to all the start.S.

Signed-off-by: Po-Yu Chuang <ratbert at faraday-tech.com>
---
 arch/arm/cpu/arm1136/start.S      |    4 ++++
 arch/arm/cpu/arm1176/start.S      |    4 ++++
 arch/arm/cpu/arm720t/start.S      |    4 ++++
 arch/arm/cpu/arm920t/start.S      |    4 ++++
 arch/arm/cpu/arm925t/start.S      |    4 ++++
 arch/arm/cpu/arm926ejs/start.S    |    4 ++++
 arch/arm/cpu/arm946es/start.S     |    4 ++++
 arch/arm/cpu/arm_intcm/start.S    |    4 ++++
 arch/arm/cpu/armv7/start.S        |    4 ++++
 arch/arm/cpu/ixp/start.S          |    4 ++++
 arch/arm/cpu/lh7a40x/start.S      |    4 ++++
 arch/arm/cpu/pxa/start.S          |    4 ++++
 arch/arm/cpu/s3c44b0/start.S      |    4 ++++
 arch/arm/cpu/sa1100/start.S       |    4 ++++
 arch/arm/include/asm/u-boot-arm.h |    1 +
 arch/arm/lib/board.c              |    2 +-
 16 files changed, 58 insertions(+), 1 deletions(-)

diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S
index 64426fa..3c5f3ef 100644
--- a/arch/arm/cpu/arm1136/start.S
+++ b/arch/arm/cpu/arm1136/start.S
@@ -104,6 +104,10 @@ _bss_start_ofs:
 _bss_end_ofs:
 	.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+	.word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/arm1176/start.S b/arch/arm/cpu/arm1176/start.S
index c1302df..6ae118a 100644
--- a/arch/arm/cpu/arm1176/start.S
+++ b/arch/arm/cpu/arm1176/start.S
@@ -123,6 +123,10 @@ _bss_start_ofs:
 _bss_end_ofs:
 	.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+	.word _end - _start
+
 /* IRQ stack memory (calculated at run-time) + 8 bytes */
 .globl IRQ_STACK_START_IN
 IRQ_STACK_START_IN:
diff --git a/arch/arm/cpu/arm720t/start.S b/arch/arm/cpu/arm720t/start.S
index c521753..e774c3f 100644
--- a/arch/arm/cpu/arm720t/start.S
+++ b/arch/arm/cpu/arm720t/start.S
@@ -93,6 +93,10 @@ _bss_start_ofs:
 _bss_end_ofs:
 	.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+	.word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/arm920t/start.S b/arch/arm/cpu/arm920t/start.S
index 6db61c2..a7476b0 100644
--- a/arch/arm/cpu/arm920t/start.S
+++ b/arch/arm/cpu/arm920t/start.S
@@ -89,6 +89,10 @@ _bss_start_ofs:
 _bss_end_ofs:
 	.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+	.word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/arm925t/start.S b/arch/arm/cpu/arm925t/start.S
index b89cf4a..39f2e99 100644
--- a/arch/arm/cpu/arm925t/start.S
+++ b/arch/arm/cpu/arm925t/start.S
@@ -99,6 +99,10 @@ _bss_start_ofs:
 _bss_end_ofs:
 	.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+	.word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/arm926ejs/start.S b/arch/arm/cpu/arm926ejs/start.S
index 7798ef8..fefcfa2 100644
--- a/arch/arm/cpu/arm926ejs/start.S
+++ b/arch/arm/cpu/arm926ejs/start.S
@@ -133,6 +133,10 @@ _bss_start_ofs:
 _bss_end_ofs:
 	.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+	.word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/arm946es/start.S b/arch/arm/cpu/arm946es/start.S
index 1b6b188..00914f4 100644
--- a/arch/arm/cpu/arm946es/start.S
+++ b/arch/arm/cpu/arm946es/start.S
@@ -105,6 +105,10 @@ _bss_start_ofs:
 _bss_end_ofs:
 	.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+	.word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/arm_intcm/start.S b/arch/arm/cpu/arm_intcm/start.S
index da2c265..2fd3b9a 100644
--- a/arch/arm/cpu/arm_intcm/start.S
+++ b/arch/arm/cpu/arm_intcm/start.S
@@ -101,6 +101,10 @@ _bss_start_ofs:
 _bss_end_ofs:
 	.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+	.word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
index bc7bae8..d83d501 100644
--- a/arch/arm/cpu/armv7/start.S
+++ b/arch/arm/cpu/armv7/start.S
@@ -81,6 +81,10 @@ _bss_start_ofs:
 _bss_end_ofs:
 	.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+	.word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/ixp/start.S b/arch/arm/cpu/ixp/start.S
index f8bfed7..561c1f4 100644
--- a/arch/arm/cpu/ixp/start.S
+++ b/arch/arm/cpu/ixp/start.S
@@ -112,6 +112,10 @@ _bss_start_ofs:
 _bss_end_ofs:
 	.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+	.word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/lh7a40x/start.S b/arch/arm/cpu/lh7a40x/start.S
index bd821a2..81242b1 100644
--- a/arch/arm/cpu/lh7a40x/start.S
+++ b/arch/arm/cpu/lh7a40x/start.S
@@ -89,6 +89,10 @@ _bss_start_ofs:
 _bss_end_ofs:
 	.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+	.word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/pxa/start.S b/arch/arm/cpu/pxa/start.S
index ca072c4..f1dbc3b 100644
--- a/arch/arm/cpu/pxa/start.S
+++ b/arch/arm/cpu/pxa/start.S
@@ -106,6 +106,10 @@ _bss_start_ofs:
 _bss_end_ofs:
 	.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+	.word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/s3c44b0/start.S b/arch/arm/cpu/s3c44b0/start.S
index ac1c4fb..10f5284 100644
--- a/arch/arm/cpu/s3c44b0/start.S
+++ b/arch/arm/cpu/s3c44b0/start.S
@@ -80,6 +80,10 @@ _bss_start_ofs:
 _bss_end_ofs:
 	.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+	.word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/sa1100/start.S b/arch/arm/cpu/sa1100/start.S
index 5cfe19b..b27e970 100644
--- a/arch/arm/cpu/sa1100/start.S
+++ b/arch/arm/cpu/sa1100/start.S
@@ -90,6 +90,10 @@ _bss_start_ofs:
 _bss_end_ofs:
 	.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+	.word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/include/asm/u-boot-arm.h b/arch/arm/include/asm/u-boot-arm.h
index 33973a3..3904027 100644
--- a/arch/arm/include/asm/u-boot-arm.h
+++ b/arch/arm/include/asm/u-boot-arm.h
@@ -32,6 +32,7 @@
 /* for the following variables, see start.S */
 extern ulong _bss_start_ofs;	/* BSS start relative to _start */
 extern ulong _bss_end_ofs;		/* BSS end relative to _start */
+extern ulong _end_ofs;		/* end of image relative to _start */
 extern ulong IRQ_STACK_START;	/* top of IRQ stack */
 extern ulong FIQ_STACK_START;	/* top of FIQ stack */
 extern ulong _TEXT_BASE;	/* code start */
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index c620d2c..dc46e21 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -459,7 +459,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	gd->flags |= GD_FLG_RELOC;	/* tell others: relocation done */
 
-	monitor_flash_len = _bss_start_ofs;
+	monitor_flash_len = _end_ofs;
 	debug ("monitor flash len: %08lX\n", monitor_flash_len);
 	board_init();	/* Setup chipselects */
 
-- 
1.6.3.3



More information about the U-Boot mailing list