From patchwork Mon Nov 11 19:02:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabor Juhos X-Patchwork-Id: 290468 X-Patchwork-Delegate: daniel.schwierzeck@googlemail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 4FA562C00A9 for ; Tue, 12 Nov 2013 06:02:42 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C83134A5C8; Mon, 11 Nov 2013 20:02:40 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z06dijtiTlue; Mon, 11 Nov 2013 20:02:40 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 58D6C4A590; Mon, 11 Nov 2013 20:02:39 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 85FFC4A58D for ; Mon, 11 Nov 2013 20:02:33 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BSAJp0PKkgJC for ; Mon, 11 Nov 2013 20:02:27 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) by theia.denx.de (Postfix) with ESMTPS id 652474A589 for ; Mon, 11 Nov 2013 20:02:22 +0100 (CET) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id EC4782802A6; Mon, 11 Nov 2013 20:00:36 +0100 (CET) Received: from localhost.localdomain (catvpool-576570d8.szarvasnet.hu [87.101.112.216]) by arrakis.dune.hu (Postfix) with ESMTPSA; Mon, 11 Nov 2013 20:00:36 +0100 (CET) From: Gabor Juhos To: u-boot@lists.denx.de Date: Mon, 11 Nov 2013 20:02:15 +0100 Message-Id: <1384196535-19289-1-git-send-email-juhosg@openwrt.org> X-Mailer: git-send-email 1.7.10 Subject: [U-Boot] [PATCH] MIPS: use CONFIG_SYS_TEXT_BASE in relocation calculations X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 Cc: Daniel Schwierzeck Cc: Paul Burton --- 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);