[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / arch / m68k / lib / memcpy.c
blob73e181823d9b4ec371b1fa4bb775f3776b107dd3
1 #include <linux/types.h>
3 void * memcpy(void * to, const void * from, size_t n)
5 void *xto = to;
6 size_t temp, temp1;
8 if (!n)
9 return xto;
10 if ((long) to & 1)
12 char *cto = to;
13 const char *cfrom = from;
14 *cto++ = *cfrom++;
15 to = cto;
16 from = cfrom;
17 n--;
19 if (n > 2 && (long) to & 2)
21 short *sto = to;
22 const short *sfrom = from;
23 *sto++ = *sfrom++;
24 to = sto;
25 from = sfrom;
26 n -= 2;
28 temp = n >> 2;
29 if (temp)
31 long *lto = to;
32 const long *lfrom = from;
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)
57 to = lto;
58 from = lfrom;
60 if (n & 2)
62 short *sto = to;
63 const short *sfrom = from;
64 *sto++ = *sfrom++;
65 to = sto;
66 from = sfrom;
68 if (n & 1)
70 char *cto = to;
71 const char *cfrom = from;
72 *cto = *cfrom;
74 return xto;