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

[Xen-changelog] Fix memset/memcmp/memmove declaration/definition.



ChangeSet 1.1342, 2005/04/20 15:29:18+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Fix memset/memcmp/memmove declaration/definition.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 arch/x86/string.c               |   27 +++++++++++++++++++++++++++
 include/asm-x86/x86_32/string.h |   21 ++++++++++++---------
 include/asm-x86/x86_64/string.h |   12 +++++++++++-
 3 files changed, 50 insertions(+), 10 deletions(-)


diff -Nru a/xen/arch/x86/string.c b/xen/arch/x86/string.c
--- /dev/null   Wed Dec 31 16:00:00 196900
+++ b/xen/arch/x86/string.c     2005-04-20 11:02:48 -04:00
@@ -0,0 +1,27 @@
+/******************************************************************************
+ * string.c
+ * 
+ * These provide something for compiler-emitted string operations to link
+ * against.
+ */
+
+#include <xen/config.h>
+#include <xen/lib.h>
+
+#undef memmove
+void *memmove(void *dest, const void *src, size_t count)
+{
+    return __memmove(dest, src, count);
+}
+
+#undef memcpy
+void *memcpy(void *dest, const void *src, size_t count)
+{
+    return __memcpy(dest, src, count);
+}
+
+#undef memset
+void *memset(void *s, int c, size_t count)
+{
+    return __memset(s, c, count);
+}
diff -Nru a/xen/include/asm-x86/x86_32/string.h 
b/xen/include/asm-x86/x86_32/string.h
--- a/xen/include/asm-x86/x86_32/string.h       2005-04-20 11:02:48 -04:00
+++ b/xen/include/asm-x86/x86_32/string.h       2005-04-20 11:02:48 -04:00
@@ -184,7 +184,7 @@
 return __res;
 }
 
-static inline void * __memcpy(void * to, const void * from, size_t n)
+static inline void * __variable_memcpy(void * to, const void * from, size_t n)
 {
 int d0, d1, d2;
 __asm__ __volatile__(
@@ -272,12 +272,13 @@
 }
 
 #define __HAVE_ARCH_MEMCPY
-static always_inline __attribute_used__
-void memcpy(void *t, const void *f, size_t n)
+#define memcpy(t,f,n) (__memcpy((t),(f),(n)))
+static always_inline
+void *__memcpy(void *t, const void *f, size_t n)
 {
-       (__builtin_constant_p(n) ?
+       return (__builtin_constant_p(n) ?
         __constant_memcpy((t),(f),(n)) :
-        __memcpy((t),(f),(n)));
+        __variable_memcpy((t),(f),(n)));
 }
 
 /*
@@ -299,7 +300,8 @@
 */
 
 #define __HAVE_ARCH_MEMMOVE
-static inline void * memmove(void * dest,const void * src, size_t n)
+#define memmove(dest,src,n) (__memmove((dest),(src),(n)))
+static inline void *__memmove(void * dest,const void * src, size_t n)
 {
 int d0, d1, d2;
 if (dest<src)
@@ -455,16 +457,17 @@
  __constant_c_and_count_memset((s),(c),(count)) : \
  __constant_c_memset((s),(c),(count)))
 
-#define __memset(s, c, count) \
+#define __var_x_memset(s, c, count) \
 (__builtin_constant_p(count) ? \
  __constant_count_memset((s),(c),(count)) : \
  __memset_generic((s),(c),(count)))
 
 #define __HAVE_ARCH_MEMSET
-#define memset(s, c, count) \
+#define memset(s, c, count) (__memset((s),(c),(count)))
+#define __memset(s, c, count) \
 (__builtin_constant_p(c) ? \
  __constant_c_x_memset((s),(0x01010101UL*(unsigned char)(c)),(count)) : \
- __memset((s),(c),(count)))
+ __var_x_memset((s),(c),(count)))
 
 /*
  * find the first occurrence of byte 'c', or 1 past the area if none
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-04-20 11:02:48 -04:00
+++ b/xen/include/asm-x86/x86_64/string.h       2005-04-20 11:02:48 -04:00
@@ -1,6 +1,16 @@
 #ifndef _X86_64_STRING_H_
 #define _X86_64_STRING_H_
 
-/* nothing */
+#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)))
+
+#define __HAVE_ARCH_MEMSET
+#define memset(s, c, count) (__memset((s),(c),(count)))
+#define __memset(s, c, count) (__builtin_memset((s),(c),(count)))
 
 #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®.