public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH RFC 2/3] arm920t: do not use r8 for relocation
Date: Tue, 30 Nov 2010 08:06:39 +0100	[thread overview]
Message-ID: <1291100800-61850-3-git-send-email-andreas.devel@googlemail.com> (raw)
In-Reply-To: <1291100800-61850-1-git-send-email-andreas.devel@googlemail.com>

r8 is used for gd and should therefore be left alone

Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>
---

I don't know if this is really needed, but we use --fixed-r8 compiler
flag for all arm boards. Albert, can you shed some light on that?

 arch/arm/cpu/arm920t/start.S |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/arch/arm/cpu/arm920t/start.S b/arch/arm/cpu/arm920t/start.S
index 71de373..629be3f 100644
--- a/arch/arm/cpu/arm920t/start.S
+++ b/arch/arm/cpu/arm920t/start.S
@@ -201,7 +201,6 @@ relocate_code:
 	mov	r4, r0	/* save addr_sp */
 	mov	r5, r1	/* save addr of gd */
 	mov	r6, r2	/* save addr of destination */
-	mov	r7, r2	/* save addr of destination */
 
 	/* Set up the stack						    */
 stack_setup:
@@ -226,7 +225,7 @@ copy_loop:
 	 * fix .rel.dyn relocations
 	 */
 	ldr	r0, _TEXT_BASE		/* r0 <- Text base */
-	sub	r9, r7, r0		/* r9 <- relocation offset */
+	sub	r9, r6, r0		/* r9 <- relocation offset */
 	ldr	r10, _dynsym_start_ofs	/* r10 <- sym table ofs */
 	add	r10, r10, r0		/* r10 <- sym table in FLASH */
 	ldr	r2, _rel_dyn_start_ofs	/* r2 <- rel dyn start ofs */
@@ -237,10 +236,10 @@ fixloop:
 	ldr	r0, [r2]		/* r0 <- location to fix up, IN FLASH! */
 	add	r0, r0, r9		/* r0 <- location to fix up in RAM */
 	ldr	r1, [r2, #4]
-	and	r8, r1, #0xff
-	cmp	r8, #23			/* relative fixup? */
+	and	r7, r1, #0xff
+	cmp	r7, #23			/* relative fixup? */
 	beq	fixrel
-	cmp	r8, #2			/* absolute fixup? */
+	cmp	r7, #2			/* absolute fixup? */
 	beq	fixabs
 	/* ignore unknown type of fixup */
 	b	fixnext
@@ -253,10 +252,10 @@ fixabs:
 	b	fixnext
 fixrel:
 	/* relative fix: increase location by offset */
-	ldr	r1, [r0]
-	add	r1, r1, r9
+	ldr	r1, [r0]		/* r1 <- address of symbol */
+	add	r1, r1, r9		/* r1 <- relocated address of symbol */
 fixnext:
-	str	r1, [r0]
+	str	r1, [r0]		/* store back content of r1 */
 	add	r2, r2, #8		/* each rel.dyn entry is 8 bytes */
 	cmp	r2, r3
 	blo	fixloop
@@ -267,7 +266,7 @@ clear_bss:
 	ldr	r0, _bss_start_ofs
 	ldr	r1, _bss_end_ofs
 	ldr	r3, _TEXT_BASE		/* Text base */
-	mov	r4, r7			/* reloc addr */
+	mov	r4, r6			/* reloc addr */
 	add	r0, r0, r4
 	add	r1, r1, r4
 	mov	r2, #0x00000000		/* clear			    */
@@ -295,10 +294,10 @@ _nand_boot_ofs:
 	ldr	r0, _board_init_r_ofs
 	adr	r1, _start
 	add	lr, r0, r1
-	add	lr, lr, r9
+	add	lr, lr, r9	/* position from board_init_r in RAM */
 	/* setup parameters for board_init_r */
 	mov	r0, r5		/* gd_t */
-	mov	r1, r7		/* dest_addr */
+	mov	r1, r6		/* dest_addr */
 	/* jump to it ... */
 	mov	pc, lr
 
-- 
1.7.3.2

  parent reply	other threads:[~2010-11-30  7:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-29 19:58 [U-Boot] Try to fix Board eb_cpux9k2 Jens Scharsig
2010-11-30  7:06 ` [U-Boot] [PATCH RFC 0/3] chenages to arm relocation Andreas Bießmann
2010-11-30  7:06   ` [U-Boot] [PATCH RFC 1/3] arm920t: do not set register useless Andreas Bießmann
2010-11-30  8:07     ` Albert ARIBAUD
2010-11-30  8:28       ` Andreas Bießmann
2010-11-30  9:25         ` Albert ARIBAUD
2010-11-30  7:06   ` Andreas Bießmann [this message]
2010-11-30  8:22     ` [U-Boot] [PATCH RFC 2/3] arm920t: do not use r8 for relocation Albert ARIBAUD
2010-11-30  8:35       ` Andreas Bießmann
2010-11-30  8:58         ` Albert ARIBAUD
2010-11-30  7:06   ` [U-Boot] [PATCH RFC 3/3] arm920t: do not relocate NULL pointer Andreas Bießmann
2010-11-30  8:32     ` Albert ARIBAUD
2010-11-30  8:47       ` Joakim Tjernlund
2010-11-30  8:50         ` Andreas Bießmann
2010-11-30  9:02         ` Albert ARIBAUD
2010-11-30  9:41           ` Joakim Tjernlund
2010-11-30 11:48             ` Andreas Bießmann
2010-11-30 11:56               ` Joakim Tjernlund
2010-11-30  8:37 ` [U-Boot] Try to fix Board eb_cpux9k2 Albert ARIBAUD
2010-12-02 20:27   ` Jens Scharsig
2010-12-02 20:49     ` Albert ARIBAUD
2010-12-01  6:44 ` Albert ARIBAUD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1291100800-61850-3-git-send-email-andreas.devel@googlemail.com \
    --to=andreas.devel@googlemail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox