diff options
Diffstat (limited to 'arch/x86/boot/compressed/string.c')
-rw-r--r-- | arch/x86/boot/compressed/string.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/x86/boot/compressed/string.c b/arch/x86/boot/compressed/string.c index 212004ec787d..3b5a82fc6ad7 100644 --- a/arch/x86/boot/compressed/string.c +++ b/arch/x86/boot/compressed/string.c | |||
@@ -11,3 +11,36 @@ int memcmp(const void *s1, const void *s2, size_t len) | |||
11 | } | 11 | } |
12 | 12 | ||
13 | #include "../string.c" | 13 | #include "../string.c" |
14 | |||
15 | /* misc.h might pull in string_32.h which has a macro for memcpy. undef that */ | ||
16 | #undef memcpy | ||
17 | |||
18 | #ifdef CONFIG_X86_32 | ||
19 | void *memcpy(void *dest, const void *src, size_t n) | ||
20 | { | ||
21 | int d0, d1, d2; | ||
22 | asm volatile( | ||
23 | "rep ; movsl\n\t" | ||
24 | "movl %4,%%ecx\n\t" | ||
25 | "rep ; movsb\n\t" | ||
26 | : "=&c" (d0), "=&D" (d1), "=&S" (d2) | ||
27 | : "0" (n >> 2), "g" (n & 3), "1" (dest), "2" (src) | ||
28 | : "memory"); | ||
29 | |||
30 | return dest; | ||
31 | } | ||
32 | #else | ||
33 | void *memcpy(void *dest, const void *src, size_t n) | ||
34 | { | ||
35 | long d0, d1, d2; | ||
36 | asm volatile( | ||
37 | "rep ; movsq\n\t" | ||
38 | "movq %4,%%rcx\n\t" | ||
39 | "rep ; movsb\n\t" | ||
40 | : "=&c" (d0), "=&D" (d1), "=&S" (d2) | ||
41 | : "0" (n >> 3), "g" (n & 7), "1" (dest), "2" (src) | ||
42 | : "memory"); | ||
43 | |||
44 | return dest; | ||
45 | } | ||
46 | #endif | ||