The relocation code uses the CONFIG_SYS_MONITOR_BASE
constant for calculating the reserved memory size and
relocation offset values. Along with these predefined
values the code also uses several other constants which
are computed by the linker from the CONFIG_SYS_TEXT_BASE
value. Due to this, the relocation code works incorreclty
if the CONFIG_SYS_TEXT_BASE and CONFIG_SYS_MONITOR_BASE
values are different.

Change the relocation code to use the CONFIG_SYS_TEXT_BASE
constant in the calculations to avoid the problem.

Only tested in qemu with the 'malta' and 'qemu_mips{,el}'
targets.

Signed-off-by: Gabor Juhos <juh...@openwrt.org>
Cc: Daniel Schwierzeck <daniel.schwierz...@gmail.com>
Cc: Paul Burton <paul.bur...@imgtec.com>
---
Daniel,

This should be merged before my 'malta: use unmapped flash base address'
patch.

Thanks,
Gabor
---
 arch/mips/cpu/mips32/start.S |    2 +-
 arch/mips/cpu/mips64/start.S |    2 +-
 arch/mips/cpu/xburst/start.S |    2 +-
 arch/mips/lib/board.c        |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/mips/cpu/mips32/start.S b/arch/mips/cpu/mips32/start.S
index 68e59b5..13e2de7 100644
--- a/arch/mips/cpu/mips32/start.S
+++ b/arch/mips/cpu/mips32/start.S
@@ -159,7 +159,7 @@ relocate_code:
        move    s0, a1                  # save gd in s0
        move    s2, a2                  # save destination address in s2
 
-       li      t0, CONFIG_SYS_MONITOR_BASE
+       li      t0, CONFIG_SYS_TEXT_BASE
        sub     s1, s2, t0              # s1 <-- relocation offset
 
        la      t3, in_ram
diff --git a/arch/mips/cpu/mips64/start.S b/arch/mips/cpu/mips64/start.S
index 92954e1..4fa8bb1 100644
--- a/arch/mips/cpu/mips64/start.S
+++ b/arch/mips/cpu/mips64/start.S
@@ -153,7 +153,7 @@ relocate_code:
        move    s0, a1                  # save gd in s0
        move    s2, a2                  # save destination address in s2
 
-       dli     t0, CONFIG_SYS_MONITOR_BASE
+       dli     t0, CONFIG_SYS_TEXT_BASE
        dsub    s1, s2, t0              # s1 <-- relocation offset
 
        dla     t3, in_ram
diff --git a/arch/mips/cpu/xburst/start.S b/arch/mips/cpu/xburst/start.S
index 10dffb4..e9d9679 100644
--- a/arch/mips/cpu/xburst/start.S
+++ b/arch/mips/cpu/xburst/start.S
@@ -50,7 +50,7 @@ relocate_code:
        move    s0, a1                  # save gd in s0
        move    s2, a2                  # save destination address in s2
 
-       li      t0, CONFIG_SYS_MONITOR_BASE
+       li      t0, CONFIG_SYS_TEXT_BASE
        sub     s1, s2, t0              # s1 <-- relocation offset
 
        la      t3, in_ram
diff --git a/arch/mips/lib/board.c b/arch/mips/lib/board.c
index 9e6ba15..82efa5a 100644
--- a/arch/mips/lib/board.c
+++ b/arch/mips/lib/board.c
@@ -160,7 +160,7 @@ void board_init_f(ulong bootflag)
        /* Reserve memory for U-Boot code, data & bss
         * round down to next 16 kB limit
         */
-       len = bss_end() - CONFIG_SYS_MONITOR_BASE;
+       len = bss_end() - CONFIG_SYS_TEXT_BASE;
        addr -= len;
        addr &= ~(16 * 1024 - 1);
 
-- 
1.7.10
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to