2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file COPYING in the main directory of this archive
9 #include <linux/module.h>
10 #include <linux/string.h>
12 char *strcpy(char *dest, const char *src)
14 return __kernel_strcpy(dest, src);
16 EXPORT_SYMBOL(strcpy);
18 char *strcat(char *dest, const char *src)
20 return __kernel_strcpy(dest + __kernel_strlen(dest), src);
22 EXPORT_SYMBOL(strcat);
24 void *memset(void *s, int c, size_t count)
40 if (count > 2 && (long)s & 2) {
55 " jmp %%pc@(2f,%2:w:2)\n"
68 : "=a" (ls), "=d" (temp), "=&d" (temp1)
69 : "d" (c), "0" (ls), "1" (temp));
83 EXPORT_SYMBOL(memset);
85 void *memcpy(void *to, const void *from, size_t n)
94 const char *cfrom = from;
100 if (n > 2 && (long)to & 2) {
102 const short *sfrom = from;
111 const long *lfrom = from;
118 " jmp %%pc@(1f,%3:w:2)\n"
119 "4: movel %0@+,%1@+\n"
131 : "=a" (lfrom), "=a" (lto), "=d" (temp), "=&d" (temp1)
132 : "0" (lfrom), "1" (lto), "2" (temp));
138 const short *sfrom = from;
145 const char *cfrom = from;
150 EXPORT_SYMBOL(memcpy);
152 void *memmove(void *dest, const void *src, size_t n)
161 if ((long)dest & 1) {
163 const char *csrc = src;
169 if (n > 2 && (long)dest & 2) {
171 const short *ssrc = src;
180 const long *lsrc = src;
190 const short *ssrc = src;
197 const char *csrc = src;
201 dest = (char *)dest + n;
202 src = (const char *)src + n;
203 if ((long)dest & 1) {
205 const char *csrc = src;
211 if (n > 2 && (long)dest & 2) {
213 const short *ssrc = src;
222 const long *lsrc = src;
232 const short *ssrc = src;
239 const char *csrc = src;
245 EXPORT_SYMBOL(memmove);
247 int memcmp(const void *cs, const void *ct, size_t count)
249 const unsigned char *su1, *su2;
251 for (su1 = cs, su2 = ct; count > 0; ++su1, ++su2, count--)
253 return *su1 < *su2 ? -1 : +1;
256 EXPORT_SYMBOL(memcmp);