From: Thomas Gleixner Date: Thu, 11 Oct 2007 09:13:26 +0000 (+0200) Subject: i386: prepare shared lib/memcpy.c X-Git-Tag: firefly_0821_release~26254 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1bbad2b6f10e1f1a171edae545ea2f84dca8c2da;p=firefly-linux-kernel-4.4.55.git i386: prepare shared lib/memcpy.c Signed-off-by: Thomas Gleixner Signed-off-by: Ingo Molnar --- diff --git a/arch/i386/lib/Makefile b/arch/i386/lib/Makefile index dce510d443aa..af7f9435d203 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 8ac51b82a632..000000000000 --- 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 000000000000..8ac51b82a632 --- /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);