diff options
Diffstat (limited to 'include/asm-s390/string.h')
-rw-r--r-- | include/asm-s390/string.h | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/include/asm-s390/string.h b/include/asm-s390/string.h index 23a4c390489f..d074673a6d9b 100644 --- a/include/asm-s390/string.h +++ b/include/asm-s390/string.h | |||
@@ -60,12 +60,13 @@ static inline void *memchr(const void * s, int c, size_t n) | |||
60 | register int r0 asm("0") = (char) c; | 60 | register int r0 asm("0") = (char) c; |
61 | const void *ret = s + n; | 61 | const void *ret = s + n; |
62 | 62 | ||
63 | asm volatile ("0: srst %0,%1\n" | 63 | asm volatile( |
64 | " jo 0b\n" | 64 | "0: srst %0,%1\n" |
65 | " jl 1f\n" | 65 | " jo 0b\n" |
66 | " la %0,0\n" | 66 | " jl 1f\n" |
67 | "1:" | 67 | " la %0,0\n" |
68 | : "+a" (ret), "+&a" (s) : "d" (r0) : "cc" ); | 68 | "1:" |
69 | : "+a" (ret), "+&a" (s) : "d" (r0) : "cc"); | ||
69 | return (void *) ret; | 70 | return (void *) ret; |
70 | } | 71 | } |
71 | 72 | ||
@@ -74,9 +75,10 @@ static inline void *memscan(void *s, int c, size_t n) | |||
74 | register int r0 asm("0") = (char) c; | 75 | register int r0 asm("0") = (char) c; |
75 | const void *ret = s + n; | 76 | const void *ret = s + n; |
76 | 77 | ||
77 | asm volatile ("0: srst %0,%1\n" | 78 | asm volatile( |
78 | " jo 0b\n" | 79 | "0: srst %0,%1\n" |
79 | : "+a" (ret), "+&a" (s) : "d" (r0) : "cc" ); | 80 | " jo 0b\n" |
81 | : "+a" (ret), "+&a" (s) : "d" (r0) : "cc"); | ||
80 | return (void *) ret; | 82 | return (void *) ret; |
81 | } | 83 | } |
82 | 84 | ||
@@ -86,12 +88,13 @@ static inline char *strcat(char *dst, const char *src) | |||
86 | unsigned long dummy; | 88 | unsigned long dummy; |
87 | char *ret = dst; | 89 | char *ret = dst; |
88 | 90 | ||
89 | asm volatile ("0: srst %0,%1\n" | 91 | asm volatile( |
90 | " jo 0b\n" | 92 | "0: srst %0,%1\n" |
91 | "1: mvst %0,%2\n" | 93 | " jo 0b\n" |
92 | " jo 1b" | 94 | "1: mvst %0,%2\n" |
93 | : "=&a" (dummy), "+a" (dst), "+a" (src) | 95 | " jo 1b" |
94 | : "d" (r0), "0" (0) : "cc", "memory" ); | 96 | : "=&a" (dummy), "+a" (dst), "+a" (src) |
97 | : "d" (r0), "0" (0) : "cc", "memory" ); | ||
95 | return ret; | 98 | return ret; |
96 | } | 99 | } |
97 | 100 | ||
@@ -100,10 +103,11 @@ static inline char *strcpy(char *dst, const char *src) | |||
100 | register int r0 asm("0") = 0; | 103 | register int r0 asm("0") = 0; |
101 | char *ret = dst; | 104 | char *ret = dst; |
102 | 105 | ||
103 | asm volatile ("0: mvst %0,%1\n" | 106 | asm volatile( |
104 | " jo 0b" | 107 | "0: mvst %0,%1\n" |
105 | : "+&a" (dst), "+&a" (src) : "d" (r0) | 108 | " jo 0b" |
106 | : "cc", "memory" ); | 109 | : "+&a" (dst), "+&a" (src) : "d" (r0) |
110 | : "cc", "memory"); | ||
107 | return ret; | 111 | return ret; |
108 | } | 112 | } |
109 | 113 | ||
@@ -112,9 +116,10 @@ static inline size_t strlen(const char *s) | |||
112 | register unsigned long r0 asm("0") = 0; | 116 | register unsigned long r0 asm("0") = 0; |
113 | const char *tmp = s; | 117 | const char *tmp = s; |
114 | 118 | ||
115 | asm volatile ("0: srst %0,%1\n" | 119 | asm volatile( |
116 | " jo 0b" | 120 | "0: srst %0,%1\n" |
117 | : "+d" (r0), "+a" (tmp) : : "cc" ); | 121 | " jo 0b" |
122 | : "+d" (r0), "+a" (tmp) : : "cc"); | ||
118 | return r0 - (unsigned long) s; | 123 | return r0 - (unsigned long) s; |
119 | } | 124 | } |
120 | 125 | ||
@@ -124,9 +129,10 @@ static inline size_t strnlen(const char * s, size_t n) | |||
124 | const char *tmp = s; | 129 | const char *tmp = s; |
125 | const char *end = s + n; | 130 | const char *end = s + n; |
126 | 131 | ||
127 | asm volatile ("0: srst %0,%1\n" | 132 | asm volatile( |
128 | " jo 0b" | 133 | "0: srst %0,%1\n" |
129 | : "+a" (end), "+a" (tmp) : "d" (r0) : "cc" ); | 134 | " jo 0b" |
135 | : "+a" (end), "+a" (tmp) : "d" (r0) : "cc"); | ||
130 | return end - s; | 136 | return end - s; |
131 | } | 137 | } |
132 | 138 | ||