memcpy.c (1da177e4c3f41524e886b7f1b8a0c1fc7321cac2) memcpy.c (66d857b08b8c3ed5c72c361f863cce77d2a978d7)
1
1#include <linux/types.h>
2
3void * memcpy(void * to, const void * from, size_t n)
4{
2#include <linux/types.h>
3
4void * memcpy(void * to, const void * from, size_t n)
5{
6#ifdef CONFIG_COLDFIRE
5 void *xto = to;
7 void *xto = to;
6 size_t temp, temp1;
8 size_t temp;
7
8 if (!n)
9 return xto;
10 if ((long) to & 1)
11 {
12 char *cto = to;
13 const char *cfrom = from;
14 *cto++ = *cfrom++;

--- 10 unchanged lines hidden (view full) ---

25 from = sfrom;
26 n -= 2;
27 }
28 temp = n >> 2;
29 if (temp)
30 {
31 long *lto = to;
32 const long *lfrom = from;
9
10 if (!n)
11 return xto;
12 if ((long) to & 1)
13 {
14 char *cto = to;
15 const char *cfrom = from;
16 *cto++ = *cfrom++;

--- 10 unchanged lines hidden (view full) ---

27 from = sfrom;
28 n -= 2;
29 }
30 temp = n >> 2;
31 if (temp)
32 {
33 long *lto = to;
34 const long *lfrom = from;
33
34 __asm__ __volatile__("movel %2,%3\n\t"
35 "andw #7,%3\n\t"
36 "lsrl #3,%2\n\t"
37 "negw %3\n\t"
38 "jmp %%pc@(1f,%3:w:2)\n\t"
39 "4:\t"
40 "movel %0@+,%1@+\n\t"
41 "movel %0@+,%1@+\n\t"
42 "movel %0@+,%1@+\n\t"
43 "movel %0@+,%1@+\n\t"
44 "movel %0@+,%1@+\n\t"
45 "movel %0@+,%1@+\n\t"
46 "movel %0@+,%1@+\n\t"
47 "movel %0@+,%1@+\n\t"
48 "1:\t"
49 "dbra %2,4b\n\t"
50 "clrw %2\n\t"
51 "subql #1,%2\n\t"
52 "jpl 4b\n\t"
53 : "=a" (lfrom), "=a" (lto), "=d" (temp),
54 "=&d" (temp1)
55 : "0" (lfrom), "1" (lto), "2" (temp)
56 );
35 for (; temp; temp--)
36 *lto++ = *lfrom++;
57 to = lto;
58 from = lfrom;
59 }
60 if (n & 2)
61 {
62 short *sto = to;
63 const short *sfrom = from;
64 *sto++ = *sfrom++;
65 to = sto;
66 from = sfrom;
67 }
68 if (n & 1)
69 {
70 char *cto = to;
71 const char *cfrom = from;
72 *cto = *cfrom;
73 }
74 return xto;
37 to = lto;
38 from = lfrom;
39 }
40 if (n & 2)
41 {
42 short *sto = to;
43 const short *sfrom = from;
44 *sto++ = *sfrom++;
45 to = sto;
46 from = sfrom;
47 }
48 if (n & 1)
49 {
50 char *cto = to;
51 const char *cfrom = from;
52 *cto = *cfrom;
53 }
54 return xto;
55#else
56 const char *c_from = from;
57 char *c_to = to;
58 while (n-- > 0)
59 *c_to++ = *c_from++;
60 return((void *) to);
61#endif
75}
62}