aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/boot/compressed/misc.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 8f7bef8e9fff..23f315c9f215 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -229,18 +229,35 @@ void *memset(void *s, int c, size_t n)
229 ss[i] = c; 229 ss[i] = c;
230 return s; 230 return s;
231} 231}
232 232#ifdef CONFIG_X86_32
233void *memcpy(void *dest, const void *src, size_t n) 233void *memcpy(void *dest, const void *src, size_t n)
234{ 234{
235 int i; 235 int d0, d1, d2;
236 const char *s = src; 236 asm volatile(
237 char *d = dest; 237 "rep ; movsl\n\t"
238 "movl %4,%%ecx\n\t"
239 "rep ; movsb\n\t"
240 : "=&c" (d0), "=&D" (d1), "=&S" (d2)
241 : "0" (n >> 2), "g" (n & 3), "1" (dest), "2" (src)
242 : "memory");
238 243
239 for (i = 0; i < n; i++)
240 d[i] = s[i];
241 return dest; 244 return dest;
242} 245}
246#else
247void *memcpy(void *dest, const void *src, size_t n)
248{
249 long d0, d1, d2;
250 asm volatile(
251 "rep ; movsq\n\t"
252 "movq %4,%%rcx\n\t"
253 "rep ; movsb\n\t"
254 : "=&c" (d0), "=&D" (d1), "=&S" (d2)
255 : "0" (n >> 3), "g" (n & 7), "1" (dest), "2" (src)
256 : "memory");
243 257
258 return dest;
259}
260#endif
244 261
245static void error(char *x) 262static void error(char *x)
246{ 263{