From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Matthias_Wei=DFer?= Date: Tue, 26 Jul 2011 08:02:28 +0200 Subject: [U-Boot] [PATCH] arm: lib: memcpy: Do not copy to same address In-Reply-To: <4DDA2D96.8030308@aribaud.net> References: <1306141610-24117-1-git-send-email-weisserm@arcor.de> <4DDA292C.2040602@ahsoftware.de> <4DDA2D96.8030308@aribaud.net> Message-ID: <4E2E5874.1040209@arcor.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Albert Am 23.05.2011 11:49, schrieb Albert ARIBAUD: > 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 >>> --- >>> 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. Can this patch go in or do I need to change anything? I really would like to see it in mainline. Regards, Matthias