arm: fix incorrect monitor protection region in FLASH
PATCH 3/3 arm: fix incorrect monitor protection region in FLASH
From: Po-Yu Chuang <[email protected]>
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.
--- 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(-)
arch/arm/cpu/arm1136/start.S +4 -0
@@ -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
arch/arm/cpu/arm1176/start.S +4 -0
@@ -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:
arch/arm/cpu/arm720t/start.S +4 -0
@@ -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
arch/arm/cpu/arm920t/start.S +4 -0
@@ -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
arch/arm/cpu/arm925t/start.S +4 -0
@@ -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
arch/arm/cpu/arm926ejs/start.S +4 -0
@@ -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
arch/arm/cpu/arm946es/start.S +4 -0
@@ -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
arch/arm/cpu/arm_intcm/start.S +4 -0
@@ -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
arch/arm/cpu/armv7/start.S +4 -0
@@ -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
arch/arm/cpu/ixp/start.S +4 -0
@@ -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
arch/arm/cpu/lh7a40x/start.S +4 -0
@@ -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
arch/arm/cpu/pxa/start.S +4 -0
@@ -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
arch/arm/cpu/s3c44b0/start.S +4 -0
@@ -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
arch/arm/cpu/sa1100/start.S +4 -0
@@ -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
arch/arm/include/asm/u-boot-arm.h +1 -0
@@ -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 */
arch/arm/lib/board.c +1 -1
@@ -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 */
Signature · 1 line
1.6.3.3
PATCH 3/3 arm: fix incorrect monitor protection region in FLASH
Hi Po-Yu Chuang,
Le 02/03/2011 07:02, Po-Yu Chuang a ?crit :
Quoted 10 lines
From: Po-Yu Chuang<[email protected]>
Monitor protection region in FLASH did not cover .rel.dyn section and .dynsym sections, because it uses
__bss_startto computemonitor_flash_len. Use_endinstead.Add
_end_ofsto all thestart.S.Signed-off-by Po-Yu Chuang<[email protected]>---
Open question: why not group patches 2 and 3 as a single functional patch? Patch 2 seems purposeless to me as a standalone patch.
Amicalement,
Signature · 1 line
Albert.
PATCH 3/3 arm: fix incorrect monitor protection region in FLASH
Hi Albert,
Quoted 10 lines · Albert ARIBAUD
Hi Po-Yu Chuang,
Le 02/03/2011 07:02, Po-Yu Chuang a ?crit :
Quoted 7 lines
From: Po-Yu Chuang<[email protected]>
Monitor protection region in FLASH did not cover .rel.dyn section and .dynsym sections, because it uses
__bss_startto computemonitor_flash_len. Use_endinstead.
Quoted 7 lines
Quoted 4 lines
Add
_end_ofsto all thestart.S.Signed-off-by Po-Yu Chuang<[email protected]>---
Open question: why not group patches 2 and 3 as a single functional patch? Patch 2 seems purposeless to me as a standalone patch.
I thought that patches 2 and 3 are separate steps, but I am fine with both ways. :-)
If no other comment, I will resend them as a single patch.
regards,
Po-Yu Chuang
PATCH v2 2/2 arm: fix incorrect monitor protection region in FLASH
In reply to Po-Yu ChuangFrom: Po-Yu Chuang <[email protected]>
Monitor protection region in FLASH did not cover .rel.dyn and .dynsym sections, because it uses __bss_start to compute monitor_flash_len. Use _end instead.
Add _end to linker scripts for end of u-boot image Add _end_ofs to all the start.S.
---
v2:
merge patch 2 and patch 3 of v1
arch/arm/cpu/arm1136/start.S | 4 ++++ arch/arm/cpu/arm1136/u-boot.lds | 2 ++ arch/arm/cpu/arm1176/start.S | 4 ++++ arch/arm/cpu/arm1176/u-boot.lds | 2 ++ arch/arm/cpu/arm720t/start.S | 4 ++++ arch/arm/cpu/arm720t/u-boot.lds | 2 ++ arch/arm/cpu/arm920t/ep93xx/u-boot.lds | 2 ++ arch/arm/cpu/arm920t/start.S | 4 ++++ arch/arm/cpu/arm920t/u-boot.lds | 2 ++ arch/arm/cpu/arm925t/start.S | 4 ++++ arch/arm/cpu/arm925t/u-boot.lds | 2 ++ arch/arm/cpu/arm926ejs/start.S | 4 ++++ arch/arm/cpu/arm926ejs/u-boot.lds | 2 ++ arch/arm/cpu/arm946es/start.S | 4 ++++ arch/arm/cpu/arm946es/u-boot.lds | 2 ++ arch/arm/cpu/arm_intcm/start.S | 4 ++++ arch/arm/cpu/arm_intcm/u-boot.lds | 2 ++ arch/arm/cpu/armv7/start.S | 4 ++++ arch/arm/cpu/armv7/u-boot.lds | 2 ++ arch/arm/cpu/ixp/start.S | 4 ++++ arch/arm/cpu/ixp/u-boot.lds | 2 ++ arch/arm/cpu/lh7a40x/start.S | 4 ++++ arch/arm/cpu/lh7a40x/u-boot.lds | 2 ++ arch/arm/cpu/pxa/start.S | 4 ++++ arch/arm/cpu/pxa/u-boot.lds | 2 ++ arch/arm/cpu/s3c44b0/start.S | 4 ++++ arch/arm/cpu/s3c44b0/u-boot.lds | 2 ++ arch/arm/cpu/sa1100/start.S | 4 ++++ arch/arm/cpu/sa1100/u-boot.lds | 2 ++ arch/arm/include/asm/u-boot-arm.h | 1 + arch/arm/lib/board.c | 2 +- 31 files changed, 88 insertions(+), 1 deletions(-)
arch/arm/cpu/arm1136/start.S +4 -0
@@ -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
arch/arm/cpu/arm1136/u-boot.lds +2 -0
@@ -72,6 +72,8 @@ SECTIONS *(.dynsym) } + _end = .; + .bss __rel_dyn_start (OVERLAY) : { __bss_start = .; *(.bss)
arch/arm/cpu/arm1176/start.S +4 -0
@@ -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:
arch/arm/cpu/arm1176/u-boot.lds +2 -0
@@ -61,6 +61,8 @@ SECTIONS *(.dynsym) } + _end = .; + .bss __rel_dyn_start (OVERLAY) : { __bss_start = .; *(.bss)
arch/arm/cpu/arm720t/start.S +4 -0
@@ -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
arch/arm/cpu/arm720t/u-boot.lds +2 -0
@@ -62,6 +62,8 @@ SECTIONS *(.dynsym) } + _end = .; + .bss __rel_dyn_start (OVERLAY) : { __bss_start = .; *(.bss)
arch/arm/cpu/arm920t/ep93xx/u-boot.lds +2 -0
@@ -56,4 +56,6 @@ SECTIONS __bss_start = .; .bss : { *(.bss) } __bss_end__ = .; + + _end = .; }
arch/arm/cpu/arm920t/start.S +4 -0
@@ -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
arch/arm/cpu/arm920t/u-boot.lds +2 -0
@@ -71,6 +71,8 @@ SECTIONS *(.dynsym) } + _end = .; + .bss __rel_dyn_start (OVERLAY) : { __bss_start = .; *(.bss)
arch/arm/cpu/arm925t/start.S +4 -0
@@ -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
arch/arm/cpu/arm925t/u-boot.lds +2 -0
@@ -66,6 +66,8 @@ SECTIONS *(.dynsym) } + _end = .; + .bss __rel_dyn_start (OVERLAY) : { __bss_start = .; *(.bss)
arch/arm/cpu/arm926ejs/start.S +4 -0
@@ -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
arch/arm/cpu/arm926ejs/u-boot.lds +2 -0
@@ -63,6 +63,8 @@ SECTIONS *(.dynsym) } + _end = .; + .bss __rel_dyn_start (OVERLAY) : { __bss_start = .; *(.bss)
arch/arm/cpu/arm946es/start.S +4 -0
@@ -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
arch/arm/cpu/arm946es/u-boot.lds +2 -0
@@ -63,6 +63,8 @@ SECTIONS *(.dynsym) } + _end = .; + .bss __rel_dyn_start (OVERLAY) : { __bss_start = .; *(.bss)
arch/arm/cpu/arm_intcm/start.S +4 -0
@@ -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
arch/arm/cpu/arm_intcm/u-boot.lds +2 -0
@@ -63,6 +63,8 @@ SECTIONS *(.dynsym) } + _end = .; + .bss __rel_dyn_start (OVERLAY) : { __bss_start = .; *(.bss)
arch/arm/cpu/armv7/start.S +4 -0
@@ -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
arch/arm/cpu/armv7/u-boot.lds +2 -0
@@ -66,6 +66,8 @@ SECTIONS *(.dynsym) } + _end = .; + .bss __rel_dyn_start (OVERLAY) : { __bss_start = .; *(.bss)
arch/arm/cpu/ixp/start.S +4 -0
@@ -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
arch/arm/cpu/ixp/u-boot.lds +2 -0
@@ -63,6 +63,8 @@ SECTIONS *(.dynsym) } + _end = .; + .bss __rel_dyn_start (OVERLAY) : { __bss_start = .; *(.bss)
arch/arm/cpu/lh7a40x/start.S +4 -0
@@ -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
arch/arm/cpu/lh7a40x/u-boot.lds +2 -0
@@ -63,6 +63,8 @@ SECTIONS *(.dynsym) } + _end = .; + .bss __rel_dyn_start (OVERLAY) : { __bss_start = .; *(.bss)
arch/arm/cpu/pxa/start.S +4 -0
@@ -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
arch/arm/cpu/pxa/u-boot.lds +2 -0
@@ -63,6 +63,8 @@ SECTIONS *(.dynsym) } + _end = .; + .bss __rel_dyn_start (OVERLAY) : { __bss_start = .; *(.bss)
arch/arm/cpu/s3c44b0/start.S +4 -0
@@ -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
arch/arm/cpu/s3c44b0/u-boot.lds +2 -0
@@ -63,6 +63,8 @@ SECTIONS *(.dynsym) } + _end = .; + .bss __rel_dyn_start (OVERLAY) : { __bss_start = .; *(.bss)
arch/arm/cpu/sa1100/start.S +4 -0
@@ -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
arch/arm/cpu/sa1100/u-boot.lds +2 -0
@@ -66,6 +66,8 @@ SECTIONS *(.dynsym) } + _end = .; + .bss __rel_dyn_start (OVERLAY) : { __bss_start = .; *(.bss)
arch/arm/include/asm/u-boot-arm.h +1 -0
@@ -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 */
arch/arm/lib/board.c +1 -1
@@ -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 */
Signature · 1 line
1.6.3.3
PATCH v2 2/2 arm: fix incorrect monitor protection region in FLASH
Le 02/03/2011 10:02, Po-Yu Chuang a ?crit :
Quoted 6 lines
From: Po-Yu Chuang<[email protected]>
Monitor protection region in FLASH did not cover .rel.dyn and .dynsym sections, because it uses
__bss_startto computemonitor_flash_len. Use_endinstead.
Quoted 7 lines
Add
_endto linker scripts for end of u-boot image Add_end_ofsto all thestart.S.Signed-off-by Po-Yu Chuang<[email protected]>---
v2:
merge patch 2 and patch 3 of v1
Checked on ED Mini V2, monitor_flash_len now correct wrt _end.
Amicalement,
Signature · 1 line
Albert.
PATCH v2 2/2 arm: fix incorrect monitor protection region in FLASH
In reply to Po-Yu ChuangLe 02/03/2011 10:02, Po-Yu Chuang a ?crit :
Quoted 6 lines
From: Po-Yu Chuang<[email protected]>
Monitor protection region in FLASH did not cover .rel.dyn and .dynsym sections, because it uses
__bss_startto computemonitor_flash_len. Use_endinstead.
Quoted 7 lines
Add
_endto linker scripts for end of u-boot image Add_end_ofsto all thestart.S.Signed-off-by Po-Yu Chuang<[email protected]>---
v2:
merge patch 2 and patch 3 of v1
Applied to u-boot-arm/master (as it is a bugfix), thanks!
Amicalement,
Signature · 1 line
Albert.