Commit ec3c438e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] i386: uninline memmove

Using current gcc CVS I hit a piece of code in which the compiler was emitting
a memmove() call.  The kernel link failed.

Uninline it.

Also, move the memcpy and memset exports into memcpy.c.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d9c43f5e
...@@ -173,14 +173,8 @@ EXPORT_SYMBOL(rtc_lock); ...@@ -173,14 +173,8 @@ EXPORT_SYMBOL(rtc_lock);
EXPORT_SYMBOL_GPL(set_nmi_callback); EXPORT_SYMBOL_GPL(set_nmi_callback);
EXPORT_SYMBOL_GPL(unset_nmi_callback); EXPORT_SYMBOL_GPL(unset_nmi_callback);
#undef memcpy
#undef memset
#undef memcmp #undef memcmp
extern void * memset(void *,int,__kernel_size_t);
extern void * memcpy(void *,const void *,__kernel_size_t);
extern int memcmp(const void *,const void *,__kernel_size_t); extern int memcmp(const void *,const void *,__kernel_size_t);
EXPORT_SYMBOL_NOVERS(memcpy);
EXPORT_SYMBOL_NOVERS(memset);
EXPORT_SYMBOL_NOVERS(memcmp); EXPORT_SYMBOL_NOVERS(memcmp);
#ifdef CONFIG_HAVE_DEC_LOCK #ifdef CONFIG_HAVE_DEC_LOCK
......
#include <linux/config.h> #include <linux/config.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/module.h>
#undef memcpy #undef memcpy
#undef memset #undef memset
void * memcpy(void * to, const void * from, size_t n) void *memcpy(void *to, const void *from, size_t n)
{ {
#ifdef CONFIG_X86_USE_3DNOW #ifdef CONFIG_X86_USE_3DNOW
return __memcpy3d(to, from, n); return __memcpy3d(to, from, n);
...@@ -12,8 +13,32 @@ void * memcpy(void * to, const void * from, size_t n) ...@@ -12,8 +13,32 @@ void * memcpy(void * to, const void * from, size_t n)
return __memcpy(to, from, n); return __memcpy(to, from, n);
#endif #endif
} }
EXPORT_SYMBOL_NOVERS(memcpy);
void * memset(void * s, int c, size_t count) void *memset(void *s, int c, size_t count)
{ {
return __memset(s, c, count); return __memset(s, c, count);
} }
EXPORT_SYMBOL_NOVERS(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_NOVERS(memmove);
...@@ -294,24 +294,7 @@ extern void __struct_cpy_bug (void); ...@@ -294,24 +294,7 @@ extern void __struct_cpy_bug (void);
}) })
#define __HAVE_ARCH_MEMMOVE #define __HAVE_ARCH_MEMMOVE
static inline void * memmove(void * dest,const void * src, size_t n) 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;
}
#define memcmp __builtin_memcmp #define memcmp __builtin_memcmp
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment