1 --- a/arch/mips/include/asm/string.h
2 +++ b/arch/mips/include/asm/string.h
3 @@ -133,11 +133,44 @@ strncmp(__const__ char *__cs, __const__
5 #define __HAVE_ARCH_MEMSET
6 extern void *memset(void *__s, int __c, size_t __count);
7 +#define memset(__s, __c, len) \
9 + size_t __len = (len); \
11 + if (__builtin_constant_p(len) && __len >= 64) \
12 + __ret = memset((__s), (__c), __len); \
14 + __ret = __builtin_memset((__s), (__c), __len); \
18 #define __HAVE_ARCH_MEMCPY
19 extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
20 +#define memcpy(dst, src, len) \
22 + size_t __len = (len); \
24 + if (__builtin_constant_p(len) && __len >= 64) \
25 + __ret = memcpy((dst), (src), __len); \
27 + __ret = __builtin_memcpy((dst), (src), __len); \
31 #define __HAVE_ARCH_MEMMOVE
32 extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
33 +#define memmove(dst, src, len) \
35 + size_t __len = (len); \
37 + if (__builtin_constant_p(len) && __len >= 64) \
38 + __ret = memmove((dst), (src), __len); \
40 + __ret = __builtin_memmove((dst), (src), __len); \
44 +#define __HAVE_ARCH_MEMCMP
45 +#define memcmp(src1, src2, len) __builtin_memcmp((src1), (src2), (len))
47 #endif /* _ASM_STRING_H */
48 --- a/arch/mips/lib/Makefile
49 +++ b/arch/mips/lib/Makefile
53 lib-y += csum_partial.o delay.o memcpy.o memcpy-inatomic.o memset.o \
54 - strlen_user.o strncpy_user.o strnlen_user.o uncached.o
55 + strlen_user.o strncpy_user.o strnlen_user.o uncached.o memcmp.o
58 obj-$(CONFIG_PCI) += iomap-pci.o
60 +++ b/arch/mips/lib/memcmp.c
63 + * copied from linux/lib/string.c
65 + * Copyright (C) 1991, 1992 Linus Torvalds
68 +#include <linux/module.h>
69 +#include <linux/string.h>
72 +int memcmp(const void *cs, const void *ct, size_t count)
74 + const unsigned char *su1, *su2;
77 + for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
78 + if ((res = *su1 - *su2) != 0)
82 +EXPORT_SYMBOL(memcmp);