ia64/xen-unstable

changeset 4792:3a473cbbb826

bitkeeper revision 1.1389.5.30 (427c951f6ULpkuxG36TskUioGnRY9w)

x86_64 gcc sometimes doesn't have builtin memmove. Always use the
version we provide.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Sat May 07 10:14:55 2005 +0000 (2005-05-07)
parents c2364cd47a54
children 9d59e65e132c
files xen/arch/x86/string.c xen/include/asm-x86/x86_64/string.h
line diff
     1.1 --- a/xen/arch/x86/string.c	Sat May 07 10:01:24 2005 +0000
     1.2 +++ b/xen/arch/x86/string.c	Sat May 07 10:14:55 2005 +0000
     1.3 @@ -8,25 +8,6 @@
     1.4  #include <xen/config.h>
     1.5  #include <xen/lib.h>
     1.6  
     1.7 -#undef memmove
     1.8 -void *memmove(void *dest, const void *src, size_t n)
     1.9 -{
    1.10 -    int d0, d1, d2;
    1.11 - 
    1.12 -    if ( dest < src )
    1.13 -        return memcpy(dest, src, n);
    1.14 -
    1.15 -    __asm__ __volatile__ (
    1.16 -        "   std         ; "
    1.17 -        "   rep ; movsb ; "
    1.18 -        "   cld           "
    1.19 -        : "=&c" (d0), "=&S" (d1), "=&D" (d2)
    1.20 -        : "0" (n), "1" (n-1+(const char *)src), "2" (n-1+(char *)dest)
    1.21 -        : "memory");
    1.22 -
    1.23 -    return dest;
    1.24 -}
    1.25 -
    1.26  #undef memcpy
    1.27  void *memcpy(void *dest, const void *src, size_t n)
    1.28  {
    1.29 @@ -61,3 +42,22 @@ void *memset(void *s, int c, size_t n)
    1.30  
    1.31      return s;
    1.32  }
    1.33 +
    1.34 +#undef memmove
    1.35 +void *memmove(void *dest, const void *src, size_t n)
    1.36 +{
    1.37 +    int d0, d1, d2;
    1.38 + 
    1.39 +    if ( dest < src )
    1.40 +        return memcpy(dest, src, n);
    1.41 +
    1.42 +    __asm__ __volatile__ (
    1.43 +        "   std         ; "
    1.44 +        "   rep ; movsb ; "
    1.45 +        "   cld           "
    1.46 +        : "=&c" (d0), "=&S" (d1), "=&D" (d2)
    1.47 +        : "0" (n), "1" (n-1+(const char *)src), "2" (n-1+(char *)dest)
    1.48 +        : "memory");
    1.49 +
    1.50 +    return dest;
    1.51 +}
     2.1 --- a/xen/include/asm-x86/x86_64/string.h	Sat May 07 10:01:24 2005 +0000
     2.2 +++ b/xen/include/asm-x86/x86_64/string.h	Sat May 07 10:14:55 2005 +0000
     2.3 @@ -1,10 +1,6 @@
     2.4  #ifndef _X86_64_STRING_H_
     2.5  #define _X86_64_STRING_H_
     2.6  
     2.7 -#define __HAVE_ARCH_MEMMOVE
     2.8 -#define memmove(dest,src,n) (__memmove((dest),(src),(n)))
     2.9 -#define __memmove(dest,src,n) (__builtin_memmove((dest),(src),(n)))
    2.10 -
    2.11  #define __HAVE_ARCH_MEMCPY
    2.12  #define memcpy(t,f,n) (__memcpy((t),(f),(n)))
    2.13  #define __memcpy(t,f,n) (__builtin_memcpy((t),(f),(n)))
    2.14 @@ -13,4 +9,8 @@
    2.15  #define memset(s, c, count) (__memset((s),(c),(count)))
    2.16  #define __memset(s, c, count) (__builtin_memset((s),(c),(count)))
    2.17  
    2.18 +/* Some versions of 64-bit gcc don't have this built in. */
    2.19 +#define __HAVE_ARCH_MEMMOVE
    2.20 +extern void *memmove(void *dest, const void *src, size_t n);
    2.21 +
    2.22  #endif