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, 95, 96, 97, 98, 2000, 01 Ralf Baechle
7 * Copyright (c) 2000 by Silicon Graphics, Inc.
8 * Copyright (c) 2001 MIPS Technologies, Inc.
13 #include <linux/config.h>
16 * Most of the inline functions are rather naive implementations so I just
17 * didn't bother updating them for 64-bit ...
21 #define __HAVE_ARCH_STRCPY
22 static __inline__ char *strcpy(char *__dest, __const__ char *__src)
24 char *__xdest = __dest;
29 "1:\tlbu\t$1,(%1)\n\t"
36 : "=r" (__dest), "=r" (__src)
37 : "0" (__dest), "1" (__src)
43 #define __HAVE_ARCH_STRNCPY
44 static __inline__ char *strncpy(char *__dest, __const__ char *__src, size_t __n)
46 char *__xdest = __dest;
54 "1:\tlbu\t$1,(%1)\n\t"
64 : "=r" (__dest), "=r" (__src), "=r" (__n)
65 : "0" (__dest), "1" (__src), "2" (__n)
71 #define __HAVE_ARCH_STRCMP
72 static __inline__ int strcmp(__const__ char *__cs, __const__ char *__ct)
80 "1:\tlbu\t$1,(%1)\n\t"
86 #if defined(CONFIG_CPU_R3000)
93 : "=r" (__cs), "=r" (__ct), "=r" (__res)
94 : "0" (__cs), "1" (__ct));
99 #define __HAVE_ARCH_STRNCMP
100 static __inline__ int
101 strncmp(__const__ char *__cs, __const__ char *__ct, size_t __count)
105 __asm__ __volatile__(
106 ".set\tnoreorder\n\t"
108 "1:\tlbu\t%3,(%0)\n\t"
117 #if defined(CONFIG_CPU_R3000)
121 "3:\tsubu\t%3,$1\n\t"
124 : "=r" (__cs), "=r" (__ct), "=r" (__count), "=r" (__res)
125 : "0" (__cs), "1" (__ct), "2" (__count));
129 #endif /* CONFIG_MIPS32 */
131 #define __HAVE_ARCH_MEMSET
132 extern void *memset(void *__s, int __c, size_t __count);
134 #define __HAVE_ARCH_MEMCPY
135 extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
137 #define __HAVE_ARCH_MEMMOVE
138 extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
140 /* Don't build bcopy at all ... */
141 #define __HAVE_ARCH_BCOPY
144 #define __HAVE_ARCH_MEMSCAN
145 static __inline__ void *memscan(void *__addr, int __c, size_t __size)
147 char *__end = (char *)__addr + __size;
148 unsigned char __uc = (unsigned char) __c;
150 __asm__(".set\tpush\n\t"
153 "1:\tbeq\t%0,%1,2f\n\t"
158 : "=r" (__addr), "=r" (__end)
159 : "0" (__addr), "1" (__end), "Jr" (__uc));
163 #endif /* CONFIG_MIPS32 */
165 #endif /* _ASM_STRING_H */