diff options
author | Paul Mundt <lethal@linux-sh.org> | 2007-11-08 23:00:30 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-01-27 23:18:40 -0500 |
commit | 7960a1d02b00fd5dfa5c2d9b957e4e5f6ec23997 (patch) | |
tree | c5128f16f8b2d34f5ea62b4225063165f8c27f8a /include | |
parent | da06b8d0545a1bf95b9060bf301d6de3400fafd6 (diff) |
sh: Split out asm/string.h for sh32 and sh64.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-sh/string.h | 136 | ||||
-rw-r--r-- | include/asm-sh/string_32.h | 131 | ||||
-rw-r--r-- | include/asm-sh/string_64.h (renamed from include/asm-sh64/string.h) | 0 |
3 files changed, 136 insertions, 131 deletions
diff --git a/include/asm-sh/string.h b/include/asm-sh/string.h index 55f8db6bc1d7..8c1ea21dc0ae 100644 --- a/include/asm-sh/string.h +++ b/include/asm-sh/string.h | |||
@@ -1,131 +1,5 @@ | |||
1 | #ifndef __ASM_SH_STRING_H | 1 | #ifdef CONFIG_SUPERH32 |
2 | #define __ASM_SH_STRING_H | 2 | # include "string_32.h" |
3 | 3 | #else | |
4 | #ifdef __KERNEL__ | 4 | # include "string_64.h" |
5 | 5 | #endif | |
6 | /* | ||
7 | * Copyright (C) 1999 Niibe Yutaka | ||
8 | * But consider these trivial functions to be public domain. | ||
9 | */ | ||
10 | |||
11 | #define __HAVE_ARCH_STRCPY | ||
12 | static inline char *strcpy(char *__dest, const char *__src) | ||
13 | { | ||
14 | register char *__xdest = __dest; | ||
15 | unsigned long __dummy; | ||
16 | |||
17 | __asm__ __volatile__("1:\n\t" | ||
18 | "mov.b @%1+, %2\n\t" | ||
19 | "mov.b %2, @%0\n\t" | ||
20 | "cmp/eq #0, %2\n\t" | ||
21 | "bf/s 1b\n\t" | ||
22 | " add #1, %0\n\t" | ||
23 | : "=r" (__dest), "=r" (__src), "=&z" (__dummy) | ||
24 | : "0" (__dest), "1" (__src) | ||
25 | : "memory", "t"); | ||
26 | |||
27 | return __xdest; | ||
28 | } | ||
29 | |||
30 | #define __HAVE_ARCH_STRNCPY | ||
31 | static inline char *strncpy(char *__dest, const char *__src, size_t __n) | ||
32 | { | ||
33 | register char *__xdest = __dest; | ||
34 | unsigned long __dummy; | ||
35 | |||
36 | if (__n == 0) | ||
37 | return __xdest; | ||
38 | |||
39 | __asm__ __volatile__( | ||
40 | "1:\n" | ||
41 | "mov.b @%1+, %2\n\t" | ||
42 | "mov.b %2, @%0\n\t" | ||
43 | "cmp/eq #0, %2\n\t" | ||
44 | "bt/s 2f\n\t" | ||
45 | " cmp/eq %5,%1\n\t" | ||
46 | "bf/s 1b\n\t" | ||
47 | " add #1, %0\n" | ||
48 | "2:" | ||
49 | : "=r" (__dest), "=r" (__src), "=&z" (__dummy) | ||
50 | : "0" (__dest), "1" (__src), "r" (__src+__n) | ||
51 | : "memory", "t"); | ||
52 | |||
53 | return __xdest; | ||
54 | } | ||
55 | |||
56 | #define __HAVE_ARCH_STRCMP | ||
57 | static inline int strcmp(const char *__cs, const char *__ct) | ||
58 | { | ||
59 | register int __res; | ||
60 | unsigned long __dummy; | ||
61 | |||
62 | __asm__ __volatile__( | ||
63 | "mov.b @%1+, %3\n" | ||
64 | "1:\n\t" | ||
65 | "mov.b @%0+, %2\n\t" | ||
66 | "cmp/eq #0, %3\n\t" | ||
67 | "bt 2f\n\t" | ||
68 | "cmp/eq %2, %3\n\t" | ||
69 | "bt/s 1b\n\t" | ||
70 | " mov.b @%1+, %3\n\t" | ||
71 | "add #-2, %1\n\t" | ||
72 | "mov.b @%1, %3\n\t" | ||
73 | "sub %3, %2\n" | ||
74 | "2:" | ||
75 | : "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy) | ||
76 | : "0" (__cs), "1" (__ct) | ||
77 | : "t"); | ||
78 | |||
79 | return __res; | ||
80 | } | ||
81 | |||
82 | #define __HAVE_ARCH_STRNCMP | ||
83 | static inline int strncmp(const char *__cs, const char *__ct, size_t __n) | ||
84 | { | ||
85 | register int __res; | ||
86 | unsigned long __dummy; | ||
87 | |||
88 | if (__n == 0) | ||
89 | return 0; | ||
90 | |||
91 | __asm__ __volatile__( | ||
92 | "mov.b @%1+, %3\n" | ||
93 | "1:\n\t" | ||
94 | "mov.b @%0+, %2\n\t" | ||
95 | "cmp/eq %6, %0\n\t" | ||
96 | "bt/s 2f\n\t" | ||
97 | " cmp/eq #0, %3\n\t" | ||
98 | "bt/s 3f\n\t" | ||
99 | " cmp/eq %3, %2\n\t" | ||
100 | "bt/s 1b\n\t" | ||
101 | " mov.b @%1+, %3\n\t" | ||
102 | "add #-2, %1\n\t" | ||
103 | "mov.b @%1, %3\n" | ||
104 | "2:\n\t" | ||
105 | "sub %3, %2\n" | ||
106 | "3:" | ||
107 | :"=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy) | ||
108 | : "0" (__cs), "1" (__ct), "r" (__cs+__n) | ||
109 | : "t"); | ||
110 | |||
111 | return __res; | ||
112 | } | ||
113 | |||
114 | #define __HAVE_ARCH_MEMSET | ||
115 | extern void *memset(void *__s, int __c, size_t __count); | ||
116 | |||
117 | #define __HAVE_ARCH_MEMCPY | ||
118 | extern void *memcpy(void *__to, __const__ void *__from, size_t __n); | ||
119 | |||
120 | #define __HAVE_ARCH_MEMMOVE | ||
121 | extern void *memmove(void *__dest, __const__ void *__src, size_t __n); | ||
122 | |||
123 | #define __HAVE_ARCH_MEMCHR | ||
124 | extern void *memchr(const void *__s, int __c, size_t __n); | ||
125 | |||
126 | #define __HAVE_ARCH_STRLEN | ||
127 | extern size_t strlen(const char *); | ||
128 | |||
129 | #endif /* __KERNEL__ */ | ||
130 | |||
131 | #endif /* __ASM_SH_STRING_H */ | ||
diff --git a/include/asm-sh/string_32.h b/include/asm-sh/string_32.h new file mode 100644 index 000000000000..55f8db6bc1d7 --- /dev/null +++ b/include/asm-sh/string_32.h | |||
@@ -0,0 +1,131 @@ | |||
1 | #ifndef __ASM_SH_STRING_H | ||
2 | #define __ASM_SH_STRING_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | /* | ||
7 | * Copyright (C) 1999 Niibe Yutaka | ||
8 | * But consider these trivial functions to be public domain. | ||
9 | */ | ||
10 | |||
11 | #define __HAVE_ARCH_STRCPY | ||
12 | static inline char *strcpy(char *__dest, const char *__src) | ||
13 | { | ||
14 | register char *__xdest = __dest; | ||
15 | unsigned long __dummy; | ||
16 | |||
17 | __asm__ __volatile__("1:\n\t" | ||
18 | "mov.b @%1+, %2\n\t" | ||
19 | "mov.b %2, @%0\n\t" | ||
20 | "cmp/eq #0, %2\n\t" | ||
21 | "bf/s 1b\n\t" | ||
22 | " add #1, %0\n\t" | ||
23 | : "=r" (__dest), "=r" (__src), "=&z" (__dummy) | ||
24 | : "0" (__dest), "1" (__src) | ||
25 | : "memory", "t"); | ||
26 | |||
27 | return __xdest; | ||
28 | } | ||
29 | |||
30 | #define __HAVE_ARCH_STRNCPY | ||
31 | static inline char *strncpy(char *__dest, const char *__src, size_t __n) | ||
32 | { | ||
33 | register char *__xdest = __dest; | ||
34 | unsigned long __dummy; | ||
35 | |||
36 | if (__n == 0) | ||
37 | return __xdest; | ||
38 | |||
39 | __asm__ __volatile__( | ||
40 | "1:\n" | ||
41 | "mov.b @%1+, %2\n\t" | ||
42 | "mov.b %2, @%0\n\t" | ||
43 | "cmp/eq #0, %2\n\t" | ||
44 | "bt/s 2f\n\t" | ||
45 | " cmp/eq %5,%1\n\t" | ||
46 | "bf/s 1b\n\t" | ||
47 | " add #1, %0\n" | ||
48 | "2:" | ||
49 | : "=r" (__dest), "=r" (__src), "=&z" (__dummy) | ||
50 | : "0" (__dest), "1" (__src), "r" (__src+__n) | ||
51 | : "memory", "t"); | ||
52 | |||
53 | return __xdest; | ||
54 | } | ||
55 | |||
56 | #define __HAVE_ARCH_STRCMP | ||
57 | static inline int strcmp(const char *__cs, const char *__ct) | ||
58 | { | ||
59 | register int __res; | ||
60 | unsigned long __dummy; | ||
61 | |||
62 | __asm__ __volatile__( | ||
63 | "mov.b @%1+, %3\n" | ||
64 | "1:\n\t" | ||
65 | "mov.b @%0+, %2\n\t" | ||
66 | "cmp/eq #0, %3\n\t" | ||
67 | "bt 2f\n\t" | ||
68 | "cmp/eq %2, %3\n\t" | ||
69 | "bt/s 1b\n\t" | ||
70 | " mov.b @%1+, %3\n\t" | ||
71 | "add #-2, %1\n\t" | ||
72 | "mov.b @%1, %3\n\t" | ||
73 | "sub %3, %2\n" | ||
74 | "2:" | ||
75 | : "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy) | ||
76 | : "0" (__cs), "1" (__ct) | ||
77 | : "t"); | ||
78 | |||
79 | return __res; | ||
80 | } | ||
81 | |||
82 | #define __HAVE_ARCH_STRNCMP | ||
83 | static inline int strncmp(const char *__cs, const char *__ct, size_t __n) | ||
84 | { | ||
85 | register int __res; | ||
86 | unsigned long __dummy; | ||
87 | |||
88 | if (__n == 0) | ||
89 | return 0; | ||
90 | |||
91 | __asm__ __volatile__( | ||
92 | "mov.b @%1+, %3\n" | ||
93 | "1:\n\t" | ||
94 | "mov.b @%0+, %2\n\t" | ||
95 | "cmp/eq %6, %0\n\t" | ||
96 | "bt/s 2f\n\t" | ||
97 | " cmp/eq #0, %3\n\t" | ||
98 | "bt/s 3f\n\t" | ||
99 | " cmp/eq %3, %2\n\t" | ||
100 | "bt/s 1b\n\t" | ||
101 | " mov.b @%1+, %3\n\t" | ||
102 | "add #-2, %1\n\t" | ||
103 | "mov.b @%1, %3\n" | ||
104 | "2:\n\t" | ||
105 | "sub %3, %2\n" | ||
106 | "3:" | ||
107 | :"=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy) | ||
108 | : "0" (__cs), "1" (__ct), "r" (__cs+__n) | ||
109 | : "t"); | ||
110 | |||
111 | return __res; | ||
112 | } | ||
113 | |||
114 | #define __HAVE_ARCH_MEMSET | ||
115 | extern void *memset(void *__s, int __c, size_t __count); | ||
116 | |||
117 | #define __HAVE_ARCH_MEMCPY | ||
118 | extern void *memcpy(void *__to, __const__ void *__from, size_t __n); | ||
119 | |||
120 | #define __HAVE_ARCH_MEMMOVE | ||
121 | extern void *memmove(void *__dest, __const__ void *__src, size_t __n); | ||
122 | |||
123 | #define __HAVE_ARCH_MEMCHR | ||
124 | extern void *memchr(const void *__s, int __c, size_t __n); | ||
125 | |||
126 | #define __HAVE_ARCH_STRLEN | ||
127 | extern size_t strlen(const char *); | ||
128 | |||
129 | #endif /* __KERNEL__ */ | ||
130 | |||
131 | #endif /* __ASM_SH_STRING_H */ | ||
diff --git a/include/asm-sh64/string.h b/include/asm-sh/string_64.h index 8a7357366ce8..8a7357366ce8 100644 --- a/include/asm-sh64/string.h +++ b/include/asm-sh/string_64.h | |||