diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2007-10-11 05:16:33 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2007-10-11 05:16:33 -0400 |
commit | 44f0257fc316ff4b33aa3438dd8d891b7d6d72b9 (patch) | |
tree | c1a9a571db37d631489f18e1dfe5554874b19027 /arch/x86/lib/memcpy_32.c | |
parent | da957e111bb0c189a4a3bf8a00caaecb59ed94ca (diff) |
i386: move lib
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/lib/memcpy_32.c')
-rw-r--r-- | arch/x86/lib/memcpy_32.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/arch/x86/lib/memcpy_32.c b/arch/x86/lib/memcpy_32.c new file mode 100644 index 000000000000..8ac51b82a632 --- /dev/null +++ b/arch/x86/lib/memcpy_32.c | |||
@@ -0,0 +1,43 @@ | |||
1 | #include <linux/string.h> | ||
2 | #include <linux/module.h> | ||
3 | |||
4 | #undef memcpy | ||
5 | #undef memset | ||
6 | |||
7 | void *memcpy(void *to, const void *from, size_t n) | ||
8 | { | ||
9 | #ifdef CONFIG_X86_USE_3DNOW | ||
10 | return __memcpy3d(to, from, n); | ||
11 | #else | ||
12 | return __memcpy(to, from, n); | ||
13 | #endif | ||
14 | } | ||
15 | EXPORT_SYMBOL(memcpy); | ||
16 | |||
17 | void *memset(void *s, int c, size_t count) | ||
18 | { | ||
19 | return __memset(s, c, count); | ||
20 | } | ||
21 | EXPORT_SYMBOL(memset); | ||
22 | |||
23 | void *memmove(void *dest, const void *src, size_t n) | ||
24 | { | ||
25 | int d0, d1, d2; | ||
26 | |||
27 | if (dest < src) { | ||
28 | memcpy(dest,src,n); | ||
29 | } else { | ||
30 | __asm__ __volatile__( | ||
31 | "std\n\t" | ||
32 | "rep\n\t" | ||
33 | "movsb\n\t" | ||
34 | "cld" | ||
35 | : "=&c" (d0), "=&S" (d1), "=&D" (d2) | ||
36 | :"0" (n), | ||
37 | "1" (n-1+(const char *)src), | ||
38 | "2" (n-1+(char *)dest) | ||
39 | :"memory"); | ||
40 | } | ||
41 | return dest; | ||
42 | } | ||
43 | EXPORT_SYMBOL(memmove); | ||