1 #ifndef _M68K_STRING_H_
2 #define _M68K_STRING_H_
4 #include <linux/types.h>
5 #include <linux/compiler.h>
7 static inline char *__kernel_strcpy(char *dest, const char *src)
12 "1: move.b (%1)+,(%0)+\n"
14 : "+a" (dest), "+a" (src)
21 #define __HAVE_ARCH_STRNLEN
22 static inline size_t strnlen(const char *s, size_t count)
33 : "+a" (sc), "+d" (count));
37 #define __HAVE_ARCH_STRCPY
39 #define strcpy(d, s) (__builtin_constant_p(s) && \
40 __builtin_strlen(s) <= 32 ? \
41 __builtin_strcpy(d, s) : \
42 __kernel_strcpy(d, s))
44 #define strcpy(d, s) __kernel_strcpy(d, s)
47 #define __HAVE_ARCH_STRNCPY
48 static inline char *strncpy(char *dest, const char *src, size_t n)
54 "1: move.b (%1),(%0)+\n"
59 : "+a" (dest), "+a" (src), "+d" (n)
64 #define __HAVE_ARCH_STRCAT
65 #define strcat(d, s) ({ \
67 strcpy(__d + strlen(__d), (s)); \
70 #ifndef CONFIG_COLDFIRE
71 #define __HAVE_ARCH_STRCMP
72 static inline int strcmp(const char *cs, const char *ct)
77 "1: move.b (%0)+,%2\n" /* get *cs */
78 " cmp.b (%1)+,%2\n" /* compare a byte */
79 " jne 2f\n" /* not equal, break out */
80 " tst.b %2\n" /* at end of cs? */
81 " jne 1b\n" /* no, keep going */
82 " jra 3f\n" /* strings are equal */
83 "2: sub.b -(%1),%2\n" /* *cs - *ct */
85 : "+a" (cs), "+a" (ct), "=d" (res));
88 #endif /* CONFIG_COLDFIRE */
90 #define __HAVE_ARCH_MEMMOVE
91 extern void *memmove(void *, const void *, __kernel_size_t);
93 #define memcmp(d, s, n) __builtin_memcmp(d, s, n)
95 #define __HAVE_ARCH_MEMSET
96 extern void *memset(void *, int, __kernel_size_t);
97 #define memset(d, c, n) __builtin_memset(d, c, n)
99 #define __HAVE_ARCH_MEMCPY
100 extern void *memcpy(void *, const void *, __kernel_size_t);
101 #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
105 #endif /* _M68K_STRING_H_ */