[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] x86_64 gcc sometimes doesn't have builtin memmove. Always use the



ChangeSet 1.1453, 2005/05/07 11:14:55+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        x86_64 gcc sometimes doesn't have builtin memmove. Always use the
        version we provide.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 arch/x86/string.c               |   38 +++++++++++++++++++-------------------
 include/asm-x86/x86_64/string.h |    8 ++++----
 2 files changed, 23 insertions(+), 23 deletions(-)


diff -Nru a/xen/arch/x86/string.c b/xen/arch/x86/string.c
--- a/xen/arch/x86/string.c     2005-05-07 07:03:34 -04:00
+++ b/xen/arch/x86/string.c     2005-05-07 07:03:34 -04:00
@@ -8,25 +8,6 @@
 #include <xen/config.h>
 #include <xen/lib.h>
 
-#undef memmove
-void *memmove(void *dest, const void *src, size_t n)
-{
-    int d0, d1, d2;
- 
-    if ( dest < src )
-        return memcpy(dest, src, n);
-
-    __asm__ __volatile__ (
-        "   std         ; "
-        "   rep ; movsb ; "
-        "   cld           "
-        : "=&c" (d0), "=&S" (d1), "=&D" (d2)
-        : "0" (n), "1" (n-1+(const char *)src), "2" (n-1+(char *)dest)
-        : "memory");
-
-    return dest;
-}
-
 #undef memcpy
 void *memcpy(void *dest, const void *src, size_t n)
 {
@@ -60,4 +41,23 @@
         : "memory");
 
     return s;
+}
+
+#undef memmove
+void *memmove(void *dest, const void *src, size_t n)
+{
+    int d0, d1, d2;
+ 
+    if ( dest < src )
+        return memcpy(dest, src, n);
+
+    __asm__ __volatile__ (
+        "   std         ; "
+        "   rep ; movsb ; "
+        "   cld           "
+        : "=&c" (d0), "=&S" (d1), "=&D" (d2)
+        : "0" (n), "1" (n-1+(const char *)src), "2" (n-1+(char *)dest)
+        : "memory");
+
+    return dest;
 }
diff -Nru a/xen/include/asm-x86/x86_64/string.h 
b/xen/include/asm-x86/x86_64/string.h
--- a/xen/include/asm-x86/x86_64/string.h       2005-05-07 07:03:34 -04:00
+++ b/xen/include/asm-x86/x86_64/string.h       2005-05-07 07:03:34 -04:00
@@ -1,10 +1,6 @@
 #ifndef _X86_64_STRING_H_
 #define _X86_64_STRING_H_
 
-#define __HAVE_ARCH_MEMMOVE
-#define memmove(dest,src,n) (__memmove((dest),(src),(n)))
-#define __memmove(dest,src,n) (__builtin_memmove((dest),(src),(n)))
-
 #define __HAVE_ARCH_MEMCPY
 #define memcpy(t,f,n) (__memcpy((t),(f),(n)))
 #define __memcpy(t,f,n) (__builtin_memcpy((t),(f),(n)))
@@ -12,5 +8,9 @@
 #define __HAVE_ARCH_MEMSET
 #define memset(s, c, count) (__memset((s),(c),(count)))
 #define __memset(s, c, count) (__builtin_memset((s),(c),(count)))
+
+/* Some versions of 64-bit gcc don't have this built in. */
+#define __HAVE_ARCH_MEMMOVE
+extern void *memmove(void *dest, const void *src, size_t n);
 
 #endif

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.