public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] MIPS: use CONFIG_SYS_TEXT_BASE in relocation calculations
@ 2013-11-11 19:02 Gabor Juhos
  2013-11-11 19:15 ` Daniel Schwierzeck
  2013-11-11 19:36 ` Daniel Schwierzeck
  0 siblings, 2 replies; 8+ messages in thread
From: Gabor Juhos @ 2013-11-11 19:02 UTC (permalink / raw)
  To: u-boot

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 <juhosg@openwrt.org>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Paul Burton <paul.burton@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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-11-12 15:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-11 19:02 [U-Boot] [PATCH] MIPS: use CONFIG_SYS_TEXT_BASE in relocation calculations Gabor Juhos
2013-11-11 19:15 ` Daniel Schwierzeck
2013-11-11 19:36 ` Daniel Schwierzeck
2013-11-11 20:31   ` Gabor Juhos
2013-11-11 22:36     ` Daniel Schwierzeck
2013-11-12 14:54       ` Gabor Juhos
2013-11-12 15:40         ` Daniel Schwierzeck
2013-11-12 15:47           ` Gabor Juhos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox