2000-11-30 09:57:27 +08:00
|
|
|
#if defined __thumb__
|
|
|
|
|
|
|
|
#include "../../string/memmove.c"
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include "xscale.h"
|
|
|
|
|
|
|
|
static inline void *
|
|
|
|
do_memcpy (void *dst0, const void *src0, size_t len)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
void *
|
|
|
|
memmove (void *dst, const void *src, size_t len)
|
|
|
|
{
|
|
|
|
char *d = dst;
|
|
|
|
const char *s = src;
|
|
|
|
|
|
|
|
if (s < d && d < s + len)
|
|
|
|
{
|
|
|
|
/* Destructive overlap...have to copy backwards. */
|
|
|
|
s += len;
|
|
|
|
d += len;
|
|
|
|
|
|
|
|
while (len--)
|
|
|
|
*--d = *--s;
|
|
|
|
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return do_memcpy (dst, src, len);
|
|
|
|
}
|
|
|
|
#endif
|