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 void *memset(void *s
, int c
, size_t count
)
34 if (count
> 2 && (long)s
& 2) {
49 " jmp %%pc@(2f,%2:w:2)\n"
62 : "=a" (ls
), "=d" (temp
), "=&d" (temp1
)
63 : "d" (c
), "0" (ls
), "1" (temp
));
77 EXPORT_SYMBOL(memset
);
79 void *memcpy(void *to
, const void *from
, size_t n
)
88 const char *cfrom
= from
;
94 if (n
> 2 && (long)to
& 2) {
96 const short *sfrom
= from
;
105 const long *lfrom
= from
;
112 " jmp %%pc@(1f,%3:w:2)\n"
113 "4: movel %0@+,%1@+\n"
125 : "=a" (lfrom
), "=a" (lto
), "=d" (temp
), "=&d" (temp1
)
126 : "0" (lfrom
), "1" (lto
), "2" (temp
));
132 const short *sfrom
= from
;
139 const char *cfrom
= from
;
144 EXPORT_SYMBOL(memcpy
);
146 void *memmove(void *dest
, const void *src
, size_t n
)
155 if ((long)dest
& 1) {
157 const char *csrc
= src
;
163 if (n
> 2 && (long)dest
& 2) {
165 const short *ssrc
= src
;
174 const long *lsrc
= src
;
184 const short *ssrc
= src
;
191 const char *csrc
= src
;
195 dest
= (char *)dest
+ n
;
196 src
= (const char *)src
+ n
;
197 if ((long)dest
& 1) {
199 const char *csrc
= src
;
205 if (n
> 2 && (long)dest
& 2) {
207 const short *ssrc
= src
;
216 const long *lsrc
= src
;
226 const short *ssrc
= src
;
233 const char *csrc
= src
;
239 EXPORT_SYMBOL(memmove
);
241 int memcmp(const void *cs
, const void *ct
, size_t count
)
243 const unsigned char *su1
, *su2
;
245 for (su1
= cs
, su2
= ct
; count
> 0; ++su1
, ++su2
, count
--)
247 return *su1
< *su2
? -1 : +1;
250 EXPORT_SYMBOL(memcmp
);