1 #ifndef _BLACKFIN_STRING_H_
2 #define _BLACKFIN_STRING_H_
4 #ifdef __KERNEL__ /* only set these up for kernel code */
6 #define __HAVE_ARCH_STRCPY
7 extern inline char *strcpy(char *dest, const char *src)
13 ("1:\t%2 = B [%1++] (Z);\n\t"
16 "if cc jump 1b (bp);\n"
17 : "+&a" (dest), "+&a" (src), "=&d" (temp)
22 #define __HAVE_ARCH_STRNCPY
23 extern inline char *strncpy(char *dest, const char *src, size_t n)
32 ("1:\t%3 = B [%1++] (Z);\n\t"
35 "if ! cc jump 2f;\n\t"
38 "if ! cc jump 1b (bp);\n"
40 : "+&a" (dest), "+&a" (src), "+&da" (n), "=&d" (temp)
45 #define __HAVE_ARCH_STRCMP
46 extern inline int strcmp(const char *cs, const char *ct)
51 ("1:\t%2 = B[%0++] (Z);\n\t" /* get *cs */
52 "%3 = B[%1++] (Z);\n\t" /* get *ct */
53 "CC = %2 == %3;\n\t" /* compare a byte */
54 "if ! cc jump 2f;\n\t" /* not equal, break out */
55 "CC = %2;\n\t" /* at end of cs? */
56 "if cc jump 1b (bp);\n\t" /* no, keep going */
57 "jump.s 3f;\n" /* strings are equal */
58 "2:\t%2 = %2 - %3;\n" /* *cs - *ct */
60 : "+&a" (cs), "+&a" (ct), "=&d" (__res1), "=&d" (__res2)
66 #define __HAVE_ARCH_STRNCMP
67 extern inline int strncmp(const char *cs, const char *ct, size_t count)
74 ("1:\t%3 = B[%0++] (Z);\n\t" /* get *cs */
75 "%4 = B[%1++] (Z);\n\t" /* get *ct */
76 "CC = %3 == %4;\n\t" /* compare a byte */
77 "if ! cc jump 3f;\n\t" /* not equal, break out */
78 "CC = %3;\n\t" /* at end of cs? */
79 "if ! cc jump 4f;\n\t" /* yes, all done */
80 "%2 += -1;\n\t" /* no, adjust count */
82 "if ! cc jump 1b;\n" /* more to do, keep going */
83 "2:\t%3 = 0;\n\t" /* strings are equal */
85 "3:\t%3 = %3 - %4;\n" /* *cs - *ct */
87 : "+&a" (cs), "+&a" (ct), "+&da" (count), "=&d" (__res1), "=&d" (__res2)
92 #define __HAVE_ARCH_MEMSET
93 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);
96 #define __HAVE_ARCH_MEMCMP
97 extern int memcmp(const void *, const void *, __kernel_size_t);
98 #define __HAVE_ARCH_MEMCHR
99 extern void *memchr(const void *s, int c, size_t n);
100 #define __HAVE_ARCH_MEMMOVE
101 extern void *memmove(void *dest, const void *src, size_t count);
103 #endif /*__KERNEL__*/
104 #endif /* _BLACKFIN_STRING_H_ */