1 #ifndef _M68KNOMMU_STRING_H_
2 #define _M68KNOMMU_STRING_H_
4 #ifdef __KERNEL__ /* only set these up for kernel code */
9 #define __HAVE_ARCH_STRCPY
10 static inline char * strcpy(char * dest,const char *src)
15 ("1:\tmoveb %1@+,%0@+\n\t"
17 : "=a" (dest), "=a" (src)
18 : "0" (dest), "1" (src) : "memory");
22 #define __HAVE_ARCH_STRNCPY
23 static inline char * strncpy(char *dest, const char *src, size_t n)
31 ("1:\tmoveb %1@+,%0@+\n\t"
36 : "=a" (dest), "=a" (src), "=d" (n)
37 : "0" (dest), "1" (src), "2" (n)
43 #ifndef CONFIG_COLDFIRE
45 #define __HAVE_ARCH_STRCMP
46 static inline int strcmp(const char * cs,const char * ct)
51 ("1:\tmoveb %0@+,%2\n\t" /* get *cs */
52 "cmpb %1@+,%2\n\t" /* compare a byte */
53 "jne 2f\n\t" /* not equal, break out */
54 "tstb %2\n\t" /* at end of cs? */
55 "jne 1b\n\t" /* no, keep going */
56 "jra 3f\n\t" /* strings are equal */
57 "2:\tsubb %1@-,%2\n\t" /* *cs - *ct */
59 : "=a" (cs), "=a" (ct), "=d" (__res)
60 : "0" (cs), "1" (ct));
65 #define __HAVE_ARCH_STRNCMP
66 static inline int strncmp(const char * cs,const char * ct,size_t count)
73 ("1:\tmovb %0@+,%3\n\t" /* get *cs */
74 "cmpb %1@+,%3\n\t" /* compare a byte */
75 "jne 3f\n\t" /* not equal, break out */
76 "tstb %3\n\t" /* at end of cs? */
77 "jeq 4f\n\t" /* yes, all done */
78 "subql #1,%2\n\t" /* no, adjust count */
79 "jne 1b\n\t" /* more to do, keep going */
80 "2:\tmoveq #0,%3\n\t" /* strings are equal */
82 "3:\tsubb %1@-,%3\n\t" /* *cs - *ct */
84 : "=a" (cs), "=a" (ct), "=d" (count), "=d" (__res)
85 : "0" (cs), "1" (ct), "2" (count));
89 #endif /* CONFIG_COLDFIRE */
91 #define __HAVE_ARCH_MEMSET
92 extern void * memset(void * s, int c, size_t count);
94 #define __HAVE_ARCH_MEMCPY
95 extern void * memcpy(void *d, const void *s, size_t count);
100 * let user libraries deal with these,
101 * IMHO the kernel has no place defining these functions for user apps
104 #define __HAVE_ARCH_STRCPY 1
105 #define __HAVE_ARCH_STRNCPY 1
106 #define __HAVE_ARCH_STRCAT 1
107 #define __HAVE_ARCH_STRNCAT 1
108 #define __HAVE_ARCH_STRCMP 1
109 #define __HAVE_ARCH_STRNCMP 1
110 #define __HAVE_ARCH_STRNICMP 1
111 #define __HAVE_ARCH_STRCHR 1
112 #define __HAVE_ARCH_STRRCHR 1
113 #define __HAVE_ARCH_STRSTR 1
114 #define __HAVE_ARCH_STRLEN 1
115 #define __HAVE_ARCH_STRNLEN 1
116 #define __HAVE_ARCH_MEMSET 1
117 #define __HAVE_ARCH_MEMCPY 1
118 #define __HAVE_ARCH_MEMMOVE 1
119 #define __HAVE_ARCH_MEMSCAN 1
120 #define __HAVE_ARCH_MEMCMP 1
121 #define __HAVE_ARCH_MEMCHR 1
122 #define __HAVE_ARCH_STRTOK 1
126 #endif /* _M68K_STRING_H_ */