2000-11-30 09:57:27 +08:00
|
|
|
#if defined __thumb__
|
|
|
|
|
|
|
|
#include "../../string/memcpy.c"
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include "xscale.h"
|
|
|
|
|
|
|
|
void *
|
* libc/sys/linux/include/netdb.h, libc/sys/linux/net/getaddrinfo.c,
libc/sys/linux/net/getnameinfo.c: Add restrict keyword to getnameinfo()
and getaddrinfo() to increase standards compliance and match glibc.
* libc/include/string.h, libc/string/memccpy.c, libc/string/memcpy.c,
libc/string/stpcpy.c, libc/string/stpncpy.c, libc/string/strcat.c,
libc/string/strncat.c, libc/string/strncpy.c, libc/string/strtok.c,
libc/string/strtok_r.c, libc/string/strxfrm.c
libc/machine/microblaze/strcpy.c, libc/machine/xscale/memcpy.c,
libc/machine/cris/memcpy.c: Add __restrict to prototype to
increase standards compliance.
2013-07-23 15:05:31 +08:00
|
|
|
memcpy (void *__restrict dst0, const void *__restrict src0, size_t len)
|
2000-11-30 09:57:27 +08:00
|
|
|
{
|
|
|
|
int dummy;
|
|
|
|
asm volatile (
|
|
|
|
#ifndef __OPTIMIZE_SIZE__
|
2002-04-20 08:29:51 +08:00
|
|
|
"cmp %2, #0x3\n\
|
|
|
|
bls 3f\n\
|
|
|
|
and lr, %1, #0x3\n\
|
|
|
|
and r3, %0, #0x3\n\
|
|
|
|
cmp lr, r3\n\
|
|
|
|
bne 3f\n\
|
|
|
|
cmp lr, #0x0\n\
|
|
|
|
beq 2f\n\
|
|
|
|
b 1f\n\
|
|
|
|
0:\n\
|
|
|
|
ldrb r3, [%1], #1\n\
|
2000-11-30 09:57:27 +08:00
|
|
|
"
|
|
|
|
PRELOADSTR ("%1")
|
2002-04-20 08:29:51 +08:00
|
|
|
"\n\
|
|
|
|
tst %1, #0x3\n\
|
|
|
|
strb r3, [%0], #1\n\
|
|
|
|
beq 3f\n\
|
|
|
|
1:\n\
|
|
|
|
sub %2, %2, #1\n\
|
|
|
|
cmn %2, #1\n\
|
|
|
|
bne 0b\n\
|
|
|
|
2:\n\
|
|
|
|
cmp %2, #0xf\n\
|
|
|
|
bls 1f\n\
|
|
|
|
0:\n\
|
|
|
|
ldmia %1!, { r3, r4, r5, lr }\n\
|
2000-11-30 09:57:27 +08:00
|
|
|
"
|
|
|
|
PRELOADSTR ("%1")
|
2002-04-20 08:29:51 +08:00
|
|
|
"\n\
|
|
|
|
\n\
|
|
|
|
sub %2, %2, #16\n\
|
|
|
|
cmp %2, #0xf\n\
|
|
|
|
stmia %0!, { r3, r4, r5, lr }\n\
|
|
|
|
bhi 0b\n\
|
|
|
|
1:\n\
|
|
|
|
cmp %2, #0x7\n\
|
|
|
|
bls 1f\n\
|
|
|
|
0:\n\
|
|
|
|
ldmia %1!, { r3, r4 }\n\
|
2000-11-30 09:57:27 +08:00
|
|
|
"
|
|
|
|
PRELOADSTR ("%1")
|
2002-04-20 08:29:51 +08:00
|
|
|
"\n\
|
|
|
|
\n\
|
|
|
|
sub %2, %2, #8\n\
|
|
|
|
cmp %2, #0x7\n\
|
|
|
|
stmia %0!, { r3, r4 }\n\
|
|
|
|
bhi 0b\n\
|
|
|
|
1:\n\
|
|
|
|
cmp %2, #0x3\n\
|
|
|
|
bls 3f\n\
|
|
|
|
0:\n\
|
|
|
|
sub %2, %2, #4\n\
|
|
|
|
ldr r3, [%1], #4\n\
|
2000-11-30 09:57:27 +08:00
|
|
|
"
|
|
|
|
PRELOADSTR ("%1")
|
2002-04-20 08:29:51 +08:00
|
|
|
"\n\
|
|
|
|
\n\
|
|
|
|
cmp %2, #0x3\n\
|
|
|
|
str r3, [%0], #4\n\
|
|
|
|
bhi 0b\n\
|
2000-11-30 09:57:27 +08:00
|
|
|
"
|
|
|
|
#endif /* !__OPTIMIZE_SIZE__ */
|
2002-04-20 08:29:51 +08:00
|
|
|
"\n\
|
|
|
|
3:\n\
|
2000-11-30 09:57:27 +08:00
|
|
|
"
|
|
|
|
PRELOADSTR ("%1")
|
2002-04-20 08:29:51 +08:00
|
|
|
"\n\
|
|
|
|
sub %2, %2, #1\n\
|
|
|
|
cmn %2, #1\n\
|
|
|
|
beq 1f\n\
|
|
|
|
0:\n\
|
|
|
|
sub %2, %2, #1\n\
|
|
|
|
ldrb r3, [%1], #1\n\
|
2000-11-30 09:57:27 +08:00
|
|
|
"
|
|
|
|
PRELOADSTR ("%1")
|
2002-04-20 08:29:51 +08:00
|
|
|
"\n\
|
|
|
|
cmn %2, #1\n\
|
|
|
|
strb r3, [%0], #1\n\
|
|
|
|
bne 0b\n\
|
2000-11-30 09:57:27 +08:00
|
|
|
1:"
|
|
|
|
: "=&r" (dummy), "=&r" (src0), "=&r" (len)
|
|
|
|
: "0" (dst0), "1" (src0), "2" (len)
|
|
|
|
: "memory", "lr", "r3", "r4", "r5", "cc");
|
|
|
|
return dst0;
|
|
|
|
}
|
|
|
|
#endif
|