From: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/5] arm: optimize relocate_code routine
Date: Wed, 15 May 2013 01:54:11 +0200 (CEST) [thread overview]
Message-ID: <1587859382.823429.1368575651827.JavaMail.root@advansee.com> (raw)
In-Reply-To: <1368561780-19104-6-git-send-email-albert.u.boot@aribaud.net>
Hi Albert,
On Tuesday, May 14, 2013 10:03:00 PM, Albert ARIBAUD wrote:
> Use section symbols directly
> Drop support for R_ARM_ABS32 record types
> Eliminate unneeded intermediate registers
> Optimize relocation table iteration
>
> Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
> ---
> arch/arm/lib/relocate.S | 45 +++++++++++++++------------------------------
> 1 file changed, 15 insertions(+), 30 deletions(-)
>
> diff --git a/arch/arm/lib/relocate.S b/arch/arm/lib/relocate.S
> index 818735c..75ee3b4 100644
> --- a/arch/arm/lib/relocate.S
> +++ b/arch/arm/lib/relocate.S
> @@ -37,51 +37,36 @@
> * This function relocates the monitor code.
> */
> ENTRY(relocate_code)
> - mov r6, r0 /* save addr of destination */
>
> - ldr r0, =__image_copy_start /* r0 <- source start address */
> - subs r9, r6, r0 /* r9 <- relocation offset */
> + ldr r1, =__image_copy_start /* r1 <- source start address */
> + subs r9, r0, r1 /* r9 <- relocation offset */
> beq relocate_done /* skip relocation */
> - mov r1, r6 /* r1 <- scratch for copy loop */
> ldr r2, =__image_copy_end /* r2 <- source end address */
>
> copy_loop:
> - ldmia r0!, {r10-r11} /* copy from source address [r0] */
> - stmia r1!, {r10-r11} /* copy to target address [r1] */
> - cmp r0, r2 /* until source end address [r2] */
> + ldmia r1!, {r10-r11} /* copy from source address [r1] */
> + stmia r0!, {r10-r11} /* copy to target address [r0] */
> + cmp r1, r2 /* until source end address [r2] */
> blo copy_loop
>
> /*
> * fix .rel.dyn relocations
> */
> - ldr r10, =__dynsym_start /* r10 <- sym table ofs */
> ldr r2, =__rel_dyn_start /* r2 <- rel dyn start ofs */
> ldr r3, =__rel_dyn_end /* r3 <- rel dyn end ofs */
> fixloop:
> - ldr r0, [r2] /* r0 <- SRC location to fix up */
> - add r0, r0, r9 /* r0 <- DST location to fix up */
> - ldr r1, [r2, #4]
> - and r7, r1, #0xff
> - cmp r7, #23 /* relative fixup? */
> - beq fixrel
> - cmp r7, #2 /* absolute fixup? */
> - beq fixabs
> - /* ignore unknown type of fixup */
> - b fixnext
> -fixabs:
> - /* absolute fix: set location to (offset) symbol value */
> - mov r1, r1, LSR #4 /* r1 <- symbol index in .dynsym */
> - add r1, r10, r1 /* r1 <- address of symbol in table */
> - ldr r1, [r1, #4] /* r1 <- symbol value */
> - add r1, r1, r9 /* r1 <- relocated sym addr */
> - b fixnext
> -fixrel:
> + ldmia r2!, {r0-r1} /* (r0,r1) <- (SRC location,fixup) */
> + and r1, r1, #0xff /* r1 <- fixup type */
> + cmp r1, #23 /* relative fixup? */
> + bne fixnext
> +
> /* relative fix: increase location by offset */
> - ldr r1, [r0]
> - add r1, r1, r9
> + add r0, r0, r9 /* r0 <- DST location to fix up */
> + ldr r1, [r0] /* r1 <- content to fix up */
> + add r1, r1, r9 /* fix up */
> + str r1, [r0] /* write back fixed-up content */
> +
> fixnext:
> - str r1, [r0]
> - add r2, r2, #8 /* each rel.dyn entry is 8 bytes */
> cmp r2, r3
> blo fixloop
The final state of relocate.S is correct in this series, but it is not correct
at the end of "[PATCH v2 4/4] arm: factorize relocate_code routine" as I pointed
out in the part of my review that you cut in your first reply.
Best regards,
Beno?t
next prev parent reply other threads:[~2013-05-14 23:54 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-14 20:02 [U-Boot] [PATCH 0/5] Optimize ARM relocation Albert ARIBAUD
2013-05-14 20:02 ` [U-Boot] [PATCH 1/5] arm: generalize lib/bss.c into lib/sections.c Albert ARIBAUD
2013-05-14 20:02 ` [U-Boot] [PATCH 2/5] arm: make __image_copy_{start, end} compiler-generated Albert ARIBAUD
2013-05-14 20:02 ` [U-Boot] [PATCH 3/5] arm: make relocation symbols compiler-generated Albert ARIBAUD
2013-05-14 20:02 ` [U-Boot] [PATCH 4/5] arm: ensure u-boot only uses relative relocations Albert ARIBAUD
2013-05-14 20:03 ` [U-Boot] [PATCH 5/5] arm: optimize relocate_code routine Albert ARIBAUD
2013-05-14 23:54 ` Benoît Thébaudeau [this message]
2013-05-15 7:32 ` Albert ARIBAUD
2013-05-14 22:12 ` [U-Boot] [PATCH 4/5] arm: ensure u-boot only uses relative relocations Benoît Thébaudeau
2013-05-15 7:46 ` Albert ARIBAUD
2013-05-15 9:38 ` Albert ARIBAUD
2013-05-15 13:49 ` Benoît Thébaudeau
2013-05-15 15:01 ` Albert ARIBAUD
2013-05-14 22:09 ` [U-Boot] [PATCH 3/5] arm: make relocation symbols compiler-generated Benoît Thébaudeau
2013-05-15 6:39 ` Albert ARIBAUD
2013-05-15 6:41 ` Albert ARIBAUD
2013-05-14 20:16 ` [U-Boot] [PATCH 0/5] Optimize ARM relocation Albert ARIBAUD
2013-05-14 23:58 ` Benoît Thébaudeau
2013-05-15 7:49 ` Albert ARIBAUD
2013-05-28 7:01 ` [U-Boot] [PATCH v2 0/6] " Albert ARIBAUD
2013-05-28 7:01 ` [U-Boot] [PATCH v2 1/6] arm: ensure u-boot only uses relative relocations Albert ARIBAUD
2013-05-28 7:01 ` [U-Boot] [PATCH v2 2/6] remove all references to .dynsym Albert ARIBAUD
2013-05-28 7:01 ` [U-Boot] [PATCH v2 3/6] arm: generalize lib/bss.c into lib/sections.c Albert ARIBAUD
2013-05-28 7:01 ` [U-Boot] [PATCH v2 4/6] arm: make __image_copy_{start, end} compiler-generated Albert ARIBAUD
2013-05-28 7:01 ` [U-Boot] [PATCH v2 5/6] arm: make __rel_dyn_{start, " Albert ARIBAUD
2013-05-28 7:01 ` [U-Boot] [PATCH v2 6/6] arm: optimize relocate_code routine Albert ARIBAUD
2013-05-28 17:11 ` [U-Boot] [PATCH v2 4/6] arm: make __image_copy_{start, end} compiler-generated Benoît Thébaudeau
2013-05-28 17:04 ` [U-Boot] [PATCH v2 1/6] arm: ensure u-boot only uses relative relocations Benoît Thébaudeau
2013-05-28 17:31 ` Albert ARIBAUD
2013-06-11 12:17 ` [U-Boot] [PATCH v3 0/6] Optimize ARM relocation Albert ARIBAUD
2013-06-11 12:17 ` [U-Boot] [PATCH v3 1/6] arm: ensure u-boot only uses relative relocations Albert ARIBAUD
2013-06-11 12:17 ` [U-Boot] [PATCH v3 2/6] remove all references to .dynsym Albert ARIBAUD
2013-06-11 12:17 ` [U-Boot] [PATCH v3 3/6] arm: generalize lib/bss.c into lib/sections.c Albert ARIBAUD
2013-06-11 12:17 ` [U-Boot] [PATCH v3 4/6] arm: make __image_copy_{start, end} compiler-generated Albert ARIBAUD
2013-06-11 12:17 ` [U-Boot] [PATCH v3 5/6] arm: make __rel_dyn_{start, " Albert ARIBAUD
2013-06-11 12:17 ` [U-Boot] [PATCH v3 6/6] arm: optimize relocate_code routine Albert ARIBAUD
2013-06-11 12:47 ` [U-Boot] [PATCH v3 0/6] Optimize ARM relocation Albert ARIBAUD
2013-06-11 14:22 ` Lubomir Popov
2013-06-11 15:29 ` Albert ARIBAUD
2013-06-13 9:05 ` Albert ARIBAUD
2013-06-13 18:54 ` Jeroen Hofstee
2013-06-16 13:33 ` Jeroen Hofstee
2013-06-18 14:54 ` Albert ARIBAUD
2013-06-19 7:31 ` [U-Boot] [LONG] " Albert ARIBAUD
2013-06-12 22:38 ` [U-Boot] " Benoît Thébaudeau
2013-06-21 21:07 ` 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=1587859382.823429.1368575651827.JavaMail.root@advansee.com \
--to=benoit.thebaudeau@advansee.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.