1 /* $Id: string.h,v 1.13 2000/02/19 14:12:14 harald Exp $
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
7 * Copyright (c) 1994, 1995, 1996, 1997, 1998 by Ralf Baechle
9 #ifndef __ASM_MIPS_STRING_H
10 #define __ASM_MIPS_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)
93 #define __HAVE_ARCH_STRNCMP
95 strncmp(__const__ char *__cs, __const__ char *__ct, size_t __count)
100 ".set\tnoreorder\n\t"
102 "1:\tlbu\t%3,(%0)\n\t"
111 #if defined(CONFIG_CPU_R3000)
115 "3:\tsubu\t%3,$1\n\t"
118 : "=r" (__cs), "=r" (__ct), "=r" (__count), "=r" (__res)
119 : "0" (__cs), "1" (__ct), "2" (__count)
125 #undef __HAVE_ARCH_MEMSET
126 extern void *memset(void *__s, int __c, size_t __count);
128 #undef __HAVE_ARCH_MEMCPY
129 extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
131 #undef __HAVE_ARCH_MEMMOVE
132 extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
134 /* Don't build bcopy at all ... */
135 #define __HAVE_ARCH_BCOPY
137 #define __HAVE_ARCH_MEMSCAN
138 extern __inline__ void *memscan(void *__addr, int __c, size_t __size)
140 char *__end = (char *)__addr + __size;
142 __asm__(".set\tpush\n\t"
145 "1:\tbeq\t%0,%1,2f\n\t"
150 : "=r" (__addr), "=r" (__end)
151 : "0" (__addr), "1" (__end), "r" (__c)
157 #endif /* __ASM_MIPS_STRING_H */