]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - arch/x86/boot/compressed/misc.c
Merge tag 'v2.6.37' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / arch / x86 / boot / compressed / misc.c
index 8f7bef8e9fff530318e64cef59702d740323d545..325c05294fc40dfc662a52187eba92516e568e94 100644 (file)
@@ -229,18 +229,35 @@ void *memset(void *s, int c, size_t n)
                ss[i] = c;
        return s;
 }
-
+#ifdef CONFIG_X86_32
 void *memcpy(void *dest, const void *src, size_t n)
 {
-       int i;
-       const char *s = src;
-       char *d = dest;
+       int d0, d1, d2;
+       asm volatile(
+               "rep ; movsl\n\t"
+               "movl %4,%%ecx\n\t"
+               "rep ; movsb\n\t"
+               : "=&c" (d0), "=&D" (d1), "=&S" (d2)
+               : "0" (n >> 2), "g" (n & 3), "1" (dest), "2" (src)
+               : "memory");
 
-       for (i = 0; i < n; i++)
-               d[i] = s[i];
        return dest;
 }
+#else
+void *memcpy(void *dest, const void *src, size_t n)
+{
+       long d0, d1, d2;
+       asm volatile(
+               "rep ; movsq\n\t"
+               "movq %4,%%rcx\n\t"
+               "rep ; movsb\n\t"
+               : "=&c" (d0), "=&D" (d1), "=&S" (d2)
+               : "0" (n >> 3), "g" (n & 7), "1" (dest), "2" (src)
+               : "memory");
 
+       return dest;
+}
+#endif
 
 static void error(char *x)
 {
@@ -338,7 +355,7 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
        if (heap > 0x3fffffffffffUL)
                error("Destination address too large");
 #else
-       if (heap > ((-__PAGE_OFFSET-(512<<20)-1) & 0x7fffffff))
+       if (heap > ((-__PAGE_OFFSET-(128<<20)-1) & 0x7fffffff))
                error("Destination address too large");
 #endif
 #ifndef CONFIG_RELOCATABLE