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
6 * Copyright (c) 1994, 1995, 1996, 1997, 1998, 2001 Ralf Baechle
7 * Copyright (c) 2001 MIPS Technologies, Inc.
10 #define __ASM_STRING_H
12 #include <linux/config.h>
14 #define __HAVE_ARCH_STRCPY
15 extern __inline__
char *strcpy(char *__dest
, __const__
char *__src
)
17 char *__xdest
= __dest
;
22 "1:\tlbu\t$1,(%1)\n\t"
29 : "=r" (__dest
), "=r" (__src
)
30 : "0" (__dest
), "1" (__src
)
36 #define __HAVE_ARCH_STRNCPY
37 extern __inline__
char *strncpy(char *__dest
, __const__
char *__src
, size_t __n
)
39 char *__xdest
= __dest
;
47 "1:\tlbu\t$1,(%1)\n\t"
57 : "=r" (__dest
), "=r" (__src
), "=r" (__n
)
58 : "0" (__dest
), "1" (__src
), "2" (__n
)
64 #define __HAVE_ARCH_STRCMP
65 extern __inline__
int strcmp(__const__
char *__cs
, __const__
char *__ct
)
73 "1:\tlbu\t$1,(%1)\n\t"
79 #if defined(CONFIG_CPU_R3000)
86 : "=r" (__cs
), "=r" (__ct
), "=r" (__res
)
87 : "0" (__cs
), "1" (__ct
));
92 #define __HAVE_ARCH_STRNCMP
94 strncmp(__const__
char *__cs
, __const__
char *__ct
, size_t __count
)
101 "1:\tlbu\t%3,(%0)\n\t"
110 #if defined(CONFIG_CPU_R3000)
114 "3:\tsubu\t%3,$1\n\t"
117 : "=r" (__cs
), "=r" (__ct
), "=r" (__count
), "=r" (__res
)
118 : "0" (__cs
), "1" (__ct
), "2" (__count
));
123 #define __HAVE_ARCH_MEMSET
124 extern void *memset(void *__s
, int __c
, size_t __count
);
126 #define __HAVE_ARCH_MEMCPY
127 extern void *memcpy(void *__to
, __const__
void *__from
, size_t __n
);
129 #define __HAVE_ARCH_MEMMOVE
130 extern void *memmove(void *__dest
, __const__
void *__src
, size_t __n
);
132 /* Don't build bcopy at all ... */
133 #define __HAVE_ARCH_BCOPY
135 #define __HAVE_ARCH_MEMSCAN
136 extern __inline__
void *memscan(void *__addr
, int __c
, size_t __size
)
138 char *__end
= (char *)__addr
+ __size
;
139 unsigned char __uc
= (unsigned char) __c
;
141 __asm__(".set\tpush\n\t"
144 "1:\tbeq\t%0,%1,2f\n\t"
149 : "=r" (__addr
), "=r" (__end
)
150 : "0" (__addr
), "1" (__end
), "Jr" (__uc
));
155 #endif /* __ASM_STRING_H */