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 ...
23 #define __HAVE_ARCH_STRCPY
24 static __inline__
char *strcpy(char *__dest
, __const__
char *__src
)
26 char *__xdest
= __dest
;
31 "1:\tlbu\t$1,(%1)\n\t"
38 : "=r" (__dest
), "=r" (__src
)
39 : "0" (__dest
), "1" (__src
)
45 #define __HAVE_ARCH_STRNCPY
46 static __inline__
char *strncpy(char *__dest
, __const__
char *__src
, size_t __n
)
48 char *__xdest
= __dest
;
56 "1:\tlbu\t$1,(%1)\n\t"
66 : "=r" (__dest
), "=r" (__src
), "=r" (__n
)
67 : "0" (__dest
), "1" (__src
), "2" (__n
)
73 #define __HAVE_ARCH_STRCMP
74 static __inline__
int strcmp(__const__
char *__cs
, __const__
char *__ct
)
82 "1:\tlbu\t$1,(%1)\n\t"
88 #if defined(CONFIG_CPU_R3000)
95 : "=r" (__cs
), "=r" (__ct
), "=r" (__res
)
96 : "0" (__cs
), "1" (__ct
));
101 #endif /* !defined(IN_STRING_C) */
103 #define __HAVE_ARCH_STRNCMP
104 static __inline__
int
105 strncmp(__const__
char *__cs
, __const__
char *__ct
, size_t __count
)
109 __asm__
__volatile__(
110 ".set\tnoreorder\n\t"
112 "1:\tlbu\t%3,(%0)\n\t"
121 #if defined(CONFIG_CPU_R3000)
125 "3:\tsubu\t%3,$1\n\t"
128 : "=r" (__cs
), "=r" (__ct
), "=r" (__count
), "=r" (__res
)
129 : "0" (__cs
), "1" (__ct
), "2" (__count
));
133 #endif /* CONFIG_MIPS32 */
135 #define __HAVE_ARCH_MEMSET
136 extern void *memset(void *__s
, int __c
, size_t __count
);
138 #define __HAVE_ARCH_MEMCPY
139 extern void *memcpy(void *__to
, __const__
void *__from
, size_t __n
);
141 #define __HAVE_ARCH_MEMMOVE
142 extern void *memmove(void *__dest
, __const__
void *__src
, size_t __n
);
145 #define __HAVE_ARCH_MEMSCAN
146 static __inline__
void *memscan(void *__addr
, int __c
, size_t __size
)
148 char *__end
= (char *)__addr
+ __size
;
149 unsigned char __uc
= (unsigned char) __c
;
151 __asm__(".set\tpush\n\t"
154 "1:\tbeq\t%0,%1,2f\n\t"
159 : "=r" (__addr
), "=r" (__end
)
160 : "0" (__addr
), "1" (__end
), "Jr" (__uc
));
164 #endif /* CONFIG_MIPS32 */
166 #endif /* _ASM_STRING_H */