public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm: lib: memcpy: Do not copy to same address
Date: Mon, 23 May 2011 11:49:10 +0200	[thread overview]
Message-ID: <4DDA2D96.8030308@aribaud.net> (raw)
In-Reply-To: <4DDA292C.2040602@ahsoftware.de>

Le 23/05/2011 11:30, Alexander Holler a ?crit :
> Am 23.05.2011 11:06, schrieb Matthias Weisser:
>> In some cases (e.g. bootm with a elf payload which is already at the right
>> position) there is a in place copy of data to the same address. Catching this
>> saves some ms while booting.
>>
>> Signed-off-by: Matthias Weisser<weisserm@arcor.de>
>> ---
>>    arch/arm/lib/memcpy.S |    3 +++
>>    1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/lib/memcpy.S b/arch/arm/lib/memcpy.S
>> index 3b5aeec..f655256 100644
>> --- a/arch/arm/lib/memcpy.S
>> +++ b/arch/arm/lib/memcpy.S
>> @@ -60,6 +60,9 @@
>>    .globl memcpy
>>    memcpy:
>>
>> +		cmp	r0, r1
>> +		moveq	pc, lr
>> +
>>    		enter	r4, lr
>>
>>    		subs	r2, r2, #4
>
> The standard clearly say to both memory regions should not overlap when
> memcpy() is used, so I would say this is the wrong place to fix that.

I think the intent here is not to enforce the standard but to handle an 
actual, and degenerate, copy request in the most efficient manner, and 
in that respect, the patch does its job.

Besides, if the patch was about enforcing the standard, then I would 
consider it highly more efficient to check the areas once in the memcpy 
function than duplicating this check before each call to the function, 
considering that the place where the copy happens is not necessarily the 
one where the source and destination were computed.

> Regards,
>
> Alexander

Amicalement,
-- 
Albert.

  parent reply	other threads:[~2011-05-23  9:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23  9:06 [U-Boot] [PATCH] arm: lib: memcpy: Do not copy to same address Matthias Weisser
2011-05-23  9:30 ` Alexander Holler
2011-05-23  9:46   ` Matthias Weißer
2011-05-23  9:51     ` Alexander Holler
2011-05-23  9:49   ` Albert ARIBAUD [this message]
2011-05-23 10:01     ` Alexander Holler
2011-07-26  6:02     ` Matthias Weißer
2011-08-12  8:49 ` 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=4DDA2D96.8030308@aribaud.net \
    --to=albert.u.boot@aribaud.net \
    --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