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 1/3] arm920t: do not set register useless
Date: Tue, 30 Nov 2010 09:28:44 +0100	[thread overview]
Message-ID: <4CF4B5BC.1090500@gmail.com> (raw)
In-Reply-To: <4CF4B0A9.6030209@aribaud.net>

Dear Albert ARIBAUD,

Am 30.11.2010 09:07, schrieb Albert ARIBAUD:
> Hi Andreas,
> 
> Le 30/11/2010 08:06, Andreas Bie?mann a ?crit :
> 
>> diff --git a/arch/arm/cpu/arm920t/start.S b/arch/arm/cpu/arm920t/start.S
>> index 01edb9b..71de373 100644
>> --- a/arch/arm/cpu/arm920t/start.S
>> +++ b/arch/arm/cpu/arm920t/start.S
>> @@ -208,15 +208,16 @@ stack_setup:
>>       mov    sp, r4
>>
>>       adr    r0, _start
>> +    cmp    r0, r6
>> +    beq    clear_bss        /* skip relocation */
>> +    mov    r1, r6
> 
> Why use r1?

Use a scratch register here cause stmia Rn! does increment Rn.

> 
>>       ldr    r2, _TEXT_BASE
>>       ldr    r3, _bss_start_ofs
>>       add    r2, r0, r3        /* r2<- source end address        */
>> -    cmp    r0, r6
>> -    beq    clear_bss
>>
>>   copy_loop:
>>       ldmia    r0!, {r9-r10}        /* copy from source address
>> [r0]    */
>> -    stmia    r6!, {r9-r10}        /* copy to   target address [r1]    */
>> +    stmia    r1!, {r9-r10}        /* copy to   target address [r1]    */

Therefore usage of r6 here would destroy the saved 'addr of
destination'. Cause that fact we have saved the 'addr of destination' @
beginning of relocate_code twice, once to r6 and once to r7. This is
obviously not needed iv we change the register in copy_loop (which was
already used in comment .. if you saw that on the end of the line).

I doubt if this a 'speed up' but we can have a cleaner interface. We
have r4, r5, r6 as storage of input values to relocate_code. We do only
use scratch registers for copy_loop, fixloop for relocation, clear_bss
later on. We do decide if we need fixloop for relocation or if we can
skip that and then setup the relevant scratch registers.

Well this is only an RFC. I found that plus the NULL pointer stuff worth
to mention. It is not that important to get this special patch in cause
the current implementation do also work.

regards

Andreas Bie?mann

  reply	other threads:[~2010-11-30  8:28 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 [this message]
2010-11-30  9:25         ` Albert ARIBAUD
2010-11-30  7:06   ` [U-Boot] [PATCH RFC 2/3] arm920t: do not use r8 for relocation Andreas Bießmann
2010-11-30  8:22     ` 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=4CF4B5BC.1090500@gmail.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