allow coexistance of N build and AC build.
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / include / asm-blackfin / string.h
blob6f1eb7d6d3cb33d297b96cf76820dab64a1bb22f
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)
9 char *xdest = dest;
10 char temp = 0;
12 __asm__ __volatile__
13 ("1:\t%2 = B [%1++] (Z);\n\t"
14 "B [%0++] = %2;\n\t"
15 "CC = %2;\n\t"
16 "if cc jump 1b (bp);\n"
17 : "+&a" (dest), "+&a" (src), "=&d" (temp)
18 ::"memory", "CC");
19 return xdest;
22 #define __HAVE_ARCH_STRNCPY
23 extern inline char *strncpy(char *dest, const char *src, size_t n)
25 char *xdest = dest;
26 char temp = 0;
28 if (n == 0)
29 return xdest;
31 __asm__ __volatile__
32 ("1:\t%3 = B [%1++] (Z);\n\t"
33 "B [%0++] = %3;\n\t"
34 "CC = %3;\n\t"
35 "if ! cc jump 2f;\n\t"
36 "%2 += -1;\n\t"
37 "CC = %2 == 0;\n\t"
38 "if ! cc jump 1b (bp);\n"
39 "2:\n"
40 : "+&a" (dest), "+&a" (src), "+&da" (n), "=&d" (temp)
41 ::"memory", "CC");
42 return xdest;
45 #define __HAVE_ARCH_STRCMP
46 extern inline int strcmp(const char *cs, const char *ct)
48 char __res1, __res2;
50 __asm__
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 */
59 "3:\n"
60 : "+&a" (cs), "+&a" (ct), "=&d" (__res1), "=&d" (__res2)
61 : : "CC");
63 return __res1;
66 #define __HAVE_ARCH_STRNCMP
67 extern inline int strncmp(const char *cs, const char *ct, size_t count)
69 char __res1, __res2;
71 if (!count)
72 return 0;
73 __asm__
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 */
81 "CC = %2 == 0;\n\t"
82 "if ! cc jump 1b;\n" /* more to do, keep going */
83 "2:\t%3 = 0;\n\t" /* strings are equal */
84 "jump.s 4f;\n"
85 "3:\t%3 = %3 - %4;\n" /* *cs - *ct */
86 "4:"
87 : "+&a" (cs), "+&a" (ct), "+&da" (count), "=&d" (__res1), "=&d" (__res2)
88 : : "CC");
89 return __res1;
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_ */