From 1bbad2b6f10e1f1a171edae545ea2f84dca8c2da Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 11 Oct 2007 11:13:26 +0200 Subject: i386: prepare shared lib/memcpy.c Signed-off-by: Thomas Gleixner Signed-off-by: Ingo Molnar --- arch/i386/lib/Makefile | 2 +- arch/i386/lib/memcpy.c | 43 ------------------------------------------- arch/i386/lib/memcpy_32.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 44 deletions(-) delete mode 100644 arch/i386/lib/memcpy.c create mode 100644 arch/i386/lib/memcpy_32.c diff --git a/arch/i386/lib/Makefile b/arch/i386/lib/Makefile index dce510d443a..af7f9435d20 100644 --- a/arch/i386/lib/Makefile +++ b/arch/i386/lib/Makefile @@ -3,7 +3,7 @@ # -lib-y = checksum_32.o delay.o usercopy.o getuser.o putuser.o memcpy.o strstr_32.o \ +lib-y = checksum_32.o delay.o usercopy.o getuser.o putuser.o memcpy_32.o strstr_32.o \ bitops.o semaphore_32.o string_32.o lib-$(CONFIG_X86_USE_3DNOW) += mmx.o diff --git a/arch/i386/lib/memcpy.c b/arch/i386/lib/memcpy.c deleted file mode 100644 index 8ac51b82a63..00000000000 --- a/arch/i386/lib/memcpy.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include - -#undef memcpy -#undef memset - -void *memcpy(void *to, const void *from, size_t n) -{ -#ifdef CONFIG_X86_USE_3DNOW - return __memcpy3d(to, from, n); -#else - return __memcpy(to, from, n); -#endif -} -EXPORT_SYMBOL(memcpy); - -void *memset(void *s, int c, size_t count) -{ - return __memset(s, c, count); -} -EXPORT_SYMBOL(memset); - -void *memmove(void *dest, const void *src, size_t n) -{ - int d0, d1, d2; - - if (dest < src) { - memcpy(dest,src,n); - } else { - __asm__ __volatile__( - "std\n\t" - "rep\n\t" - "movsb\n\t" - "cld" - : "=&c" (d0), "=&S" (d1), "=&D" (d2) - :"0" (n), - "1" (n-1+(const char *)src), - "2" (n-1+(char *)dest) - :"memory"); - } - return dest; -} -EXPORT_SYMBOL(memmove); diff --git a/arch/i386/lib/memcpy_32.c b/arch/i386/lib/memcpy_32.c new file mode 100644 index 00000000000..8ac51b82a63 --- /dev/null +++ b/arch/i386/lib/memcpy_32.c @@ -0,0 +1,43 @@ +#include +#include + +#undef memcpy +#undef memset + +void *memcpy(void *to, const void *from, size_t n) +{ +#ifdef CONFIG_X86_USE_3DNOW + return __memcpy3d(to, from, n); +#else + return __memcpy(to, from, n); +#endif +} +EXPORT_SYMBOL(memcpy); + +void *memset(void *s, int c, size_t count) +{ + return __memset(s, c, count); +} +EXPORT_SYMBOL(memset); + +void *memmove(void *dest, const void *src, size_t n) +{ + int d0, d1, d2; + + if (dest < src) { + memcpy(dest,src,n); + } else { + __asm__ __volatile__( + "std\n\t" + "rep\n\t" + "movsb\n\t" + "cld" + : "=&c" (d0), "=&S" (d1), "=&D" (d2) + :"0" (n), + "1" (n-1+(const char *)src), + "2" (n-1+(char *)dest) + :"memory"); + } + return dest; +} +EXPORT_SYMBOL(memmove); -- cgit v1.2.3