HID: make hid_input_field and usbhid_modify_dquirk static
[linux-2.6/mini2440.git] / include / asm-m68knommu / string.h
blobaf09e17000fc125b77e1e511897d7d93c1b907e3
1 #ifndef _M68KNOMMU_STRING_H_
2 #define _M68KNOMMU_STRING_H_
4 #ifdef __KERNEL__ /* only set these up for kernel code */
6 #include <asm/setup.h>
7 #include <asm/page.h>
9 #define __HAVE_ARCH_STRCPY
10 static inline char * strcpy(char * dest,const char *src)
12 char *xdest = dest;
14 __asm__ __volatile__
15 ("1:\tmoveb %1@+,%0@+\n\t"
16 "jne 1b"
17 : "=a" (dest), "=a" (src)
18 : "0" (dest), "1" (src) : "memory");
19 return xdest;
22 #define __HAVE_ARCH_STRNCPY
23 static inline char * strncpy(char *dest, const char *src, size_t n)
25 char *xdest = dest;
27 if (n == 0)
28 return xdest;
30 __asm__ __volatile__
31 ("1:\tmoveb %1@+,%0@+\n\t"
32 "jeq 2f\n\t"
33 "subql #1,%2\n\t"
34 "jne 1b\n\t"
35 "2:"
36 : "=a" (dest), "=a" (src), "=d" (n)
37 : "0" (dest), "1" (src), "2" (n)
38 : "memory");
39 return xdest;
43 #ifndef CONFIG_COLDFIRE
45 #define __HAVE_ARCH_STRCMP
46 static inline int strcmp(const char * cs,const char * ct)
48 char __res;
50 __asm__
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 */
58 "3:"
59 : "=a" (cs), "=a" (ct), "=d" (__res)
60 : "0" (cs), "1" (ct));
62 return __res;
65 #define __HAVE_ARCH_STRNCMP
66 static inline int strncmp(const char * cs,const char * ct,size_t count)
68 char __res;
70 if (!count)
71 return 0;
72 __asm__
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 */
81 "jra 4f\n\t"
82 "3:\tsubb %1@-,%3\n\t" /* *cs - *ct */
83 "4:"
84 : "=a" (cs), "=a" (ct), "=d" (count), "=d" (__res)
85 : "0" (cs), "1" (ct), "2" (count));
86 return __res;
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);
97 #else /* KERNEL */
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
124 #endif /* KERNEL */
126 #endif /* _M68K_STRING_H_ */