Subject: Re: copystr
To: None <firstname.lastname@example.org>
From: David Laight <email@example.com>
Date: 09/03/2002 14:54:50
> This isn't true on all architectures. On NetBSD/arm, for instance, memcpy()
> and memmove() are identical (from sys/lib/libkern/arch/arm/memcpy.S):
> Perhaps this should be changed. If nothing else, the ENTRY_NP should come
It is useful to have a copy that will be don in a 'generally forward'
direction regardless of the addresses.
There is also a bug in the first 2 instructions!
/* Determine copy direction */
cmp r1, r0
moveq r0, #0 /* Quick abort for len=0 */
moveqs pc, lr
moveq pc, lr
Surely the 'moveq r0,#0' should be 'cmpne r2,#0' ?
At the moment the return value of memcpy(x,x,n) is 0 instead of x.
I almost wonder if the 'zero length' optimisation is worth
the 2 instructions in the 'normal' path.
Certainly the src == dest optimisation is doubtful?
David Laight: firstname.lastname@example.org