Linux 4.6-rc6
[linux/fpc-iii.git] / arch / x86 / boot / compressed / string.c
blob00e788be1db943360830701be69fdcbf41294b49
1 #include "../string.c"
3 #ifdef CONFIG_X86_32
4 void *memcpy(void *dest, const void *src, size_t n)
6 int d0, d1, d2;
7 asm volatile(
8 "rep ; movsl\n\t"
9 "movl %4,%%ecx\n\t"
10 "rep ; movsb\n\t"
11 : "=&c" (d0), "=&D" (d1), "=&S" (d2)
12 : "0" (n >> 2), "g" (n & 3), "1" (dest), "2" (src)
13 : "memory");
15 return dest;
17 #else
18 void *memcpy(void *dest, const void *src, size_t n)
20 long d0, d1, d2;
21 asm volatile(
22 "rep ; movsq\n\t"
23 "movq %4,%%rcx\n\t"
24 "rep ; movsb\n\t"
25 : "=&c" (d0), "=&D" (d1), "=&S" (d2)
26 : "0" (n >> 3), "g" (n & 7), "1" (dest), "2" (src)
27 : "memory");
29 return dest;
31 #endif
33 void *memset(void *s, int c, size_t n)
35 int i;
36 char *ss = s;
38 for (i = 0; i < n; i++)
39 ss[i] = c;
40 return s;