diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2006-09-28 10:56:43 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2006-09-28 10:56:43 -0400 |
commit | 94c12cc7d196bab34aaa98d38521549fa1e5ef76 (patch) | |
tree | 8e0cec0ed44445d74a2cb5160303d6b4dfb1bc31 /include | |
parent | 25d83cbfaa44e1b9170c0941c3ef52ca39f54ccc (diff) |
[S390] Inline assembly cleanup.
Major cleanup of all s390 inline assemblies. They now have a common
coding style. Quite a few have been shortened, mainly by using register
asm variables. Use of the EX_TABLE macro helps as well. The atomic ops,
bit ops and locking inlines new use the Q-constraint if a newer gcc
is used. That results in slightly better code.
Thanks to Christian Borntraeger for proof reading the changes.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-s390/appldata.h | 2 | ||||
-rw-r--r-- | include/asm-s390/atomic.h | 120 | ||||
-rw-r--r-- | include/asm-s390/bitops.h | 626 | ||||
-rw-r--r-- | include/asm-s390/byteorder.h | 50 | ||||
-rw-r--r-- | include/asm-s390/checksum.h | 176 | ||||
-rw-r--r-- | include/asm-s390/ebcdic.h | 20 | ||||
-rw-r--r-- | include/asm-s390/io.h | 14 | ||||
-rw-r--r-- | include/asm-s390/irqflags.h | 110 | ||||
-rw-r--r-- | include/asm-s390/lowcore.h | 2 | ||||
-rw-r--r-- | include/asm-s390/page.h | 111 | ||||
-rw-r--r-- | include/asm-s390/pgtable.h | 28 | ||||
-rw-r--r-- | include/asm-s390/processor.h | 130 | ||||
-rw-r--r-- | include/asm-s390/ptrace.h | 2 | ||||
-rw-r--r-- | include/asm-s390/rwsem.h | 238 | ||||
-rw-r--r-- | include/asm-s390/semaphore.h | 16 | ||||
-rw-r--r-- | include/asm-s390/sfp-machine.h | 64 | ||||
-rw-r--r-- | include/asm-s390/sigp.h | 65 | ||||
-rw-r--r-- | include/asm-s390/smp.h | 2 | ||||
-rw-r--r-- | include/asm-s390/spinlock.h | 27 | ||||
-rw-r--r-- | include/asm-s390/string.h | 56 | ||||
-rw-r--r-- | include/asm-s390/system.h | 342 | ||||
-rw-r--r-- | include/asm-s390/timex.h | 19 | ||||
-rw-r--r-- | include/asm-s390/tlbflush.h | 32 | ||||
-rw-r--r-- | include/asm-s390/uaccess.h | 13 | ||||
-rw-r--r-- | include/asm-s390/unistd.h | 258 |
25 files changed, 1209 insertions, 1314 deletions
diff --git a/include/asm-s390/appldata.h b/include/asm-s390/appldata.h index b1770703b706..79283dac8281 100644 --- a/include/asm-s390/appldata.h +++ b/include/asm-s390/appldata.h | |||
@@ -80,7 +80,7 @@ static inline int appldata_asm(struct appldata_product_id *id, | |||
80 | parm_list.product_id_addr = (unsigned long) id; | 80 | parm_list.product_id_addr = (unsigned long) id; |
81 | parm_list.buffer_addr = virt_to_phys(buffer); | 81 | parm_list.buffer_addr = virt_to_phys(buffer); |
82 | asm volatile( | 82 | asm volatile( |
83 | "diag %1,%0,0xdc" | 83 | " diag %1,%0,0xdc" |
84 | : "=d" (ry) | 84 | : "=d" (ry) |
85 | : "d" (&parm_list), "m" (parm_list), "m" (*id) | 85 | : "d" (&parm_list), "m" (parm_list), "m" (*id) |
86 | : "cc"); | 86 | : "cc"); |
diff --git a/include/asm-s390/atomic.h b/include/asm-s390/atomic.h index 399bf02894dd..af20c7462485 100644 --- a/include/asm-s390/atomic.h +++ b/include/asm-s390/atomic.h | |||
@@ -30,20 +30,43 @@ typedef struct { | |||
30 | 30 | ||
31 | #ifdef __KERNEL__ | 31 | #ifdef __KERNEL__ |
32 | 32 | ||
33 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) | ||
34 | |||
33 | #define __CS_LOOP(ptr, op_val, op_string) ({ \ | 35 | #define __CS_LOOP(ptr, op_val, op_string) ({ \ |
34 | typeof(ptr->counter) old_val, new_val; \ | 36 | typeof(ptr->counter) old_val, new_val; \ |
35 | __asm__ __volatile__(" l %0,0(%3)\n" \ | 37 | asm volatile( \ |
36 | "0: lr %1,%0\n" \ | 38 | " l %0,%2\n" \ |
37 | op_string " %1,%4\n" \ | 39 | "0: lr %1,%0\n" \ |
38 | " cs %0,%1,0(%3)\n" \ | 40 | op_string " %1,%3\n" \ |
39 | " jl 0b" \ | 41 | " cs %0,%1,%2\n" \ |
40 | : "=&d" (old_val), "=&d" (new_val), \ | 42 | " jl 0b" \ |
41 | "=m" (((atomic_t *)(ptr))->counter) \ | 43 | : "=&d" (old_val), "=&d" (new_val), \ |
42 | : "a" (ptr), "d" (op_val), \ | 44 | "=Q" (((atomic_t *)(ptr))->counter) \ |
43 | "m" (((atomic_t *)(ptr))->counter) \ | 45 | : "d" (op_val), "Q" (((atomic_t *)(ptr))->counter) \ |
44 | : "cc", "memory" ); \ | 46 | : "cc", "memory"); \ |
45 | new_val; \ | 47 | new_val; \ |
46 | }) | 48 | }) |
49 | |||
50 | #else /* __GNUC__ */ | ||
51 | |||
52 | #define __CS_LOOP(ptr, op_val, op_string) ({ \ | ||
53 | typeof(ptr->counter) old_val, new_val; \ | ||
54 | asm volatile( \ | ||
55 | " l %0,0(%3)\n" \ | ||
56 | "0: lr %1,%0\n" \ | ||
57 | op_string " %1,%4\n" \ | ||
58 | " cs %0,%1,0(%3)\n" \ | ||
59 | " jl 0b" \ | ||
60 | : "=&d" (old_val), "=&d" (new_val), \ | ||
61 | "=m" (((atomic_t *)(ptr))->counter) \ | ||
62 | : "a" (ptr), "d" (op_val), \ | ||
63 | "m" (((atomic_t *)(ptr))->counter) \ | ||
64 | : "cc", "memory"); \ | ||
65 | new_val; \ | ||
66 | }) | ||
67 | |||
68 | #endif /* __GNUC__ */ | ||
69 | |||
47 | #define atomic_read(v) ((v)->counter) | 70 | #define atomic_read(v) ((v)->counter) |
48 | #define atomic_set(v,i) (((v)->counter) = (i)) | 71 | #define atomic_set(v,i) (((v)->counter) = (i)) |
49 | 72 | ||
@@ -81,10 +104,19 @@ static __inline__ void atomic_set_mask(unsigned long mask, atomic_t * v) | |||
81 | 104 | ||
82 | static __inline__ int atomic_cmpxchg(atomic_t *v, int old, int new) | 105 | static __inline__ int atomic_cmpxchg(atomic_t *v, int old, int new) |
83 | { | 106 | { |
84 | __asm__ __volatile__(" cs %0,%3,0(%2)\n" | 107 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) |
85 | : "+d" (old), "=m" (v->counter) | 108 | asm volatile( |
86 | : "a" (v), "d" (new), "m" (v->counter) | 109 | " cs %0,%2,%1" |
87 | : "cc", "memory" ); | 110 | : "+d" (old), "=Q" (v->counter) |
111 | : "d" (new), "Q" (v->counter) | ||
112 | : "cc", "memory"); | ||
113 | #else /* __GNUC__ */ | ||
114 | asm volatile( | ||
115 | " cs %0,%3,0(%2)" | ||
116 | : "+d" (old), "=m" (v->counter) | ||
117 | : "a" (v), "d" (new), "m" (v->counter) | ||
118 | : "cc", "memory"); | ||
119 | #endif /* __GNUC__ */ | ||
88 | return old; | 120 | return old; |
89 | } | 121 | } |
90 | 122 | ||
@@ -113,20 +145,43 @@ typedef struct { | |||
113 | } __attribute__ ((aligned (8))) atomic64_t; | 145 | } __attribute__ ((aligned (8))) atomic64_t; |
114 | #define ATOMIC64_INIT(i) { (i) } | 146 | #define ATOMIC64_INIT(i) { (i) } |
115 | 147 | ||
148 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) | ||
149 | |||
116 | #define __CSG_LOOP(ptr, op_val, op_string) ({ \ | 150 | #define __CSG_LOOP(ptr, op_val, op_string) ({ \ |
117 | typeof(ptr->counter) old_val, new_val; \ | 151 | typeof(ptr->counter) old_val, new_val; \ |
118 | __asm__ __volatile__(" lg %0,0(%3)\n" \ | 152 | asm volatile( \ |
119 | "0: lgr %1,%0\n" \ | 153 | " lg %0,%2\n" \ |
120 | op_string " %1,%4\n" \ | 154 | "0: lgr %1,%0\n" \ |
121 | " csg %0,%1,0(%3)\n" \ | 155 | op_string " %1,%3\n" \ |
122 | " jl 0b" \ | 156 | " csg %0,%1,%2\n" \ |
123 | : "=&d" (old_val), "=&d" (new_val), \ | 157 | " jl 0b" \ |
124 | "=m" (((atomic_t *)(ptr))->counter) \ | 158 | : "=&d" (old_val), "=&d" (new_val), \ |
125 | : "a" (ptr), "d" (op_val), \ | 159 | "=Q" (((atomic_t *)(ptr))->counter) \ |
126 | "m" (((atomic_t *)(ptr))->counter) \ | 160 | : "d" (op_val), "Q" (((atomic_t *)(ptr))->counter) \ |
127 | : "cc", "memory" ); \ | 161 | : "cc", "memory" ); \ |
128 | new_val; \ | 162 | new_val; \ |
129 | }) | 163 | }) |
164 | |||
165 | #else /* __GNUC__ */ | ||
166 | |||
167 | #define __CSG_LOOP(ptr, op_val, op_string) ({ \ | ||
168 | typeof(ptr->counter) old_val, new_val; \ | ||
169 | asm volatile( \ | ||
170 | " lg %0,0(%3)\n" \ | ||
171 | "0: lgr %1,%0\n" \ | ||
172 | op_string " %1,%4\n" \ | ||
173 | " csg %0,%1,0(%3)\n" \ | ||
174 | " jl 0b" \ | ||
175 | : "=&d" (old_val), "=&d" (new_val), \ | ||
176 | "=m" (((atomic_t *)(ptr))->counter) \ | ||
177 | : "a" (ptr), "d" (op_val), \ | ||
178 | "m" (((atomic_t *)(ptr))->counter) \ | ||
179 | : "cc", "memory" ); \ | ||
180 | new_val; \ | ||
181 | }) | ||
182 | |||
183 | #endif /* __GNUC__ */ | ||
184 | |||
130 | #define atomic64_read(v) ((v)->counter) | 185 | #define atomic64_read(v) ((v)->counter) |
131 | #define atomic64_set(v,i) (((v)->counter) = (i)) | 186 | #define atomic64_set(v,i) (((v)->counter) = (i)) |
132 | 187 | ||
@@ -163,10 +218,19 @@ static __inline__ void atomic64_set_mask(unsigned long mask, atomic64_t * v) | |||
163 | static __inline__ long long atomic64_cmpxchg(atomic64_t *v, | 218 | static __inline__ long long atomic64_cmpxchg(atomic64_t *v, |
164 | long long old, long long new) | 219 | long long old, long long new) |
165 | { | 220 | { |
166 | __asm__ __volatile__(" csg %0,%3,0(%2)\n" | 221 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) |
167 | : "+d" (old), "=m" (v->counter) | 222 | asm volatile( |
168 | : "a" (v), "d" (new), "m" (v->counter) | 223 | " csg %0,%2,%1" |
169 | : "cc", "memory" ); | 224 | : "+d" (old), "=Q" (v->counter) |
225 | : "d" (new), "Q" (v->counter) | ||
226 | : "cc", "memory"); | ||
227 | #else /* __GNUC__ */ | ||
228 | asm volatile( | ||
229 | " csg %0,%3,0(%2)" | ||
230 | : "+d" (old), "=m" (v->counter) | ||
231 | : "a" (v), "d" (new), "m" (v->counter) | ||
232 | : "cc", "memory"); | ||
233 | #endif /* __GNUC__ */ | ||
170 | return old; | 234 | return old; |
171 | } | 235 | } |
172 | 236 | ||
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h index 0ddcdba79e4a..f79c9b792af1 100644 --- a/include/asm-s390/bitops.h +++ b/include/asm-s390/bitops.h | |||
@@ -67,16 +67,35 @@ extern const char _sb_findmap[]; | |||
67 | #define __BITOPS_AND "nr" | 67 | #define __BITOPS_AND "nr" |
68 | #define __BITOPS_XOR "xr" | 68 | #define __BITOPS_XOR "xr" |
69 | 69 | ||
70 | #define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \ | 70 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) |
71 | __asm__ __volatile__(" l %0,0(%4)\n" \ | 71 | |
72 | "0: lr %1,%0\n" \ | 72 | #define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \ |
73 | __op_string " %1,%3\n" \ | 73 | asm volatile( \ |
74 | " cs %0,%1,0(%4)\n" \ | 74 | " l %0,%2\n" \ |
75 | " jl 0b" \ | 75 | "0: lr %1,%0\n" \ |
76 | : "=&d" (__old), "=&d" (__new), \ | 76 | __op_string " %1,%3\n" \ |
77 | "=m" (*(unsigned long *) __addr) \ | 77 | " cs %0,%1,%2\n" \ |
78 | : "d" (__val), "a" (__addr), \ | 78 | " jl 0b" \ |
79 | "m" (*(unsigned long *) __addr) : "cc" ); | 79 | : "=&d" (__old), "=&d" (__new), \ |
80 | "=Q" (*(unsigned long *) __addr) \ | ||
81 | : "d" (__val), "Q" (*(unsigned long *) __addr) \ | ||
82 | : "cc"); | ||
83 | |||
84 | #else /* __GNUC__ */ | ||
85 | |||
86 | #define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \ | ||
87 | asm volatile( \ | ||
88 | " l %0,0(%4)\n" \ | ||
89 | "0: lr %1,%0\n" \ | ||
90 | __op_string " %1,%3\n" \ | ||
91 | " cs %0,%1,0(%4)\n" \ | ||
92 | " jl 0b" \ | ||
93 | : "=&d" (__old), "=&d" (__new), \ | ||
94 | "=m" (*(unsigned long *) __addr) \ | ||
95 | : "d" (__val), "a" (__addr), \ | ||
96 | "m" (*(unsigned long *) __addr) : "cc"); | ||
97 | |||
98 | #endif /* __GNUC__ */ | ||
80 | 99 | ||
81 | #else /* __s390x__ */ | 100 | #else /* __s390x__ */ |
82 | 101 | ||
@@ -86,21 +105,41 @@ extern const char _sb_findmap[]; | |||
86 | #define __BITOPS_AND "ngr" | 105 | #define __BITOPS_AND "ngr" |
87 | #define __BITOPS_XOR "xgr" | 106 | #define __BITOPS_XOR "xgr" |
88 | 107 | ||
89 | #define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \ | 108 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) |
90 | __asm__ __volatile__(" lg %0,0(%4)\n" \ | 109 | |
91 | "0: lgr %1,%0\n" \ | 110 | #define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \ |
92 | __op_string " %1,%3\n" \ | 111 | asm volatile( \ |
93 | " csg %0,%1,0(%4)\n" \ | 112 | " lg %0,%2\n" \ |
94 | " jl 0b" \ | 113 | "0: lgr %1,%0\n" \ |
95 | : "=&d" (__old), "=&d" (__new), \ | 114 | __op_string " %1,%3\n" \ |
96 | "=m" (*(unsigned long *) __addr) \ | 115 | " csg %0,%1,%2\n" \ |
97 | : "d" (__val), "a" (__addr), \ | 116 | " jl 0b" \ |
98 | "m" (*(unsigned long *) __addr) : "cc" ); | 117 | : "=&d" (__old), "=&d" (__new), \ |
118 | "=Q" (*(unsigned long *) __addr) \ | ||
119 | : "d" (__val), "Q" (*(unsigned long *) __addr) \ | ||
120 | : "cc"); | ||
121 | |||
122 | #else /* __GNUC__ */ | ||
123 | |||
124 | #define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \ | ||
125 | asm volatile( \ | ||
126 | " lg %0,0(%4)\n" \ | ||
127 | "0: lgr %1,%0\n" \ | ||
128 | __op_string " %1,%3\n" \ | ||
129 | " csg %0,%1,0(%4)\n" \ | ||
130 | " jl 0b" \ | ||
131 | : "=&d" (__old), "=&d" (__new), \ | ||
132 | "=m" (*(unsigned long *) __addr) \ | ||
133 | : "d" (__val), "a" (__addr), \ | ||
134 | "m" (*(unsigned long *) __addr) : "cc"); | ||
135 | |||
136 | |||
137 | #endif /* __GNUC__ */ | ||
99 | 138 | ||
100 | #endif /* __s390x__ */ | 139 | #endif /* __s390x__ */ |
101 | 140 | ||
102 | #define __BITOPS_WORDS(bits) (((bits)+__BITOPS_WORDSIZE-1)/__BITOPS_WORDSIZE) | 141 | #define __BITOPS_WORDS(bits) (((bits)+__BITOPS_WORDSIZE-1)/__BITOPS_WORDSIZE) |
103 | #define __BITOPS_BARRIER() __asm__ __volatile__ ( "" : : : "memory" ) | 142 | #define __BITOPS_BARRIER() asm volatile("" : : : "memory") |
104 | 143 | ||
105 | #ifdef CONFIG_SMP | 144 | #ifdef CONFIG_SMP |
106 | /* | 145 | /* |
@@ -217,10 +256,10 @@ static inline void __set_bit(unsigned long nr, volatile unsigned long *ptr) | |||
217 | unsigned long addr; | 256 | unsigned long addr; |
218 | 257 | ||
219 | addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); | 258 | addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); |
220 | asm volatile("oc 0(1,%1),0(%2)" | 259 | asm volatile( |
221 | : "=m" (*(char *) addr) | 260 | " oc 0(1,%1),0(%2)" |
222 | : "a" (addr), "a" (_oi_bitmap + (nr & 7)), | 261 | : "=m" (*(char *) addr) : "a" (addr), |
223 | "m" (*(char *) addr) : "cc" ); | 262 | "a" (_oi_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc" ); |
224 | } | 263 | } |
225 | 264 | ||
226 | static inline void | 265 | static inline void |
@@ -229,40 +268,7 @@ __constant_set_bit(const unsigned long nr, volatile unsigned long *ptr) | |||
229 | unsigned long addr; | 268 | unsigned long addr; |
230 | 269 | ||
231 | addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); | 270 | addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); |
232 | switch (nr&7) { | 271 | *(unsigned char *) addr |= 1 << (nr & 7); |
233 | case 0: | ||
234 | asm volatile ("oi 0(%1),0x01" : "=m" (*(char *) addr) | ||
235 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
236 | break; | ||
237 | case 1: | ||
238 | asm volatile ("oi 0(%1),0x02" : "=m" (*(char *) addr) | ||
239 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
240 | break; | ||
241 | case 2: | ||
242 | asm volatile ("oi 0(%1),0x04" : "=m" (*(char *) addr) | ||
243 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
244 | break; | ||
245 | case 3: | ||
246 | asm volatile ("oi 0(%1),0x08" : "=m" (*(char *) addr) | ||
247 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
248 | break; | ||
249 | case 4: | ||
250 | asm volatile ("oi 0(%1),0x10" : "=m" (*(char *) addr) | ||
251 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
252 | break; | ||
253 | case 5: | ||
254 | asm volatile ("oi 0(%1),0x20" : "=m" (*(char *) addr) | ||
255 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
256 | break; | ||
257 | case 6: | ||
258 | asm volatile ("oi 0(%1),0x40" : "=m" (*(char *) addr) | ||
259 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
260 | break; | ||
261 | case 7: | ||
262 | asm volatile ("oi 0(%1),0x80" : "=m" (*(char *) addr) | ||
263 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
264 | break; | ||
265 | } | ||
266 | } | 272 | } |
267 | 273 | ||
268 | #define set_bit_simple(nr,addr) \ | 274 | #define set_bit_simple(nr,addr) \ |
@@ -279,10 +285,10 @@ __clear_bit(unsigned long nr, volatile unsigned long *ptr) | |||
279 | unsigned long addr; | 285 | unsigned long addr; |
280 | 286 | ||
281 | addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); | 287 | addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); |
282 | asm volatile("nc 0(1,%1),0(%2)" | 288 | asm volatile( |
283 | : "=m" (*(char *) addr) | 289 | " nc 0(1,%1),0(%2)" |
284 | : "a" (addr), "a" (_ni_bitmap + (nr & 7)), | 290 | : "=m" (*(char *) addr) : "a" (addr), |
285 | "m" (*(char *) addr) : "cc" ); | 291 | "a" (_ni_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc"); |
286 | } | 292 | } |
287 | 293 | ||
288 | static inline void | 294 | static inline void |
@@ -291,40 +297,7 @@ __constant_clear_bit(const unsigned long nr, volatile unsigned long *ptr) | |||
291 | unsigned long addr; | 297 | unsigned long addr; |
292 | 298 | ||
293 | addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); | 299 | addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); |
294 | switch (nr&7) { | 300 | *(unsigned char *) addr &= ~(1 << (nr & 7)); |
295 | case 0: | ||
296 | asm volatile ("ni 0(%1),0xFE" : "=m" (*(char *) addr) | ||
297 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
298 | break; | ||
299 | case 1: | ||
300 | asm volatile ("ni 0(%1),0xFD": "=m" (*(char *) addr) | ||
301 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
302 | break; | ||
303 | case 2: | ||
304 | asm volatile ("ni 0(%1),0xFB" : "=m" (*(char *) addr) | ||
305 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
306 | break; | ||
307 | case 3: | ||
308 | asm volatile ("ni 0(%1),0xF7" : "=m" (*(char *) addr) | ||
309 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
310 | break; | ||
311 | case 4: | ||
312 | asm volatile ("ni 0(%1),0xEF" : "=m" (*(char *) addr) | ||
313 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
314 | break; | ||
315 | case 5: | ||
316 | asm volatile ("ni 0(%1),0xDF" : "=m" (*(char *) addr) | ||
317 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
318 | break; | ||
319 | case 6: | ||
320 | asm volatile ("ni 0(%1),0xBF" : "=m" (*(char *) addr) | ||
321 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
322 | break; | ||
323 | case 7: | ||
324 | asm volatile ("ni 0(%1),0x7F" : "=m" (*(char *) addr) | ||
325 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
326 | break; | ||
327 | } | ||
328 | } | 301 | } |
329 | 302 | ||
330 | #define clear_bit_simple(nr,addr) \ | 303 | #define clear_bit_simple(nr,addr) \ |
@@ -340,10 +313,10 @@ static inline void __change_bit(unsigned long nr, volatile unsigned long *ptr) | |||
340 | unsigned long addr; | 313 | unsigned long addr; |
341 | 314 | ||
342 | addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); | 315 | addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); |
343 | asm volatile("xc 0(1,%1),0(%2)" | 316 | asm volatile( |
344 | : "=m" (*(char *) addr) | 317 | " xc 0(1,%1),0(%2)" |
345 | : "a" (addr), "a" (_oi_bitmap + (nr & 7)), | 318 | : "=m" (*(char *) addr) : "a" (addr), |
346 | "m" (*(char *) addr) : "cc" ); | 319 | "a" (_oi_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc" ); |
347 | } | 320 | } |
348 | 321 | ||
349 | static inline void | 322 | static inline void |
@@ -352,40 +325,7 @@ __constant_change_bit(const unsigned long nr, volatile unsigned long *ptr) | |||
352 | unsigned long addr; | 325 | unsigned long addr; |
353 | 326 | ||
354 | addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); | 327 | addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); |
355 | switch (nr&7) { | 328 | *(unsigned char *) addr ^= 1 << (nr & 7); |
356 | case 0: | ||
357 | asm volatile ("xi 0(%1),0x01" : "=m" (*(char *) addr) | ||
358 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
359 | break; | ||
360 | case 1: | ||
361 | asm volatile ("xi 0(%1),0x02" : "=m" (*(char *) addr) | ||
362 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
363 | break; | ||
364 | case 2: | ||
365 | asm volatile ("xi 0(%1),0x04" : "=m" (*(char *) addr) | ||
366 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
367 | break; | ||
368 | case 3: | ||
369 | asm volatile ("xi 0(%1),0x08" : "=m" (*(char *) addr) | ||
370 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
371 | break; | ||
372 | case 4: | ||
373 | asm volatile ("xi 0(%1),0x10" : "=m" (*(char *) addr) | ||
374 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
375 | break; | ||
376 | case 5: | ||
377 | asm volatile ("xi 0(%1),0x20" : "=m" (*(char *) addr) | ||
378 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
379 | break; | ||
380 | case 6: | ||
381 | asm volatile ("xi 0(%1),0x40" : "=m" (*(char *) addr) | ||
382 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
383 | break; | ||
384 | case 7: | ||
385 | asm volatile ("xi 0(%1),0x80" : "=m" (*(char *) addr) | ||
386 | : "a" (addr), "m" (*(char *) addr) : "cc" ); | ||
387 | break; | ||
388 | } | ||
389 | } | 329 | } |
390 | 330 | ||
391 | #define change_bit_simple(nr,addr) \ | 331 | #define change_bit_simple(nr,addr) \ |
@@ -404,10 +344,11 @@ test_and_set_bit_simple(unsigned long nr, volatile unsigned long *ptr) | |||
404 | 344 | ||
405 | addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); | 345 | addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); |
406 | ch = *(unsigned char *) addr; | 346 | ch = *(unsigned char *) addr; |
407 | asm volatile("oc 0(1,%1),0(%2)" | 347 | asm volatile( |
408 | : "=m" (*(char *) addr) | 348 | " oc 0(1,%1),0(%2)" |
409 | : "a" (addr), "a" (_oi_bitmap + (nr & 7)), | 349 | : "=m" (*(char *) addr) |
410 | "m" (*(char *) addr) : "cc", "memory" ); | 350 | : "a" (addr), "a" (_oi_bitmap + (nr & 7)), |
351 | "m" (*(char *) addr) : "cc", "memory"); | ||
411 | return (ch >> (nr & 7)) & 1; | 352 | return (ch >> (nr & 7)) & 1; |
412 | } | 353 | } |
413 | #define __test_and_set_bit(X,Y) test_and_set_bit_simple(X,Y) | 354 | #define __test_and_set_bit(X,Y) test_and_set_bit_simple(X,Y) |
@@ -423,10 +364,11 @@ test_and_clear_bit_simple(unsigned long nr, volatile unsigned long *ptr) | |||
423 | 364 | ||
424 | addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); | 365 | addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); |
425 | ch = *(unsigned char *) addr; | 366 | ch = *(unsigned char *) addr; |
426 | asm volatile("nc 0(1,%1),0(%2)" | 367 | asm volatile( |
427 | : "=m" (*(char *) addr) | 368 | " nc 0(1,%1),0(%2)" |
428 | : "a" (addr), "a" (_ni_bitmap + (nr & 7)), | 369 | : "=m" (*(char *) addr) |
429 | "m" (*(char *) addr) : "cc", "memory" ); | 370 | : "a" (addr), "a" (_ni_bitmap + (nr & 7)), |
371 | "m" (*(char *) addr) : "cc", "memory"); | ||
430 | return (ch >> (nr & 7)) & 1; | 372 | return (ch >> (nr & 7)) & 1; |
431 | } | 373 | } |
432 | #define __test_and_clear_bit(X,Y) test_and_clear_bit_simple(X,Y) | 374 | #define __test_and_clear_bit(X,Y) test_and_clear_bit_simple(X,Y) |
@@ -442,10 +384,11 @@ test_and_change_bit_simple(unsigned long nr, volatile unsigned long *ptr) | |||
442 | 384 | ||
443 | addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); | 385 | addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); |
444 | ch = *(unsigned char *) addr; | 386 | ch = *(unsigned char *) addr; |
445 | asm volatile("xc 0(1,%1),0(%2)" | 387 | asm volatile( |
446 | : "=m" (*(char *) addr) | 388 | " xc 0(1,%1),0(%2)" |
447 | : "a" (addr), "a" (_oi_bitmap + (nr & 7)), | 389 | : "=m" (*(char *) addr) |
448 | "m" (*(char *) addr) : "cc", "memory" ); | 390 | : "a" (addr), "a" (_oi_bitmap + (nr & 7)), |
391 | "m" (*(char *) addr) : "cc", "memory"); | ||
449 | return (ch >> (nr & 7)) & 1; | 392 | return (ch >> (nr & 7)) & 1; |
450 | } | 393 | } |
451 | #define __test_and_change_bit(X,Y) test_and_change_bit_simple(X,Y) | 394 | #define __test_and_change_bit(X,Y) test_and_change_bit_simple(X,Y) |
@@ -557,35 +500,36 @@ find_first_zero_bit(const unsigned long * addr, unsigned long size) | |||
557 | 500 | ||
558 | if (!size) | 501 | if (!size) |
559 | return 0; | 502 | return 0; |
560 | __asm__(" lhi %1,-1\n" | 503 | asm volatile( |
561 | " lr %2,%3\n" | 504 | " lhi %1,-1\n" |
562 | " slr %0,%0\n" | 505 | " lr %2,%3\n" |
563 | " ahi %2,31\n" | 506 | " slr %0,%0\n" |
564 | " srl %2,5\n" | 507 | " ahi %2,31\n" |
565 | "0: c %1,0(%0,%4)\n" | 508 | " srl %2,5\n" |
566 | " jne 1f\n" | 509 | "0: c %1,0(%0,%4)\n" |
567 | " la %0,4(%0)\n" | 510 | " jne 1f\n" |
568 | " brct %2,0b\n" | 511 | " la %0,4(%0)\n" |
569 | " lr %0,%3\n" | 512 | " brct %2,0b\n" |
570 | " j 4f\n" | 513 | " lr %0,%3\n" |
571 | "1: l %2,0(%0,%4)\n" | 514 | " j 4f\n" |
572 | " sll %0,3\n" | 515 | "1: l %2,0(%0,%4)\n" |
573 | " lhi %1,0xff\n" | 516 | " sll %0,3\n" |
574 | " tml %2,0xffff\n" | 517 | " lhi %1,0xff\n" |
575 | " jno 2f\n" | 518 | " tml %2,0xffff\n" |
576 | " ahi %0,16\n" | 519 | " jno 2f\n" |
577 | " srl %2,16\n" | 520 | " ahi %0,16\n" |
578 | "2: tml %2,0x00ff\n" | 521 | " srl %2,16\n" |
579 | " jno 3f\n" | 522 | "2: tml %2,0x00ff\n" |
580 | " ahi %0,8\n" | 523 | " jno 3f\n" |
581 | " srl %2,8\n" | 524 | " ahi %0,8\n" |
582 | "3: nr %2,%1\n" | 525 | " srl %2,8\n" |
583 | " ic %2,0(%2,%5)\n" | 526 | "3: nr %2,%1\n" |
584 | " alr %0,%2\n" | 527 | " ic %2,0(%2,%5)\n" |
585 | "4:" | 528 | " alr %0,%2\n" |
586 | : "=&a" (res), "=&d" (cmp), "=&a" (count) | 529 | "4:" |
587 | : "a" (size), "a" (addr), "a" (&_zb_findmap), | 530 | : "=&a" (res), "=&d" (cmp), "=&a" (count) |
588 | "m" (*(addrtype *) addr) : "cc" ); | 531 | : "a" (size), "a" (addr), "a" (&_zb_findmap), |
532 | "m" (*(addrtype *) addr) : "cc"); | ||
589 | return (res < size) ? res : size; | 533 | return (res < size) ? res : size; |
590 | } | 534 | } |
591 | 535 | ||
@@ -598,35 +542,36 @@ find_first_bit(const unsigned long * addr, unsigned long size) | |||
598 | 542 | ||
599 | if (!size) | 543 | if (!size) |
600 | return 0; | 544 | return 0; |
601 | __asm__(" slr %1,%1\n" | 545 | asm volatile( |
602 | " lr %2,%3\n" | 546 | " slr %1,%1\n" |
603 | " slr %0,%0\n" | 547 | " lr %2,%3\n" |
604 | " ahi %2,31\n" | 548 | " slr %0,%0\n" |
605 | " srl %2,5\n" | 549 | " ahi %2,31\n" |
606 | "0: c %1,0(%0,%4)\n" | 550 | " srl %2,5\n" |
607 | " jne 1f\n" | 551 | "0: c %1,0(%0,%4)\n" |
608 | " la %0,4(%0)\n" | 552 | " jne 1f\n" |
609 | " brct %2,0b\n" | 553 | " la %0,4(%0)\n" |
610 | " lr %0,%3\n" | 554 | " brct %2,0b\n" |
611 | " j 4f\n" | 555 | " lr %0,%3\n" |
612 | "1: l %2,0(%0,%4)\n" | 556 | " j 4f\n" |
613 | " sll %0,3\n" | 557 | "1: l %2,0(%0,%4)\n" |
614 | " lhi %1,0xff\n" | 558 | " sll %0,3\n" |
615 | " tml %2,0xffff\n" | 559 | " lhi %1,0xff\n" |
616 | " jnz 2f\n" | 560 | " tml %2,0xffff\n" |
617 | " ahi %0,16\n" | 561 | " jnz 2f\n" |
618 | " srl %2,16\n" | 562 | " ahi %0,16\n" |
619 | "2: tml %2,0x00ff\n" | 563 | " srl %2,16\n" |
620 | " jnz 3f\n" | 564 | "2: tml %2,0x00ff\n" |
621 | " ahi %0,8\n" | 565 | " jnz 3f\n" |
622 | " srl %2,8\n" | 566 | " ahi %0,8\n" |
623 | "3: nr %2,%1\n" | 567 | " srl %2,8\n" |
624 | " ic %2,0(%2,%5)\n" | 568 | "3: nr %2,%1\n" |
625 | " alr %0,%2\n" | 569 | " ic %2,0(%2,%5)\n" |
626 | "4:" | 570 | " alr %0,%2\n" |
627 | : "=&a" (res), "=&d" (cmp), "=&a" (count) | 571 | "4:" |
628 | : "a" (size), "a" (addr), "a" (&_sb_findmap), | 572 | : "=&a" (res), "=&d" (cmp), "=&a" (count) |
629 | "m" (*(addrtype *) addr) : "cc" ); | 573 | : "a" (size), "a" (addr), "a" (&_sb_findmap), |
574 | "m" (*(addrtype *) addr) : "cc"); | ||
630 | return (res < size) ? res : size; | 575 | return (res < size) ? res : size; |
631 | } | 576 | } |
632 | 577 | ||
@@ -640,39 +585,40 @@ find_first_zero_bit(const unsigned long * addr, unsigned long size) | |||
640 | 585 | ||
641 | if (!size) | 586 | if (!size) |
642 | return 0; | 587 | return 0; |
643 | __asm__(" lghi %1,-1\n" | 588 | asm volatile( |
644 | " lgr %2,%3\n" | 589 | " lghi %1,-1\n" |
645 | " slgr %0,%0\n" | 590 | " lgr %2,%3\n" |
646 | " aghi %2,63\n" | 591 | " slgr %0,%0\n" |
647 | " srlg %2,%2,6\n" | 592 | " aghi %2,63\n" |
648 | "0: cg %1,0(%0,%4)\n" | 593 | " srlg %2,%2,6\n" |
649 | " jne 1f\n" | 594 | "0: cg %1,0(%0,%4)\n" |
650 | " la %0,8(%0)\n" | 595 | " jne 1f\n" |
651 | " brct %2,0b\n" | 596 | " la %0,8(%0)\n" |
652 | " lgr %0,%3\n" | 597 | " brct %2,0b\n" |
653 | " j 5f\n" | 598 | " lgr %0,%3\n" |
654 | "1: lg %2,0(%0,%4)\n" | 599 | " j 5f\n" |
655 | " sllg %0,%0,3\n" | 600 | "1: lg %2,0(%0,%4)\n" |
656 | " clr %2,%1\n" | 601 | " sllg %0,%0,3\n" |
657 | " jne 2f\n" | 602 | " clr %2,%1\n" |
658 | " aghi %0,32\n" | 603 | " jne 2f\n" |
659 | " srlg %2,%2,32\n" | 604 | " aghi %0,32\n" |
660 | "2: lghi %1,0xff\n" | 605 | " srlg %2,%2,32\n" |
661 | " tmll %2,0xffff\n" | 606 | "2: lghi %1,0xff\n" |
662 | " jno 3f\n" | 607 | " tmll %2,0xffff\n" |
663 | " aghi %0,16\n" | 608 | " jno 3f\n" |
664 | " srl %2,16\n" | 609 | " aghi %0,16\n" |
665 | "3: tmll %2,0x00ff\n" | 610 | " srl %2,16\n" |
666 | " jno 4f\n" | 611 | "3: tmll %2,0x00ff\n" |
667 | " aghi %0,8\n" | 612 | " jno 4f\n" |
668 | " srl %2,8\n" | 613 | " aghi %0,8\n" |
669 | "4: ngr %2,%1\n" | 614 | " srl %2,8\n" |
670 | " ic %2,0(%2,%5)\n" | 615 | "4: ngr %2,%1\n" |
671 | " algr %0,%2\n" | 616 | " ic %2,0(%2,%5)\n" |
672 | "5:" | 617 | " algr %0,%2\n" |
673 | : "=&a" (res), "=&d" (cmp), "=&a" (count) | 618 | "5:" |
619 | : "=&a" (res), "=&d" (cmp), "=&a" (count) | ||
674 | : "a" (size), "a" (addr), "a" (&_zb_findmap), | 620 | : "a" (size), "a" (addr), "a" (&_zb_findmap), |
675 | "m" (*(addrtype *) addr) : "cc" ); | 621 | "m" (*(addrtype *) addr) : "cc"); |
676 | return (res < size) ? res : size; | 622 | return (res < size) ? res : size; |
677 | } | 623 | } |
678 | 624 | ||
@@ -684,39 +630,40 @@ find_first_bit(const unsigned long * addr, unsigned long size) | |||
684 | 630 | ||
685 | if (!size) | 631 | if (!size) |
686 | return 0; | 632 | return 0; |
687 | __asm__(" slgr %1,%1\n" | 633 | asm volatile( |
688 | " lgr %2,%3\n" | 634 | " slgr %1,%1\n" |
689 | " slgr %0,%0\n" | 635 | " lgr %2,%3\n" |
690 | " aghi %2,63\n" | 636 | " slgr %0,%0\n" |
691 | " srlg %2,%2,6\n" | 637 | " aghi %2,63\n" |
692 | "0: cg %1,0(%0,%4)\n" | 638 | " srlg %2,%2,6\n" |
693 | " jne 1f\n" | 639 | "0: cg %1,0(%0,%4)\n" |
694 | " aghi %0,8\n" | 640 | " jne 1f\n" |
695 | " brct %2,0b\n" | 641 | " aghi %0,8\n" |
696 | " lgr %0,%3\n" | 642 | " brct %2,0b\n" |
697 | " j 5f\n" | 643 | " lgr %0,%3\n" |
698 | "1: lg %2,0(%0,%4)\n" | 644 | " j 5f\n" |
699 | " sllg %0,%0,3\n" | 645 | "1: lg %2,0(%0,%4)\n" |
700 | " clr %2,%1\n" | 646 | " sllg %0,%0,3\n" |
701 | " jne 2f\n" | 647 | " clr %2,%1\n" |
702 | " aghi %0,32\n" | 648 | " jne 2f\n" |
703 | " srlg %2,%2,32\n" | 649 | " aghi %0,32\n" |
704 | "2: lghi %1,0xff\n" | 650 | " srlg %2,%2,32\n" |
705 | " tmll %2,0xffff\n" | 651 | "2: lghi %1,0xff\n" |
706 | " jnz 3f\n" | 652 | " tmll %2,0xffff\n" |
707 | " aghi %0,16\n" | 653 | " jnz 3f\n" |
708 | " srl %2,16\n" | 654 | " aghi %0,16\n" |
709 | "3: tmll %2,0x00ff\n" | 655 | " srl %2,16\n" |
710 | " jnz 4f\n" | 656 | "3: tmll %2,0x00ff\n" |
711 | " aghi %0,8\n" | 657 | " jnz 4f\n" |
712 | " srl %2,8\n" | 658 | " aghi %0,8\n" |
713 | "4: ngr %2,%1\n" | 659 | " srl %2,8\n" |
714 | " ic %2,0(%2,%5)\n" | 660 | "4: ngr %2,%1\n" |
715 | " algr %0,%2\n" | 661 | " ic %2,0(%2,%5)\n" |
716 | "5:" | 662 | " algr %0,%2\n" |
717 | : "=&a" (res), "=&d" (cmp), "=&a" (count) | 663 | "5:" |
664 | : "=&a" (res), "=&d" (cmp), "=&a" (count) | ||
718 | : "a" (size), "a" (addr), "a" (&_sb_findmap), | 665 | : "a" (size), "a" (addr), "a" (&_sb_findmap), |
719 | "m" (*(addrtype *) addr) : "cc" ); | 666 | "m" (*(addrtype *) addr) : "cc"); |
720 | return (res < size) ? res : size; | 667 | return (res < size) ? res : size; |
721 | } | 668 | } |
722 | 669 | ||
@@ -832,36 +779,37 @@ ext2_find_first_zero_bit(void *vaddr, unsigned int size) | |||
832 | 779 | ||
833 | if (!size) | 780 | if (!size) |
834 | return 0; | 781 | return 0; |
835 | __asm__(" lhi %1,-1\n" | 782 | asm volatile( |
836 | " lr %2,%3\n" | 783 | " lhi %1,-1\n" |
837 | " ahi %2,31\n" | 784 | " lr %2,%3\n" |
838 | " srl %2,5\n" | 785 | " ahi %2,31\n" |
839 | " slr %0,%0\n" | 786 | " srl %2,5\n" |
840 | "0: cl %1,0(%0,%4)\n" | 787 | " slr %0,%0\n" |
841 | " jne 1f\n" | 788 | "0: cl %1,0(%0,%4)\n" |
842 | " ahi %0,4\n" | 789 | " jne 1f\n" |
843 | " brct %2,0b\n" | 790 | " ahi %0,4\n" |
844 | " lr %0,%3\n" | 791 | " brct %2,0b\n" |
845 | " j 4f\n" | 792 | " lr %0,%3\n" |
846 | "1: l %2,0(%0,%4)\n" | 793 | " j 4f\n" |
847 | " sll %0,3\n" | 794 | "1: l %2,0(%0,%4)\n" |
848 | " ahi %0,24\n" | 795 | " sll %0,3\n" |
849 | " lhi %1,0xff\n" | 796 | " ahi %0,24\n" |
850 | " tmh %2,0xffff\n" | 797 | " lhi %1,0xff\n" |
851 | " jo 2f\n" | 798 | " tmh %2,0xffff\n" |
852 | " ahi %0,-16\n" | 799 | " jo 2f\n" |
853 | " srl %2,16\n" | 800 | " ahi %0,-16\n" |
854 | "2: tml %2,0xff00\n" | 801 | " srl %2,16\n" |
855 | " jo 3f\n" | 802 | "2: tml %2,0xff00\n" |
856 | " ahi %0,-8\n" | 803 | " jo 3f\n" |
857 | " srl %2,8\n" | 804 | " ahi %0,-8\n" |
858 | "3: nr %2,%1\n" | 805 | " srl %2,8\n" |
859 | " ic %2,0(%2,%5)\n" | 806 | "3: nr %2,%1\n" |
860 | " alr %0,%2\n" | 807 | " ic %2,0(%2,%5)\n" |
861 | "4:" | 808 | " alr %0,%2\n" |
862 | : "=&a" (res), "=&d" (cmp), "=&a" (count) | 809 | "4:" |
863 | : "a" (size), "a" (vaddr), "a" (&_zb_findmap), | 810 | : "=&a" (res), "=&d" (cmp), "=&a" (count) |
864 | "m" (*(addrtype *) vaddr) : "cc" ); | 811 | : "a" (size), "a" (vaddr), "a" (&_zb_findmap), |
812 | "m" (*(addrtype *) vaddr) : "cc"); | ||
865 | return (res < size) ? res : size; | 813 | return (res < size) ? res : size; |
866 | } | 814 | } |
867 | 815 | ||
@@ -875,39 +823,40 @@ ext2_find_first_zero_bit(void *vaddr, unsigned long size) | |||
875 | 823 | ||
876 | if (!size) | 824 | if (!size) |
877 | return 0; | 825 | return 0; |
878 | __asm__(" lghi %1,-1\n" | 826 | asm volatile( |
879 | " lgr %2,%3\n" | 827 | " lghi %1,-1\n" |
880 | " aghi %2,63\n" | 828 | " lgr %2,%3\n" |
881 | " srlg %2,%2,6\n" | 829 | " aghi %2,63\n" |
882 | " slgr %0,%0\n" | 830 | " srlg %2,%2,6\n" |
883 | "0: clg %1,0(%0,%4)\n" | 831 | " slgr %0,%0\n" |
884 | " jne 1f\n" | 832 | "0: clg %1,0(%0,%4)\n" |
885 | " aghi %0,8\n" | 833 | " jne 1f\n" |
886 | " brct %2,0b\n" | 834 | " aghi %0,8\n" |
887 | " lgr %0,%3\n" | 835 | " brct %2,0b\n" |
888 | " j 5f\n" | 836 | " lgr %0,%3\n" |
889 | "1: cl %1,0(%0,%4)\n" | 837 | " j 5f\n" |
890 | " jne 2f\n" | 838 | "1: cl %1,0(%0,%4)\n" |
891 | " aghi %0,4\n" | 839 | " jne 2f\n" |
892 | "2: l %2,0(%0,%4)\n" | 840 | " aghi %0,4\n" |
893 | " sllg %0,%0,3\n" | 841 | "2: l %2,0(%0,%4)\n" |
894 | " aghi %0,24\n" | 842 | " sllg %0,%0,3\n" |
895 | " lghi %1,0xff\n" | 843 | " aghi %0,24\n" |
896 | " tmlh %2,0xffff\n" | 844 | " lghi %1,0xff\n" |
897 | " jo 3f\n" | 845 | " tmlh %2,0xffff\n" |
898 | " aghi %0,-16\n" | 846 | " jo 3f\n" |
899 | " srl %2,16\n" | 847 | " aghi %0,-16\n" |
900 | "3: tmll %2,0xff00\n" | 848 | " srl %2,16\n" |
901 | " jo 4f\n" | 849 | "3: tmll %2,0xff00\n" |
902 | " aghi %0,-8\n" | 850 | " jo 4f\n" |
903 | " srl %2,8\n" | 851 | " aghi %0,-8\n" |
904 | "4: ngr %2,%1\n" | 852 | " srl %2,8\n" |
905 | " ic %2,0(%2,%5)\n" | 853 | "4: ngr %2,%1\n" |
906 | " algr %0,%2\n" | 854 | " ic %2,0(%2,%5)\n" |
907 | "5:" | 855 | " algr %0,%2\n" |
908 | : "=&a" (res), "=&d" (cmp), "=&a" (count) | 856 | "5:" |
857 | : "=&a" (res), "=&d" (cmp), "=&a" (count) | ||
909 | : "a" (size), "a" (vaddr), "a" (&_zb_findmap), | 858 | : "a" (size), "a" (vaddr), "a" (&_zb_findmap), |
910 | "m" (*(addrtype *) vaddr) : "cc" ); | 859 | "m" (*(addrtype *) vaddr) : "cc"); |
911 | return (res < size) ? res : size; | 860 | return (res < size) ? res : size; |
912 | } | 861 | } |
913 | 862 | ||
@@ -927,13 +876,16 @@ ext2_find_next_zero_bit(void *vaddr, unsigned long size, unsigned long offset) | |||
927 | p = addr + offset / __BITOPS_WORDSIZE; | 876 | p = addr + offset / __BITOPS_WORDSIZE; |
928 | if (bit) { | 877 | if (bit) { |
929 | #ifndef __s390x__ | 878 | #ifndef __s390x__ |
930 | asm(" ic %0,0(%1)\n" | 879 | asm volatile( |
931 | " icm %0,2,1(%1)\n" | 880 | " ic %0,0(%1)\n" |
932 | " icm %0,4,2(%1)\n" | 881 | " icm %0,2,1(%1)\n" |
933 | " icm %0,8,3(%1)" | 882 | " icm %0,4,2(%1)\n" |
934 | : "=&a" (word) : "a" (p), "m" (*p) : "cc" ); | 883 | " icm %0,8,3(%1)" |
884 | : "=&a" (word) : "a" (p), "m" (*p) : "cc"); | ||
935 | #else | 885 | #else |
936 | asm(" lrvg %0,%1" : "=a" (word) : "m" (*p) ); | 886 | asm volatile( |
887 | " lrvg %0,%1" | ||
888 | : "=a" (word) : "m" (*p) ); | ||
937 | #endif | 889 | #endif |
938 | /* | 890 | /* |
939 | * s390 version of ffz returns __BITOPS_WORDSIZE | 891 | * s390 version of ffz returns __BITOPS_WORDSIZE |
diff --git a/include/asm-s390/byteorder.h b/include/asm-s390/byteorder.h index 2cc35a0e188e..1fe2492baa8d 100644 --- a/include/asm-s390/byteorder.h +++ b/include/asm-s390/byteorder.h | |||
@@ -14,60 +14,54 @@ | |||
14 | #ifdef __GNUC__ | 14 | #ifdef __GNUC__ |
15 | 15 | ||
16 | #ifdef __s390x__ | 16 | #ifdef __s390x__ |
17 | static __inline__ __u64 ___arch__swab64p(const __u64 *x) | 17 | static inline __u64 ___arch__swab64p(const __u64 *x) |
18 | { | 18 | { |
19 | __u64 result; | 19 | __u64 result; |
20 | 20 | ||
21 | __asm__ __volatile__ ( | 21 | asm volatile("lrvg %0,%1" : "=d" (result) : "m" (*x)); |
22 | " lrvg %0,%1" | ||
23 | : "=d" (result) : "m" (*x) ); | ||
24 | return result; | 22 | return result; |
25 | } | 23 | } |
26 | 24 | ||
27 | static __inline__ __u64 ___arch__swab64(__u64 x) | 25 | static inline __u64 ___arch__swab64(__u64 x) |
28 | { | 26 | { |
29 | __u64 result; | 27 | __u64 result; |
30 | 28 | ||
31 | __asm__ __volatile__ ( | 29 | asm volatile("lrvgr %0,%1" : "=d" (result) : "d" (x)); |
32 | " lrvgr %0,%1" | ||
33 | : "=d" (result) : "d" (x) ); | ||
34 | return result; | 30 | return result; |
35 | } | 31 | } |
36 | 32 | ||
37 | static __inline__ void ___arch__swab64s(__u64 *x) | 33 | static inline void ___arch__swab64s(__u64 *x) |
38 | { | 34 | { |
39 | *x = ___arch__swab64p(x); | 35 | *x = ___arch__swab64p(x); |
40 | } | 36 | } |
41 | #endif /* __s390x__ */ | 37 | #endif /* __s390x__ */ |
42 | 38 | ||
43 | static __inline__ __u32 ___arch__swab32p(const __u32 *x) | 39 | static inline __u32 ___arch__swab32p(const __u32 *x) |
44 | { | 40 | { |
45 | __u32 result; | 41 | __u32 result; |
46 | 42 | ||
47 | __asm__ __volatile__ ( | 43 | asm volatile( |
48 | #ifndef __s390x__ | 44 | #ifndef __s390x__ |
49 | " icm %0,8,3(%1)\n" | 45 | " icm %0,8,3(%1)\n" |
50 | " icm %0,4,2(%1)\n" | 46 | " icm %0,4,2(%1)\n" |
51 | " icm %0,2,1(%1)\n" | 47 | " icm %0,2,1(%1)\n" |
52 | " ic %0,0(%1)" | 48 | " ic %0,0(%1)" |
53 | : "=&d" (result) : "a" (x), "m" (*x) : "cc" ); | 49 | : "=&d" (result) : "a" (x), "m" (*x) : "cc"); |
54 | #else /* __s390x__ */ | 50 | #else /* __s390x__ */ |
55 | " lrv %0,%1" | 51 | " lrv %0,%1" |
56 | : "=d" (result) : "m" (*x) ); | 52 | : "=d" (result) : "m" (*x)); |
57 | #endif /* __s390x__ */ | 53 | #endif /* __s390x__ */ |
58 | return result; | 54 | return result; |
59 | } | 55 | } |
60 | 56 | ||
61 | static __inline__ __u32 ___arch__swab32(__u32 x) | 57 | static inline __u32 ___arch__swab32(__u32 x) |
62 | { | 58 | { |
63 | #ifndef __s390x__ | 59 | #ifndef __s390x__ |
64 | return ___arch__swab32p(&x); | 60 | return ___arch__swab32p(&x); |
65 | #else /* __s390x__ */ | 61 | #else /* __s390x__ */ |
66 | __u32 result; | 62 | __u32 result; |
67 | 63 | ||
68 | __asm__ __volatile__ ( | 64 | asm volatile("lrvr %0,%1" : "=d" (result) : "d" (x)); |
69 | " lrvr %0,%1" | ||
70 | : "=d" (result) : "d" (x) ); | ||
71 | return result; | 65 | return result; |
72 | #endif /* __s390x__ */ | 66 | #endif /* __s390x__ */ |
73 | } | 67 | } |
@@ -81,14 +75,14 @@ static __inline__ __u16 ___arch__swab16p(const __u16 *x) | |||
81 | { | 75 | { |
82 | __u16 result; | 76 | __u16 result; |
83 | 77 | ||
84 | __asm__ __volatile__ ( | 78 | asm volatile( |
85 | #ifndef __s390x__ | 79 | #ifndef __s390x__ |
86 | " icm %0,2,1(%1)\n" | 80 | " icm %0,2,1(%1)\n" |
87 | " ic %0,0(%1)\n" | 81 | " ic %0,0(%1)\n" |
88 | : "=&d" (result) : "a" (x), "m" (*x) : "cc" ); | 82 | : "=&d" (result) : "a" (x), "m" (*x) : "cc"); |
89 | #else /* __s390x__ */ | 83 | #else /* __s390x__ */ |
90 | " lrvh %0,%1" | 84 | " lrvh %0,%1" |
91 | : "=d" (result) : "m" (*x) ); | 85 | : "=d" (result) : "m" (*x)); |
92 | #endif /* __s390x__ */ | 86 | #endif /* __s390x__ */ |
93 | return result; | 87 | return result; |
94 | } | 88 | } |
diff --git a/include/asm-s390/checksum.h b/include/asm-s390/checksum.h index 471f2af2b16a..37c362d89fad 100644 --- a/include/asm-s390/checksum.h +++ b/include/asm-s390/checksum.h | |||
@@ -30,57 +30,13 @@ | |||
30 | static inline unsigned int | 30 | static inline unsigned int |
31 | csum_partial(const unsigned char * buff, int len, unsigned int sum) | 31 | csum_partial(const unsigned char * buff, int len, unsigned int sum) |
32 | { | 32 | { |
33 | /* | 33 | register unsigned long reg2 asm("2") = (unsigned long) buff; |
34 | * Experiments with ethernet and slip connections show that buf | 34 | register unsigned long reg3 asm("3") = (unsigned long) len; |
35 | * is aligned on either a 2-byte or 4-byte boundary. | ||
36 | */ | ||
37 | #ifndef __s390x__ | ||
38 | register_pair rp; | ||
39 | |||
40 | rp.subreg.even = (unsigned long) buff; | ||
41 | rp.subreg.odd = (unsigned long) len; | ||
42 | __asm__ __volatile__ ( | ||
43 | "0: cksm %0,%1\n" /* do checksum on longs */ | ||
44 | " jo 0b\n" | ||
45 | : "+&d" (sum), "+&a" (rp) : : "cc", "memory" ); | ||
46 | #else /* __s390x__ */ | ||
47 | __asm__ __volatile__ ( | ||
48 | " lgr 2,%1\n" /* address in gpr 2 */ | ||
49 | " lgfr 3,%2\n" /* length in gpr 3 */ | ||
50 | "0: cksm %0,2\n" /* do checksum on longs */ | ||
51 | " jo 0b\n" | ||
52 | : "+&d" (sum) | ||
53 | : "d" (buff), "d" (len) | ||
54 | : "cc", "memory", "2", "3" ); | ||
55 | #endif /* __s390x__ */ | ||
56 | return sum; | ||
57 | } | ||
58 | |||
59 | /* | ||
60 | * csum_partial as an inline function | ||
61 | */ | ||
62 | static inline unsigned int | ||
63 | csum_partial_inline(const unsigned char * buff, int len, unsigned int sum) | ||
64 | { | ||
65 | #ifndef __s390x__ | ||
66 | register_pair rp; | ||
67 | 35 | ||
68 | rp.subreg.even = (unsigned long) buff; | 36 | asm volatile( |
69 | rp.subreg.odd = (unsigned long) len; | 37 | "0: cksm %0,%1\n" /* do checksum on longs */ |
70 | __asm__ __volatile__ ( | 38 | " jo 0b\n" |
71 | "0: cksm %0,%1\n" /* do checksum on longs */ | 39 | : "+d" (sum), "+d" (reg2), "+d" (reg3) : : "cc", "memory"); |
72 | " jo 0b\n" | ||
73 | : "+&d" (sum), "+&a" (rp) : : "cc", "memory" ); | ||
74 | #else /* __s390x__ */ | ||
75 | __asm__ __volatile__ ( | ||
76 | " lgr 2,%1\n" /* address in gpr 2 */ | ||
77 | " lgfr 3,%2\n" /* length in gpr 3 */ | ||
78 | "0: cksm %0,2\n" /* do checksum on longs */ | ||
79 | " jo 0b\n" | ||
80 | : "+&d" (sum) | ||
81 | : "d" (buff), "d" (len) | ||
82 | : "cc", "memory", "2", "3" ); | ||
83 | #endif /* __s390x__ */ | ||
84 | return sum; | 40 | return sum; |
85 | } | 41 | } |
86 | 42 | ||
@@ -114,7 +70,7 @@ static inline unsigned int | |||
114 | csum_partial_copy_nocheck (const char *src, char *dst, int len, unsigned int sum) | 70 | csum_partial_copy_nocheck (const char *src, char *dst, int len, unsigned int sum) |
115 | { | 71 | { |
116 | memcpy(dst,src,len); | 72 | memcpy(dst,src,len); |
117 | return csum_partial_inline(dst, len, sum); | 73 | return csum_partial(dst, len, sum); |
118 | } | 74 | } |
119 | 75 | ||
120 | /* | 76 | /* |
@@ -126,22 +82,22 @@ csum_fold(unsigned int sum) | |||
126 | #ifndef __s390x__ | 82 | #ifndef __s390x__ |
127 | register_pair rp; | 83 | register_pair rp; |
128 | 84 | ||
129 | __asm__ __volatile__ ( | 85 | asm volatile( |
130 | " slr %N1,%N1\n" /* %0 = H L */ | 86 | " slr %N1,%N1\n" /* %0 = H L */ |
131 | " lr %1,%0\n" /* %0 = H L, %1 = H L 0 0 */ | 87 | " lr %1,%0\n" /* %0 = H L, %1 = H L 0 0 */ |
132 | " srdl %1,16\n" /* %0 = H L, %1 = 0 H L 0 */ | 88 | " srdl %1,16\n" /* %0 = H L, %1 = 0 H L 0 */ |
133 | " alr %1,%N1\n" /* %0 = H L, %1 = L H L 0 */ | 89 | " alr %1,%N1\n" /* %0 = H L, %1 = L H L 0 */ |
134 | " alr %0,%1\n" /* %0 = H+L+C L+H */ | 90 | " alr %0,%1\n" /* %0 = H+L+C L+H */ |
135 | " srl %0,16\n" /* %0 = H+L+C */ | 91 | " srl %0,16\n" /* %0 = H+L+C */ |
136 | : "+&d" (sum), "=d" (rp) : : "cc" ); | 92 | : "+&d" (sum), "=d" (rp) : : "cc"); |
137 | #else /* __s390x__ */ | 93 | #else /* __s390x__ */ |
138 | __asm__ __volatile__ ( | 94 | asm volatile( |
139 | " sr 3,3\n" /* %0 = H*65536 + L */ | 95 | " sr 3,3\n" /* %0 = H*65536 + L */ |
140 | " lr 2,%0\n" /* %0 = H L, R2/R3 = H L / 0 0 */ | 96 | " lr 2,%0\n" /* %0 = H L, 2/3 = H L / 0 0 */ |
141 | " srdl 2,16\n" /* %0 = H L, R2/R3 = 0 H / L 0 */ | 97 | " srdl 2,16\n" /* %0 = H L, 2/3 = 0 H / L 0 */ |
142 | " alr 2,3\n" /* %0 = H L, R2/R3 = L H / L 0 */ | 98 | " alr 2,3\n" /* %0 = H L, 2/3 = L H / L 0 */ |
143 | " alr %0,2\n" /* %0 = H+L+C L+H */ | 99 | " alr %0,2\n" /* %0 = H+L+C L+H */ |
144 | " srl %0,16\n" /* %0 = H+L+C */ | 100 | " srl %0,16\n" /* %0 = H+L+C */ |
145 | : "+&d" (sum) : : "cc", "2", "3"); | 101 | : "+&d" (sum) : : "cc", "2", "3"); |
146 | #endif /* __s390x__ */ | 102 | #endif /* __s390x__ */ |
147 | return ((unsigned short) ~sum); | 103 | return ((unsigned short) ~sum); |
@@ -155,29 +111,7 @@ csum_fold(unsigned int sum) | |||
155 | static inline unsigned short | 111 | static inline unsigned short |
156 | ip_fast_csum(unsigned char *iph, unsigned int ihl) | 112 | ip_fast_csum(unsigned char *iph, unsigned int ihl) |
157 | { | 113 | { |
158 | unsigned long sum; | 114 | return csum_fold(csum_partial(iph, ihl*4, 0)); |
159 | #ifndef __s390x__ | ||
160 | register_pair rp; | ||
161 | |||
162 | rp.subreg.even = (unsigned long) iph; | ||
163 | rp.subreg.odd = (unsigned long) ihl*4; | ||
164 | __asm__ __volatile__ ( | ||
165 | " sr %0,%0\n" /* set sum to zero */ | ||
166 | "0: cksm %0,%1\n" /* do checksum on longs */ | ||
167 | " jo 0b\n" | ||
168 | : "=&d" (sum), "+&a" (rp) : : "cc", "memory" ); | ||
169 | #else /* __s390x__ */ | ||
170 | __asm__ __volatile__ ( | ||
171 | " slgr %0,%0\n" /* set sum to zero */ | ||
172 | " lgr 2,%1\n" /* address in gpr 2 */ | ||
173 | " lgfr 3,%2\n" /* length in gpr 3 */ | ||
174 | "0: cksm %0,2\n" /* do checksum on ints */ | ||
175 | " jo 0b\n" | ||
176 | : "=&d" (sum) | ||
177 | : "d" (iph), "d" (ihl*4) | ||
178 | : "cc", "memory", "2", "3" ); | ||
179 | #endif /* __s390x__ */ | ||
180 | return csum_fold(sum); | ||
181 | } | 115 | } |
182 | 116 | ||
183 | /* | 117 | /* |
@@ -190,47 +124,47 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, | |||
190 | unsigned int sum) | 124 | unsigned int sum) |
191 | { | 125 | { |
192 | #ifndef __s390x__ | 126 | #ifndef __s390x__ |
193 | __asm__ __volatile__ ( | 127 | asm volatile( |
194 | " alr %0,%1\n" /* sum += saddr */ | 128 | " alr %0,%1\n" /* sum += saddr */ |
195 | " brc 12,0f\n" | 129 | " brc 12,0f\n" |
196 | " ahi %0,1\n" /* add carry */ | 130 | " ahi %0,1\n" /* add carry */ |
197 | "0:" | 131 | "0:" |
198 | : "+&d" (sum) : "d" (saddr) : "cc" ); | 132 | : "+&d" (sum) : "d" (saddr) : "cc"); |
199 | __asm__ __volatile__ ( | 133 | asm volatile( |
200 | " alr %0,%1\n" /* sum += daddr */ | 134 | " alr %0,%1\n" /* sum += daddr */ |
201 | " brc 12,1f\n" | 135 | " brc 12,1f\n" |
202 | " ahi %0,1\n" /* add carry */ | 136 | " ahi %0,1\n" /* add carry */ |
203 | "1:" | 137 | "1:" |
204 | : "+&d" (sum) : "d" (daddr) : "cc" ); | 138 | : "+&d" (sum) : "d" (daddr) : "cc"); |
205 | __asm__ __volatile__ ( | 139 | asm volatile( |
206 | " alr %0,%1\n" /* sum += (len<<16) + (proto<<8) */ | 140 | " alr %0,%1\n" /* sum += (len<<16) + (proto<<8) */ |
207 | " brc 12,2f\n" | 141 | " brc 12,2f\n" |
208 | " ahi %0,1\n" /* add carry */ | 142 | " ahi %0,1\n" /* add carry */ |
209 | "2:" | 143 | "2:" |
210 | : "+&d" (sum) | 144 | : "+&d" (sum) |
211 | : "d" (((unsigned int) len<<16) + (unsigned int) proto) | 145 | : "d" (((unsigned int) len<<16) + (unsigned int) proto) |
212 | : "cc" ); | 146 | : "cc"); |
213 | #else /* __s390x__ */ | 147 | #else /* __s390x__ */ |
214 | __asm__ __volatile__ ( | 148 | asm volatile( |
215 | " lgfr %0,%0\n" | 149 | " lgfr %0,%0\n" |
216 | " algr %0,%1\n" /* sum += saddr */ | 150 | " algr %0,%1\n" /* sum += saddr */ |
217 | " brc 12,0f\n" | 151 | " brc 12,0f\n" |
218 | " aghi %0,1\n" /* add carry */ | 152 | " aghi %0,1\n" /* add carry */ |
219 | "0: algr %0,%2\n" /* sum += daddr */ | 153 | "0: algr %0,%2\n" /* sum += daddr */ |
220 | " brc 12,1f\n" | 154 | " brc 12,1f\n" |
221 | " aghi %0,1\n" /* add carry */ | 155 | " aghi %0,1\n" /* add carry */ |
222 | "1: algfr %0,%3\n" /* sum += (len<<16) + proto */ | 156 | "1: algfr %0,%3\n" /* sum += (len<<16) + proto */ |
223 | " brc 12,2f\n" | 157 | " brc 12,2f\n" |
224 | " aghi %0,1\n" /* add carry */ | 158 | " aghi %0,1\n" /* add carry */ |
225 | "2: srlg 0,%0,32\n" | 159 | "2: srlg 0,%0,32\n" |
226 | " alr %0,0\n" /* fold to 32 bits */ | 160 | " alr %0,0\n" /* fold to 32 bits */ |
227 | " brc 12,3f\n" | 161 | " brc 12,3f\n" |
228 | " ahi %0,1\n" /* add carry */ | 162 | " ahi %0,1\n" /* add carry */ |
229 | "3: llgfr %0,%0" | 163 | "3: llgfr %0,%0" |
230 | : "+&d" (sum) | 164 | : "+&d" (sum) |
231 | : "d" (saddr), "d" (daddr), | 165 | : "d" (saddr), "d" (daddr), |
232 | "d" (((unsigned int) len<<16) + (unsigned int) proto) | 166 | "d" (((unsigned int) len<<16) + (unsigned int) proto) |
233 | : "cc", "0" ); | 167 | : "cc", "0"); |
234 | #endif /* __s390x__ */ | 168 | #endif /* __s390x__ */ |
235 | return sum; | 169 | return sum; |
236 | } | 170 | } |
diff --git a/include/asm-s390/ebcdic.h b/include/asm-s390/ebcdic.h index 15fd2eda6c90..7f6f641d32f4 100644 --- a/include/asm-s390/ebcdic.h +++ b/include/asm-s390/ebcdic.h | |||
@@ -26,16 +26,16 @@ codepage_convert(const __u8 *codepage, volatile __u8 * addr, unsigned long nr) | |||
26 | { | 26 | { |
27 | if (nr-- <= 0) | 27 | if (nr-- <= 0) |
28 | return; | 28 | return; |
29 | __asm__ __volatile__( | 29 | asm volatile( |
30 | " bras 1,1f\n" | 30 | " bras 1,1f\n" |
31 | " tr 0(1,%0),0(%2)\n" | 31 | " tr 0(1,%0),0(%2)\n" |
32 | "0: tr 0(256,%0),0(%2)\n" | 32 | "0: tr 0(256,%0),0(%2)\n" |
33 | " la %0,256(%0)\n" | 33 | " la %0,256(%0)\n" |
34 | "1: ahi %1,-256\n" | 34 | "1: ahi %1,-256\n" |
35 | " jnm 0b\n" | 35 | " jnm 0b\n" |
36 | " ex %1,0(1)" | 36 | " ex %1,0(1)" |
37 | : "+&a" (addr), "+&a" (nr) | 37 | : "+&a" (addr), "+&a" (nr) |
38 | : "a" (codepage) : "cc", "memory", "1" ); | 38 | : "a" (codepage) : "cc", "memory", "1"); |
39 | } | 39 | } |
40 | 40 | ||
41 | #define ASCEBC(addr,nr) codepage_convert(_ascebc, addr, nr) | 41 | #define ASCEBC(addr,nr) codepage_convert(_ascebc, addr, nr) |
diff --git a/include/asm-s390/io.h b/include/asm-s390/io.h index a6cc27e77007..63c78b9399c4 100644 --- a/include/asm-s390/io.h +++ b/include/asm-s390/io.h | |||
@@ -27,18 +27,16 @@ | |||
27 | static inline unsigned long virt_to_phys(volatile void * address) | 27 | static inline unsigned long virt_to_phys(volatile void * address) |
28 | { | 28 | { |
29 | unsigned long real_address; | 29 | unsigned long real_address; |
30 | __asm__ ( | 30 | asm volatile( |
31 | #ifndef __s390x__ | 31 | #ifndef __s390x__ |
32 | " lra %0,0(%1)\n" | 32 | " lra %0,0(%1)\n" |
33 | " jz 0f\n" | ||
34 | " sr %0,%0\n" | ||
35 | #else /* __s390x__ */ | 33 | #else /* __s390x__ */ |
36 | " lrag %0,0(%1)\n" | 34 | " lrag %0,0(%1)\n" |
37 | " jz 0f\n" | ||
38 | " slgr %0,%0\n" | ||
39 | #endif /* __s390x__ */ | 35 | #endif /* __s390x__ */ |
36 | " jz 0f\n" | ||
37 | " la %0,0\n" | ||
40 | "0:" | 38 | "0:" |
41 | : "=a" (real_address) : "a" (address) : "cc" ); | 39 | : "=a" (real_address) : "a" (address) : "cc"); |
42 | return real_address; | 40 | return real_address; |
43 | } | 41 | } |
44 | 42 | ||
diff --git a/include/asm-s390/irqflags.h b/include/asm-s390/irqflags.h index 3b566a5b3cc7..3f26131120b7 100644 --- a/include/asm-s390/irqflags.h +++ b/include/asm-s390/irqflags.h | |||
@@ -10,43 +10,93 @@ | |||
10 | 10 | ||
11 | #ifdef __KERNEL__ | 11 | #ifdef __KERNEL__ |
12 | 12 | ||
13 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) | ||
14 | |||
15 | /* store then or system mask. */ | ||
16 | #define __raw_local_irq_stosm(__or) \ | ||
17 | ({ \ | ||
18 | unsigned long __mask; \ | ||
19 | asm volatile( \ | ||
20 | " stosm %0,%1" \ | ||
21 | : "=Q" (__mask) : "i" (__or) : "memory"); \ | ||
22 | __mask; \ | ||
23 | }) | ||
24 | |||
25 | /* store then and system mask. */ | ||
26 | #define __raw_local_irq_stnsm(__and) \ | ||
27 | ({ \ | ||
28 | unsigned long __mask; \ | ||
29 | asm volatile( \ | ||
30 | " stnsm %0,%1" \ | ||
31 | : "=Q" (__mask) : "i" (__and) : "memory"); \ | ||
32 | __mask; \ | ||
33 | }) | ||
34 | |||
35 | /* set system mask. */ | ||
36 | #define __raw_local_irq_ssm(__mask) \ | ||
37 | ({ \ | ||
38 | asm volatile("ssm %0" : : "Q" (__mask) : "memory"); \ | ||
39 | }) | ||
40 | |||
41 | #else /* __GNUC__ */ | ||
42 | |||
43 | /* store then or system mask. */ | ||
44 | #define __raw_local_irq_stosm(__or) \ | ||
45 | ({ \ | ||
46 | unsigned long __mask; \ | ||
47 | asm volatile( \ | ||
48 | " stosm 0(%1),%2" \ | ||
49 | : "=m" (__mask) \ | ||
50 | : "a" (&__mask), "i" (__or) : "memory"); \ | ||
51 | __mask; \ | ||
52 | }) | ||
53 | |||
54 | /* store then and system mask. */ | ||
55 | #define __raw_local_irq_stnsm(__and) \ | ||
56 | ({ \ | ||
57 | unsigned long __mask; \ | ||
58 | asm volatile( \ | ||
59 | " stnsm 0(%1),%2" \ | ||
60 | : "=m" (__mask) \ | ||
61 | : "a" (&__mask), "i" (__and) : "memory"); \ | ||
62 | __mask; \ | ||
63 | }) | ||
64 | |||
65 | /* set system mask. */ | ||
66 | #define __raw_local_irq_ssm(__mask) \ | ||
67 | ({ \ | ||
68 | asm volatile( \ | ||
69 | " ssm 0(%0)" \ | ||
70 | : : "a" (&__mask), "m" (__mask) : "memory"); \ | ||
71 | }) | ||
72 | |||
73 | #endif /* __GNUC__ */ | ||
74 | |||
13 | /* interrupt control.. */ | 75 | /* interrupt control.. */ |
14 | #define raw_local_irq_enable() ({ \ | 76 | static inline unsigned long raw_local_irq_enable(void) |
15 | unsigned long __dummy; \ | 77 | { |
16 | __asm__ __volatile__ ( \ | 78 | return __raw_local_irq_stosm(0x03); |
17 | "stosm 0(%1),0x03" \ | 79 | } |
18 | : "=m" (__dummy) : "a" (&__dummy) : "memory" ); \ | ||
19 | }) | ||
20 | |||
21 | #define raw_local_irq_disable() ({ \ | ||
22 | unsigned long __flags; \ | ||
23 | __asm__ __volatile__ ( \ | ||
24 | "stnsm 0(%1),0xfc" : "=m" (__flags) : "a" (&__flags) ); \ | ||
25 | __flags; \ | ||
26 | }) | ||
27 | |||
28 | #define raw_local_save_flags(x) \ | ||
29 | do { \ | ||
30 | typecheck(unsigned long, x); \ | ||
31 | __asm__ __volatile__("stosm 0(%1),0" : "=m" (x) : "a" (&x), "m" (x) ); \ | ||
32 | } while (0) | ||
33 | 80 | ||
34 | #define raw_local_irq_restore(x) \ | 81 | static inline unsigned long raw_local_irq_disable(void) |
35 | do { \ | 82 | { |
36 | typecheck(unsigned long, x); \ | 83 | return __raw_local_irq_stnsm(0xfc); |
37 | __asm__ __volatile__("ssm 0(%0)" : : "a" (&x), "m" (x) : "memory"); \ | 84 | } |
85 | |||
86 | #define raw_local_save_flags(x) \ | ||
87 | do { \ | ||
88 | typecheck(unsigned long, x); \ | ||
89 | (x) = __raw_local_irq_stosm(0x00); \ | ||
38 | } while (0) | 90 | } while (0) |
39 | 91 | ||
40 | #define raw_irqs_disabled() \ | 92 | static inline void raw_local_irq_restore(unsigned long flags) |
41 | ({ \ | 93 | { |
42 | unsigned long flags; \ | 94 | __raw_local_irq_ssm(flags); |
43 | raw_local_save_flags(flags); \ | 95 | } |
44 | !((flags >> __FLAG_SHIFT) & 3); \ | ||
45 | }) | ||
46 | 96 | ||
47 | static inline int raw_irqs_disabled_flags(unsigned long flags) | 97 | static inline int raw_irqs_disabled_flags(unsigned long flags) |
48 | { | 98 | { |
49 | return !((flags >> __FLAG_SHIFT) & 3); | 99 | return !(flags & (3UL << (BITS_PER_LONG - 8))); |
50 | } | 100 | } |
51 | 101 | ||
52 | /* For spinlocks etc */ | 102 | /* For spinlocks etc */ |
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h index 18695d10dedf..06583ed0bde7 100644 --- a/include/asm-s390/lowcore.h +++ b/include/asm-s390/lowcore.h | |||
@@ -359,7 +359,7 @@ extern struct _lowcore *lowcore_ptr[]; | |||
359 | 359 | ||
360 | static inline void set_prefix(__u32 address) | 360 | static inline void set_prefix(__u32 address) |
361 | { | 361 | { |
362 | __asm__ __volatile__ ("spx %0" : : "m" (address) : "memory" ); | 362 | asm volatile("spx %0" : : "m" (address) : "memory"); |
363 | } | 363 | } |
364 | 364 | ||
365 | #define __PANIC_MAGIC 0xDEADC0DE | 365 | #define __PANIC_MAGIC 0xDEADC0DE |
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h index b2628dc5c490..796c400f2b79 100644 --- a/include/asm-s390/page.h +++ b/include/asm-s390/page.h | |||
@@ -22,89 +22,45 @@ | |||
22 | #include <asm/setup.h> | 22 | #include <asm/setup.h> |
23 | #ifndef __ASSEMBLY__ | 23 | #ifndef __ASSEMBLY__ |
24 | 24 | ||
25 | #ifndef __s390x__ | ||
26 | |||
27 | static inline void clear_page(void *page) | ||
28 | { | ||
29 | register_pair rp; | ||
30 | |||
31 | rp.subreg.even = (unsigned long) page; | ||
32 | rp.subreg.odd = (unsigned long) 4096; | ||
33 | asm volatile (" slr 1,1\n" | ||
34 | " mvcl %0,0" | ||
35 | : "+&a" (rp) : : "memory", "cc", "1" ); | ||
36 | } | ||
37 | |||
38 | static inline void copy_page(void *to, void *from) | ||
39 | { | ||
40 | if (MACHINE_HAS_MVPG) | ||
41 | asm volatile (" sr 0,0\n" | ||
42 | " mvpg %0,%1" | ||
43 | : : "a" ((void *)(to)), "a" ((void *)(from)) | ||
44 | : "memory", "cc", "0" ); | ||
45 | else | ||
46 | asm volatile (" mvc 0(256,%0),0(%1)\n" | ||
47 | " mvc 256(256,%0),256(%1)\n" | ||
48 | " mvc 512(256,%0),512(%1)\n" | ||
49 | " mvc 768(256,%0),768(%1)\n" | ||
50 | " mvc 1024(256,%0),1024(%1)\n" | ||
51 | " mvc 1280(256,%0),1280(%1)\n" | ||
52 | " mvc 1536(256,%0),1536(%1)\n" | ||
53 | " mvc 1792(256,%0),1792(%1)\n" | ||
54 | " mvc 2048(256,%0),2048(%1)\n" | ||
55 | " mvc 2304(256,%0),2304(%1)\n" | ||
56 | " mvc 2560(256,%0),2560(%1)\n" | ||
57 | " mvc 2816(256,%0),2816(%1)\n" | ||
58 | " mvc 3072(256,%0),3072(%1)\n" | ||
59 | " mvc 3328(256,%0),3328(%1)\n" | ||
60 | " mvc 3584(256,%0),3584(%1)\n" | ||
61 | " mvc 3840(256,%0),3840(%1)\n" | ||
62 | : : "a"((void *)(to)),"a"((void *)(from)) | ||
63 | : "memory" ); | ||
64 | } | ||
65 | |||
66 | #else /* __s390x__ */ | ||
67 | |||
68 | static inline void clear_page(void *page) | 25 | static inline void clear_page(void *page) |
69 | { | 26 | { |
70 | asm volatile (" lgr 2,%0\n" | 27 | register unsigned long reg1 asm ("1") = 0; |
71 | " lghi 3,4096\n" | 28 | register void *reg2 asm ("2") = page; |
72 | " slgr 1,1\n" | 29 | register unsigned long reg3 asm ("3") = 4096; |
73 | " mvcl 2,0" | 30 | asm volatile( |
74 | : : "a" ((void *) (page)) | 31 | " mvcl 2,0" |
75 | : "memory", "cc", "1", "2", "3" ); | 32 | : "+d" (reg2), "+d" (reg3) : "d" (reg1) : "memory", "cc"); |
76 | } | 33 | } |
77 | 34 | ||
78 | static inline void copy_page(void *to, void *from) | 35 | static inline void copy_page(void *to, void *from) |
79 | { | 36 | { |
80 | if (MACHINE_HAS_MVPG) | 37 | if (MACHINE_HAS_MVPG) { |
81 | asm volatile (" sgr 0,0\n" | 38 | register unsigned long reg0 asm ("0") = 0; |
82 | " mvpg %0,%1" | 39 | asm volatile( |
83 | : : "a" ((void *)(to)), "a" ((void *)(from)) | 40 | " mvpg %0,%1" |
84 | : "memory", "cc", "0" ); | 41 | : : "a" (to), "a" (from), "d" (reg0) |
85 | else | 42 | : "memory", "cc"); |
86 | asm volatile (" mvc 0(256,%0),0(%1)\n" | 43 | } else |
87 | " mvc 256(256,%0),256(%1)\n" | 44 | asm volatile( |
88 | " mvc 512(256,%0),512(%1)\n" | 45 | " mvc 0(256,%0),0(%1)\n" |
89 | " mvc 768(256,%0),768(%1)\n" | 46 | " mvc 256(256,%0),256(%1)\n" |
90 | " mvc 1024(256,%0),1024(%1)\n" | 47 | " mvc 512(256,%0),512(%1)\n" |
91 | " mvc 1280(256,%0),1280(%1)\n" | 48 | " mvc 768(256,%0),768(%1)\n" |
92 | " mvc 1536(256,%0),1536(%1)\n" | 49 | " mvc 1024(256,%0),1024(%1)\n" |
93 | " mvc 1792(256,%0),1792(%1)\n" | 50 | " mvc 1280(256,%0),1280(%1)\n" |
94 | " mvc 2048(256,%0),2048(%1)\n" | 51 | " mvc 1536(256,%0),1536(%1)\n" |
95 | " mvc 2304(256,%0),2304(%1)\n" | 52 | " mvc 1792(256,%0),1792(%1)\n" |
96 | " mvc 2560(256,%0),2560(%1)\n" | 53 | " mvc 2048(256,%0),2048(%1)\n" |
97 | " mvc 2816(256,%0),2816(%1)\n" | 54 | " mvc 2304(256,%0),2304(%1)\n" |
98 | " mvc 3072(256,%0),3072(%1)\n" | 55 | " mvc 2560(256,%0),2560(%1)\n" |
99 | " mvc 3328(256,%0),3328(%1)\n" | 56 | " mvc 2816(256,%0),2816(%1)\n" |
100 | " mvc 3584(256,%0),3584(%1)\n" | 57 | " mvc 3072(256,%0),3072(%1)\n" |
101 | " mvc 3840(256,%0),3840(%1)\n" | 58 | " mvc 3328(256,%0),3328(%1)\n" |
102 | : : "a"((void *)(to)),"a"((void *)(from)) | 59 | " mvc 3584(256,%0),3584(%1)\n" |
103 | : "memory" ); | 60 | " mvc 3840(256,%0),3840(%1)\n" |
61 | : : "a" (to), "a" (from) : "memory"); | ||
104 | } | 62 | } |
105 | 63 | ||
106 | #endif /* __s390x__ */ | ||
107 | |||
108 | #define clear_user_page(page, vaddr, pg) clear_page(page) | 64 | #define clear_user_page(page, vaddr, pg) clear_page(page) |
109 | #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) | 65 | #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) |
110 | 66 | ||
@@ -159,7 +115,7 @@ extern unsigned int default_storage_key; | |||
159 | static inline void | 115 | static inline void |
160 | page_set_storage_key(unsigned long addr, unsigned int skey) | 116 | page_set_storage_key(unsigned long addr, unsigned int skey) |
161 | { | 117 | { |
162 | asm volatile ( "sske %0,%1" : : "d" (skey), "a" (addr) ); | 118 | asm volatile("sske %0,%1" : : "d" (skey), "a" (addr)); |
163 | } | 119 | } |
164 | 120 | ||
165 | static inline unsigned int | 121 | static inline unsigned int |
@@ -167,8 +123,7 @@ page_get_storage_key(unsigned long addr) | |||
167 | { | 123 | { |
168 | unsigned int skey; | 124 | unsigned int skey; |
169 | 125 | ||
170 | asm volatile ( "iske %0,%1" : "=d" (skey) : "a" (addr), "0" (0) ); | 126 | asm volatile("iske %0,%1" : "=d" (skey) : "a" (addr), "0" (0)); |
171 | |||
172 | return skey; | 127 | return skey; |
173 | } | 128 | } |
174 | 129 | ||
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h index e965309fedac..83425cdefc91 100644 --- a/include/asm-s390/pgtable.h +++ b/include/asm-s390/pgtable.h | |||
@@ -554,9 +554,10 @@ static inline void __ptep_ipte(unsigned long address, pte_t *ptep) | |||
554 | /* ipte in zarch mode can do the math */ | 554 | /* ipte in zarch mode can do the math */ |
555 | pte_t *pto = ptep; | 555 | pte_t *pto = ptep; |
556 | #endif | 556 | #endif |
557 | asm volatile ("ipte %2,%3" | 557 | asm volatile( |
558 | : "=m" (*ptep) : "m" (*ptep), | 558 | " ipte %2,%3" |
559 | "a" (pto), "a" (address) ); | 559 | : "=m" (*ptep) : "m" (*ptep), |
560 | "a" (pto), "a" (address)); | ||
560 | } | 561 | } |
561 | pte_val(*ptep) = _PAGE_TYPE_EMPTY; | 562 | pte_val(*ptep) = _PAGE_TYPE_EMPTY; |
562 | } | 563 | } |
@@ -609,16 +610,17 @@ ptep_establish(struct vm_area_struct *vma, | |||
609 | /* | 610 | /* |
610 | * Test and clear referenced bit in storage key. | 611 | * Test and clear referenced bit in storage key. |
611 | */ | 612 | */ |
612 | #define page_test_and_clear_young(page) \ | 613 | #define page_test_and_clear_young(page) \ |
613 | ({ \ | 614 | ({ \ |
614 | struct page *__page = (page); \ | 615 | struct page *__page = (page); \ |
615 | unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT); \ | 616 | unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT);\ |
616 | int __ccode; \ | 617 | int __ccode; \ |
617 | asm volatile ("rrbe 0,%1\n\t" \ | 618 | asm volatile( \ |
618 | "ipm %0\n\t" \ | 619 | " rrbe 0,%1\n" \ |
619 | "srl %0,28\n\t" \ | 620 | " ipm %0\n" \ |
620 | : "=d" (__ccode) : "a" (__physpage) : "cc" ); \ | 621 | " srl %0,28\n" \ |
621 | (__ccode & 2); \ | 622 | : "=d" (__ccode) : "a" (__physpage) : "cc"); \ |
623 | (__ccode & 2); \ | ||
622 | }) | 624 | }) |
623 | 625 | ||
624 | /* | 626 | /* |
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h index 578c2209fa76..cbbedc63ba25 100644 --- a/include/asm-s390/processor.h +++ b/include/asm-s390/processor.h | |||
@@ -13,7 +13,6 @@ | |||
13 | #ifndef __ASM_S390_PROCESSOR_H | 13 | #ifndef __ASM_S390_PROCESSOR_H |
14 | #define __ASM_S390_PROCESSOR_H | 14 | #define __ASM_S390_PROCESSOR_H |
15 | 15 | ||
16 | #include <asm/page.h> | ||
17 | #include <asm/ptrace.h> | 16 | #include <asm/ptrace.h> |
18 | 17 | ||
19 | #ifdef __KERNEL__ | 18 | #ifdef __KERNEL__ |
@@ -21,7 +20,7 @@ | |||
21 | * Default implementation of macro that returns current | 20 | * Default implementation of macro that returns current |
22 | * instruction pointer ("program counter"). | 21 | * instruction pointer ("program counter"). |
23 | */ | 22 | */ |
24 | #define current_text_addr() ({ void *pc; __asm__("basr %0,0":"=a"(pc)); pc; }) | 23 | #define current_text_addr() ({ void *pc; asm("basr %0,0" : "=a" (pc)); pc; }) |
25 | 24 | ||
26 | /* | 25 | /* |
27 | * CPU type and hardware bug flags. Kept separately for each CPU. | 26 | * CPU type and hardware bug flags. Kept separately for each CPU. |
@@ -202,7 +201,7 @@ unsigned long get_wchan(struct task_struct *p); | |||
202 | static inline void cpu_relax(void) | 201 | static inline void cpu_relax(void) |
203 | { | 202 | { |
204 | if (MACHINE_HAS_DIAG44) | 203 | if (MACHINE_HAS_DIAG44) |
205 | asm volatile ("diag 0,0,68" : : : "memory"); | 204 | asm volatile("diag 0,0,68" : : : "memory"); |
206 | else | 205 | else |
207 | barrier(); | 206 | barrier(); |
208 | } | 207 | } |
@@ -213,9 +212,9 @@ static inline void cpu_relax(void) | |||
213 | static inline void __load_psw(psw_t psw) | 212 | static inline void __load_psw(psw_t psw) |
214 | { | 213 | { |
215 | #ifndef __s390x__ | 214 | #ifndef __s390x__ |
216 | asm volatile ("lpsw 0(%0)" : : "a" (&psw), "m" (psw) : "cc" ); | 215 | asm volatile("lpsw 0(%0)" : : "a" (&psw), "m" (psw) : "cc"); |
217 | #else | 216 | #else |
218 | asm volatile ("lpswe 0(%0)" : : "a" (&psw), "m" (psw) : "cc" ); | 217 | asm volatile("lpswe 0(%0)" : : "a" (&psw), "m" (psw) : "cc"); |
219 | #endif | 218 | #endif |
220 | } | 219 | } |
221 | 220 | ||
@@ -232,20 +231,20 @@ static inline void __load_psw_mask (unsigned long mask) | |||
232 | psw.mask = mask; | 231 | psw.mask = mask; |
233 | 232 | ||
234 | #ifndef __s390x__ | 233 | #ifndef __s390x__ |
235 | asm volatile ( | 234 | asm volatile( |
236 | " basr %0,0\n" | 235 | " basr %0,0\n" |
237 | "0: ahi %0,1f-0b\n" | 236 | "0: ahi %0,1f-0b\n" |
238 | " st %0,4(%1)\n" | 237 | " st %0,4(%1)\n" |
239 | " lpsw 0(%1)\n" | 238 | " lpsw 0(%1)\n" |
240 | "1:" | 239 | "1:" |
241 | : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc" ); | 240 | : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc"); |
242 | #else /* __s390x__ */ | 241 | #else /* __s390x__ */ |
243 | asm volatile ( | 242 | asm volatile( |
244 | " larl %0,1f\n" | 243 | " larl %0,1f\n" |
245 | " stg %0,8(%1)\n" | 244 | " stg %0,8(%1)\n" |
246 | " lpswe 0(%1)\n" | 245 | " lpswe 0(%1)\n" |
247 | "1:" | 246 | "1:" |
248 | : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc" ); | 247 | : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc"); |
249 | #endif /* __s390x__ */ | 248 | #endif /* __s390x__ */ |
250 | } | 249 | } |
251 | 250 | ||
@@ -274,56 +273,57 @@ static inline void disabled_wait(unsigned long code) | |||
274 | * the processor is dead afterwards | 273 | * the processor is dead afterwards |
275 | */ | 274 | */ |
276 | #ifndef __s390x__ | 275 | #ifndef __s390x__ |
277 | asm volatile (" stctl 0,0,0(%2)\n" | 276 | asm volatile( |
278 | " ni 0(%2),0xef\n" /* switch off protection */ | 277 | " stctl 0,0,0(%2)\n" |
279 | " lctl 0,0,0(%2)\n" | 278 | " ni 0(%2),0xef\n" /* switch off protection */ |
280 | " stpt 0xd8\n" /* store timer */ | 279 | " lctl 0,0,0(%2)\n" |
281 | " stckc 0xe0\n" /* store clock comparator */ | 280 | " stpt 0xd8\n" /* store timer */ |
282 | " stpx 0x108\n" /* store prefix register */ | 281 | " stckc 0xe0\n" /* store clock comparator */ |
283 | " stam 0,15,0x120\n" /* store access registers */ | 282 | " stpx 0x108\n" /* store prefix register */ |
284 | " std 0,0x160\n" /* store f0 */ | 283 | " stam 0,15,0x120\n" /* store access registers */ |
285 | " std 2,0x168\n" /* store f2 */ | 284 | " std 0,0x160\n" /* store f0 */ |
286 | " std 4,0x170\n" /* store f4 */ | 285 | " std 2,0x168\n" /* store f2 */ |
287 | " std 6,0x178\n" /* store f6 */ | 286 | " std 4,0x170\n" /* store f4 */ |
288 | " stm 0,15,0x180\n" /* store general registers */ | 287 | " std 6,0x178\n" /* store f6 */ |
289 | " stctl 0,15,0x1c0\n" /* store control registers */ | 288 | " stm 0,15,0x180\n" /* store general registers */ |
290 | " oi 0x1c0,0x10\n" /* fake protection bit */ | 289 | " stctl 0,15,0x1c0\n" /* store control registers */ |
291 | " lpsw 0(%1)" | 290 | " oi 0x1c0,0x10\n" /* fake protection bit */ |
292 | : "=m" (ctl_buf) | 291 | " lpsw 0(%1)" |
293 | : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc" ); | 292 | : "=m" (ctl_buf) |
293 | : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc"); | ||
294 | #else /* __s390x__ */ | 294 | #else /* __s390x__ */ |
295 | asm volatile (" stctg 0,0,0(%2)\n" | 295 | asm volatile( |
296 | " ni 4(%2),0xef\n" /* switch off protection */ | 296 | " stctg 0,0,0(%2)\n" |
297 | " lctlg 0,0,0(%2)\n" | 297 | " ni 4(%2),0xef\n" /* switch off protection */ |
298 | " lghi 1,0x1000\n" | 298 | " lctlg 0,0,0(%2)\n" |
299 | " stpt 0x328(1)\n" /* store timer */ | 299 | " lghi 1,0x1000\n" |
300 | " stckc 0x330(1)\n" /* store clock comparator */ | 300 | " stpt 0x328(1)\n" /* store timer */ |
301 | " stpx 0x318(1)\n" /* store prefix register */ | 301 | " stckc 0x330(1)\n" /* store clock comparator */ |
302 | " stam 0,15,0x340(1)\n" /* store access registers */ | 302 | " stpx 0x318(1)\n" /* store prefix register */ |
303 | " stfpc 0x31c(1)\n" /* store fpu control */ | 303 | " stam 0,15,0x340(1)\n"/* store access registers */ |
304 | " std 0,0x200(1)\n" /* store f0 */ | 304 | " stfpc 0x31c(1)\n" /* store fpu control */ |
305 | " std 1,0x208(1)\n" /* store f1 */ | 305 | " std 0,0x200(1)\n" /* store f0 */ |
306 | " std 2,0x210(1)\n" /* store f2 */ | 306 | " std 1,0x208(1)\n" /* store f1 */ |
307 | " std 3,0x218(1)\n" /* store f3 */ | 307 | " std 2,0x210(1)\n" /* store f2 */ |
308 | " std 4,0x220(1)\n" /* store f4 */ | 308 | " std 3,0x218(1)\n" /* store f3 */ |
309 | " std 5,0x228(1)\n" /* store f5 */ | 309 | " std 4,0x220(1)\n" /* store f4 */ |
310 | " std 6,0x230(1)\n" /* store f6 */ | 310 | " std 5,0x228(1)\n" /* store f5 */ |
311 | " std 7,0x238(1)\n" /* store f7 */ | 311 | " std 6,0x230(1)\n" /* store f6 */ |
312 | " std 8,0x240(1)\n" /* store f8 */ | 312 | " std 7,0x238(1)\n" /* store f7 */ |
313 | " std 9,0x248(1)\n" /* store f9 */ | 313 | " std 8,0x240(1)\n" /* store f8 */ |
314 | " std 10,0x250(1)\n" /* store f10 */ | 314 | " std 9,0x248(1)\n" /* store f9 */ |
315 | " std 11,0x258(1)\n" /* store f11 */ | 315 | " std 10,0x250(1)\n" /* store f10 */ |
316 | " std 12,0x260(1)\n" /* store f12 */ | 316 | " std 11,0x258(1)\n" /* store f11 */ |
317 | " std 13,0x268(1)\n" /* store f13 */ | 317 | " std 12,0x260(1)\n" /* store f12 */ |
318 | " std 14,0x270(1)\n" /* store f14 */ | 318 | " std 13,0x268(1)\n" /* store f13 */ |
319 | " std 15,0x278(1)\n" /* store f15 */ | 319 | " std 14,0x270(1)\n" /* store f14 */ |
320 | " stmg 0,15,0x280(1)\n" /* store general registers */ | 320 | " std 15,0x278(1)\n" /* store f15 */ |
321 | " stctg 0,15,0x380(1)\n" /* store control registers */ | 321 | " stmg 0,15,0x280(1)\n"/* store general registers */ |
322 | " oi 0x384(1),0x10\n" /* fake protection bit */ | 322 | " stctg 0,15,0x380(1)\n"/* store control registers */ |
323 | " lpswe 0(%1)" | 323 | " oi 0x384(1),0x10\n"/* fake protection bit */ |
324 | : "=m" (ctl_buf) | 324 | " lpswe 0(%1)" |
325 | : "a" (&dw_psw), "a" (&ctl_buf), | 325 | : "=m" (ctl_buf) |
326 | "m" (dw_psw) : "cc", "0", "1"); | 326 | : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc", "0"); |
327 | #endif /* __s390x__ */ | 327 | #endif /* __s390x__ */ |
328 | } | 328 | } |
329 | 329 | ||
diff --git a/include/asm-s390/ptrace.h b/include/asm-s390/ptrace.h index 4d75d77b0f99..8d2bf65b0b64 100644 --- a/include/asm-s390/ptrace.h +++ b/include/asm-s390/ptrace.h | |||
@@ -479,7 +479,7 @@ extern void show_regs(struct pt_regs * regs); | |||
479 | static inline void | 479 | static inline void |
480 | psw_set_key(unsigned int key) | 480 | psw_set_key(unsigned int key) |
481 | { | 481 | { |
482 | asm volatile ( "spka 0(%0)" : : "d" (key) ); | 482 | asm volatile("spka 0(%0)" : : "d" (key)); |
483 | } | 483 | } |
484 | 484 | ||
485 | #endif /* __ASSEMBLY__ */ | 485 | #endif /* __ASSEMBLY__ */ |
diff --git a/include/asm-s390/rwsem.h b/include/asm-s390/rwsem.h index 13ec16965150..90f4eccaa290 100644 --- a/include/asm-s390/rwsem.h +++ b/include/asm-s390/rwsem.h | |||
@@ -122,23 +122,23 @@ static inline void __down_read(struct rw_semaphore *sem) | |||
122 | { | 122 | { |
123 | signed long old, new; | 123 | signed long old, new; |
124 | 124 | ||
125 | __asm__ __volatile__( | 125 | asm volatile( |
126 | #ifndef __s390x__ | 126 | #ifndef __s390x__ |
127 | " l %0,0(%3)\n" | 127 | " l %0,0(%3)\n" |
128 | "0: lr %1,%0\n" | 128 | "0: lr %1,%0\n" |
129 | " ahi %1,%5\n" | 129 | " ahi %1,%5\n" |
130 | " cs %0,%1,0(%3)\n" | 130 | " cs %0,%1,0(%3)\n" |
131 | " jl 0b" | 131 | " jl 0b" |
132 | #else /* __s390x__ */ | 132 | #else /* __s390x__ */ |
133 | " lg %0,0(%3)\n" | 133 | " lg %0,0(%3)\n" |
134 | "0: lgr %1,%0\n" | 134 | "0: lgr %1,%0\n" |
135 | " aghi %1,%5\n" | 135 | " aghi %1,%5\n" |
136 | " csg %0,%1,0(%3)\n" | 136 | " csg %0,%1,0(%3)\n" |
137 | " jl 0b" | 137 | " jl 0b" |
138 | #endif /* __s390x__ */ | 138 | #endif /* __s390x__ */ |
139 | : "=&d" (old), "=&d" (new), "=m" (sem->count) | 139 | : "=&d" (old), "=&d" (new), "=m" (sem->count) |
140 | : "a" (&sem->count), "m" (sem->count), | 140 | : "a" (&sem->count), "m" (sem->count), |
141 | "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory" ); | 141 | "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory"); |
142 | if (old < 0) | 142 | if (old < 0) |
143 | rwsem_down_read_failed(sem); | 143 | rwsem_down_read_failed(sem); |
144 | } | 144 | } |
@@ -150,27 +150,27 @@ static inline int __down_read_trylock(struct rw_semaphore *sem) | |||
150 | { | 150 | { |
151 | signed long old, new; | 151 | signed long old, new; |
152 | 152 | ||
153 | __asm__ __volatile__( | 153 | asm volatile( |
154 | #ifndef __s390x__ | 154 | #ifndef __s390x__ |
155 | " l %0,0(%3)\n" | 155 | " l %0,0(%3)\n" |
156 | "0: ltr %1,%0\n" | 156 | "0: ltr %1,%0\n" |
157 | " jm 1f\n" | 157 | " jm 1f\n" |
158 | " ahi %1,%5\n" | 158 | " ahi %1,%5\n" |
159 | " cs %0,%1,0(%3)\n" | 159 | " cs %0,%1,0(%3)\n" |
160 | " jl 0b\n" | 160 | " jl 0b\n" |
161 | "1:" | 161 | "1:" |
162 | #else /* __s390x__ */ | 162 | #else /* __s390x__ */ |
163 | " lg %0,0(%3)\n" | 163 | " lg %0,0(%3)\n" |
164 | "0: ltgr %1,%0\n" | 164 | "0: ltgr %1,%0\n" |
165 | " jm 1f\n" | 165 | " jm 1f\n" |
166 | " aghi %1,%5\n" | 166 | " aghi %1,%5\n" |
167 | " csg %0,%1,0(%3)\n" | 167 | " csg %0,%1,0(%3)\n" |
168 | " jl 0b\n" | 168 | " jl 0b\n" |
169 | "1:" | 169 | "1:" |
170 | #endif /* __s390x__ */ | 170 | #endif /* __s390x__ */ |
171 | : "=&d" (old), "=&d" (new), "=m" (sem->count) | 171 | : "=&d" (old), "=&d" (new), "=m" (sem->count) |
172 | : "a" (&sem->count), "m" (sem->count), | 172 | : "a" (&sem->count), "m" (sem->count), |
173 | "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory" ); | 173 | "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory"); |
174 | return old >= 0 ? 1 : 0; | 174 | return old >= 0 ? 1 : 0; |
175 | } | 175 | } |
176 | 176 | ||
@@ -182,23 +182,23 @@ static inline void __down_write_nested(struct rw_semaphore *sem, int subclass) | |||
182 | signed long old, new, tmp; | 182 | signed long old, new, tmp; |
183 | 183 | ||
184 | tmp = RWSEM_ACTIVE_WRITE_BIAS; | 184 | tmp = RWSEM_ACTIVE_WRITE_BIAS; |
185 | __asm__ __volatile__( | 185 | asm volatile( |
186 | #ifndef __s390x__ | 186 | #ifndef __s390x__ |
187 | " l %0,0(%3)\n" | 187 | " l %0,0(%3)\n" |
188 | "0: lr %1,%0\n" | 188 | "0: lr %1,%0\n" |
189 | " a %1,%5\n" | 189 | " a %1,%5\n" |
190 | " cs %0,%1,0(%3)\n" | 190 | " cs %0,%1,0(%3)\n" |
191 | " jl 0b" | 191 | " jl 0b" |
192 | #else /* __s390x__ */ | 192 | #else /* __s390x__ */ |
193 | " lg %0,0(%3)\n" | 193 | " lg %0,0(%3)\n" |
194 | "0: lgr %1,%0\n" | 194 | "0: lgr %1,%0\n" |
195 | " ag %1,%5\n" | 195 | " ag %1,%5\n" |
196 | " csg %0,%1,0(%3)\n" | 196 | " csg %0,%1,0(%3)\n" |
197 | " jl 0b" | 197 | " jl 0b" |
198 | #endif /* __s390x__ */ | 198 | #endif /* __s390x__ */ |
199 | : "=&d" (old), "=&d" (new), "=m" (sem->count) | 199 | : "=&d" (old), "=&d" (new), "=m" (sem->count) |
200 | : "a" (&sem->count), "m" (sem->count), "m" (tmp) | 200 | : "a" (&sem->count), "m" (sem->count), "m" (tmp) |
201 | : "cc", "memory" ); | 201 | : "cc", "memory"); |
202 | if (old != 0) | 202 | if (old != 0) |
203 | rwsem_down_write_failed(sem); | 203 | rwsem_down_write_failed(sem); |
204 | } | 204 | } |
@@ -215,24 +215,24 @@ static inline int __down_write_trylock(struct rw_semaphore *sem) | |||
215 | { | 215 | { |
216 | signed long old; | 216 | signed long old; |
217 | 217 | ||
218 | __asm__ __volatile__( | 218 | asm volatile( |
219 | #ifndef __s390x__ | 219 | #ifndef __s390x__ |
220 | " l %0,0(%2)\n" | 220 | " l %0,0(%2)\n" |
221 | "0: ltr %0,%0\n" | 221 | "0: ltr %0,%0\n" |
222 | " jnz 1f\n" | 222 | " jnz 1f\n" |
223 | " cs %0,%4,0(%2)\n" | 223 | " cs %0,%4,0(%2)\n" |
224 | " jl 0b\n" | 224 | " jl 0b\n" |
225 | #else /* __s390x__ */ | 225 | #else /* __s390x__ */ |
226 | " lg %0,0(%2)\n" | 226 | " lg %0,0(%2)\n" |
227 | "0: ltgr %0,%0\n" | 227 | "0: ltgr %0,%0\n" |
228 | " jnz 1f\n" | 228 | " jnz 1f\n" |
229 | " csg %0,%4,0(%2)\n" | 229 | " csg %0,%4,0(%2)\n" |
230 | " jl 0b\n" | 230 | " jl 0b\n" |
231 | #endif /* __s390x__ */ | 231 | #endif /* __s390x__ */ |
232 | "1:" | 232 | "1:" |
233 | : "=&d" (old), "=m" (sem->count) | 233 | : "=&d" (old), "=m" (sem->count) |
234 | : "a" (&sem->count), "m" (sem->count), | 234 | : "a" (&sem->count), "m" (sem->count), |
235 | "d" (RWSEM_ACTIVE_WRITE_BIAS) : "cc", "memory" ); | 235 | "d" (RWSEM_ACTIVE_WRITE_BIAS) : "cc", "memory"); |
236 | return (old == RWSEM_UNLOCKED_VALUE) ? 1 : 0; | 236 | return (old == RWSEM_UNLOCKED_VALUE) ? 1 : 0; |
237 | } | 237 | } |
238 | 238 | ||
@@ -243,24 +243,24 @@ static inline void __up_read(struct rw_semaphore *sem) | |||
243 | { | 243 | { |
244 | signed long old, new; | 244 | signed long old, new; |
245 | 245 | ||
246 | __asm__ __volatile__( | 246 | asm volatile( |
247 | #ifndef __s390x__ | 247 | #ifndef __s390x__ |
248 | " l %0,0(%3)\n" | 248 | " l %0,0(%3)\n" |
249 | "0: lr %1,%0\n" | 249 | "0: lr %1,%0\n" |
250 | " ahi %1,%5\n" | 250 | " ahi %1,%5\n" |
251 | " cs %0,%1,0(%3)\n" | 251 | " cs %0,%1,0(%3)\n" |
252 | " jl 0b" | 252 | " jl 0b" |
253 | #else /* __s390x__ */ | 253 | #else /* __s390x__ */ |
254 | " lg %0,0(%3)\n" | 254 | " lg %0,0(%3)\n" |
255 | "0: lgr %1,%0\n" | 255 | "0: lgr %1,%0\n" |
256 | " aghi %1,%5\n" | 256 | " aghi %1,%5\n" |
257 | " csg %0,%1,0(%3)\n" | 257 | " csg %0,%1,0(%3)\n" |
258 | " jl 0b" | 258 | " jl 0b" |
259 | #endif /* __s390x__ */ | 259 | #endif /* __s390x__ */ |
260 | : "=&d" (old), "=&d" (new), "=m" (sem->count) | 260 | : "=&d" (old), "=&d" (new), "=m" (sem->count) |
261 | : "a" (&sem->count), "m" (sem->count), | 261 | : "a" (&sem->count), "m" (sem->count), |
262 | "i" (-RWSEM_ACTIVE_READ_BIAS) | 262 | "i" (-RWSEM_ACTIVE_READ_BIAS) |
263 | : "cc", "memory" ); | 263 | : "cc", "memory"); |
264 | if (new < 0) | 264 | if (new < 0) |
265 | if ((new & RWSEM_ACTIVE_MASK) == 0) | 265 | if ((new & RWSEM_ACTIVE_MASK) == 0) |
266 | rwsem_wake(sem); | 266 | rwsem_wake(sem); |
@@ -274,23 +274,23 @@ static inline void __up_write(struct rw_semaphore *sem) | |||
274 | signed long old, new, tmp; | 274 | signed long old, new, tmp; |
275 | 275 | ||
276 | tmp = -RWSEM_ACTIVE_WRITE_BIAS; | 276 | tmp = -RWSEM_ACTIVE_WRITE_BIAS; |
277 | __asm__ __volatile__( | 277 | asm volatile( |
278 | #ifndef __s390x__ | 278 | #ifndef __s390x__ |
279 | " l %0,0(%3)\n" | 279 | " l %0,0(%3)\n" |
280 | "0: lr %1,%0\n" | 280 | "0: lr %1,%0\n" |
281 | " a %1,%5\n" | 281 | " a %1,%5\n" |
282 | " cs %0,%1,0(%3)\n" | 282 | " cs %0,%1,0(%3)\n" |
283 | " jl 0b" | 283 | " jl 0b" |
284 | #else /* __s390x__ */ | 284 | #else /* __s390x__ */ |
285 | " lg %0,0(%3)\n" | 285 | " lg %0,0(%3)\n" |
286 | "0: lgr %1,%0\n" | 286 | "0: lgr %1,%0\n" |
287 | " ag %1,%5\n" | 287 | " ag %1,%5\n" |
288 | " csg %0,%1,0(%3)\n" | 288 | " csg %0,%1,0(%3)\n" |
289 | " jl 0b" | 289 | " jl 0b" |
290 | #endif /* __s390x__ */ | 290 | #endif /* __s390x__ */ |
291 | : "=&d" (old), "=&d" (new), "=m" (sem->count) | 291 | : "=&d" (old), "=&d" (new), "=m" (sem->count) |
292 | : "a" (&sem->count), "m" (sem->count), "m" (tmp) | 292 | : "a" (&sem->count), "m" (sem->count), "m" (tmp) |
293 | : "cc", "memory" ); | 293 | : "cc", "memory"); |
294 | if (new < 0) | 294 | if (new < 0) |
295 | if ((new & RWSEM_ACTIVE_MASK) == 0) | 295 | if ((new & RWSEM_ACTIVE_MASK) == 0) |
296 | rwsem_wake(sem); | 296 | rwsem_wake(sem); |
@@ -304,23 +304,23 @@ static inline void __downgrade_write(struct rw_semaphore *sem) | |||
304 | signed long old, new, tmp; | 304 | signed long old, new, tmp; |
305 | 305 | ||
306 | tmp = -RWSEM_WAITING_BIAS; | 306 | tmp = -RWSEM_WAITING_BIAS; |
307 | __asm__ __volatile__( | 307 | asm volatile( |
308 | #ifndef __s390x__ | 308 | #ifndef __s390x__ |
309 | " l %0,0(%3)\n" | 309 | " l %0,0(%3)\n" |
310 | "0: lr %1,%0\n" | 310 | "0: lr %1,%0\n" |
311 | " a %1,%5\n" | 311 | " a %1,%5\n" |
312 | " cs %0,%1,0(%3)\n" | 312 | " cs %0,%1,0(%3)\n" |
313 | " jl 0b" | 313 | " jl 0b" |
314 | #else /* __s390x__ */ | 314 | #else /* __s390x__ */ |
315 | " lg %0,0(%3)\n" | 315 | " lg %0,0(%3)\n" |
316 | "0: lgr %1,%0\n" | 316 | "0: lgr %1,%0\n" |
317 | " ag %1,%5\n" | 317 | " ag %1,%5\n" |
318 | " csg %0,%1,0(%3)\n" | 318 | " csg %0,%1,0(%3)\n" |
319 | " jl 0b" | 319 | " jl 0b" |
320 | #endif /* __s390x__ */ | 320 | #endif /* __s390x__ */ |
321 | : "=&d" (old), "=&d" (new), "=m" (sem->count) | 321 | : "=&d" (old), "=&d" (new), "=m" (sem->count) |
322 | : "a" (&sem->count), "m" (sem->count), "m" (tmp) | 322 | : "a" (&sem->count), "m" (sem->count), "m" (tmp) |
323 | : "cc", "memory" ); | 323 | : "cc", "memory"); |
324 | if (new > 1) | 324 | if (new > 1) |
325 | rwsem_downgrade_wake(sem); | 325 | rwsem_downgrade_wake(sem); |
326 | } | 326 | } |
@@ -332,23 +332,23 @@ static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem) | |||
332 | { | 332 | { |
333 | signed long old, new; | 333 | signed long old, new; |
334 | 334 | ||
335 | __asm__ __volatile__( | 335 | asm volatile( |
336 | #ifndef __s390x__ | 336 | #ifndef __s390x__ |
337 | " l %0,0(%3)\n" | 337 | " l %0,0(%3)\n" |
338 | "0: lr %1,%0\n" | 338 | "0: lr %1,%0\n" |
339 | " ar %1,%5\n" | 339 | " ar %1,%5\n" |
340 | " cs %0,%1,0(%3)\n" | 340 | " cs %0,%1,0(%3)\n" |
341 | " jl 0b" | 341 | " jl 0b" |
342 | #else /* __s390x__ */ | 342 | #else /* __s390x__ */ |
343 | " lg %0,0(%3)\n" | 343 | " lg %0,0(%3)\n" |
344 | "0: lgr %1,%0\n" | 344 | "0: lgr %1,%0\n" |
345 | " agr %1,%5\n" | 345 | " agr %1,%5\n" |
346 | " csg %0,%1,0(%3)\n" | 346 | " csg %0,%1,0(%3)\n" |
347 | " jl 0b" | 347 | " jl 0b" |
348 | #endif /* __s390x__ */ | 348 | #endif /* __s390x__ */ |
349 | : "=&d" (old), "=&d" (new), "=m" (sem->count) | 349 | : "=&d" (old), "=&d" (new), "=m" (sem->count) |
350 | : "a" (&sem->count), "m" (sem->count), "d" (delta) | 350 | : "a" (&sem->count), "m" (sem->count), "d" (delta) |
351 | : "cc", "memory" ); | 351 | : "cc", "memory"); |
352 | } | 352 | } |
353 | 353 | ||
354 | /* | 354 | /* |
@@ -358,23 +358,23 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem) | |||
358 | { | 358 | { |
359 | signed long old, new; | 359 | signed long old, new; |
360 | 360 | ||
361 | __asm__ __volatile__( | 361 | asm volatile( |
362 | #ifndef __s390x__ | 362 | #ifndef __s390x__ |
363 | " l %0,0(%3)\n" | 363 | " l %0,0(%3)\n" |
364 | "0: lr %1,%0\n" | 364 | "0: lr %1,%0\n" |
365 | " ar %1,%5\n" | 365 | " ar %1,%5\n" |
366 | " cs %0,%1,0(%3)\n" | 366 | " cs %0,%1,0(%3)\n" |
367 | " jl 0b" | 367 | " jl 0b" |
368 | #else /* __s390x__ */ | 368 | #else /* __s390x__ */ |
369 | " lg %0,0(%3)\n" | 369 | " lg %0,0(%3)\n" |
370 | "0: lgr %1,%0\n" | 370 | "0: lgr %1,%0\n" |
371 | " agr %1,%5\n" | 371 | " agr %1,%5\n" |
372 | " csg %0,%1,0(%3)\n" | 372 | " csg %0,%1,0(%3)\n" |
373 | " jl 0b" | 373 | " jl 0b" |
374 | #endif /* __s390x__ */ | 374 | #endif /* __s390x__ */ |
375 | : "=&d" (old), "=&d" (new), "=m" (sem->count) | 375 | : "=&d" (old), "=&d" (new), "=m" (sem->count) |
376 | : "a" (&sem->count), "m" (sem->count), "d" (delta) | 376 | : "a" (&sem->count), "m" (sem->count), "d" (delta) |
377 | : "cc", "memory" ); | 377 | : "cc", "memory"); |
378 | return new; | 378 | return new; |
379 | } | 379 | } |
380 | 380 | ||
diff --git a/include/asm-s390/semaphore.h b/include/asm-s390/semaphore.h index 32cdc69f39f4..dbce058aefa9 100644 --- a/include/asm-s390/semaphore.h +++ b/include/asm-s390/semaphore.h | |||
@@ -85,17 +85,17 @@ static inline int down_trylock(struct semaphore * sem) | |||
85 | * sem->count.counter = --new_val; | 85 | * sem->count.counter = --new_val; |
86 | * In the ppc code this is called atomic_dec_if_positive. | 86 | * In the ppc code this is called atomic_dec_if_positive. |
87 | */ | 87 | */ |
88 | __asm__ __volatile__ ( | 88 | asm volatile( |
89 | " l %0,0(%3)\n" | 89 | " l %0,0(%3)\n" |
90 | "0: ltr %1,%0\n" | 90 | "0: ltr %1,%0\n" |
91 | " jle 1f\n" | 91 | " jle 1f\n" |
92 | " ahi %1,-1\n" | 92 | " ahi %1,-1\n" |
93 | " cs %0,%1,0(%3)\n" | 93 | " cs %0,%1,0(%3)\n" |
94 | " jl 0b\n" | 94 | " jl 0b\n" |
95 | "1:" | 95 | "1:" |
96 | : "=&d" (old_val), "=&d" (new_val), "=m" (sem->count.counter) | 96 | : "=&d" (old_val), "=&d" (new_val), "=m" (sem->count.counter) |
97 | : "a" (&sem->count.counter), "m" (sem->count.counter) | 97 | : "a" (&sem->count.counter), "m" (sem->count.counter) |
98 | : "cc", "memory" ); | 98 | : "cc", "memory"); |
99 | return old_val <= 0; | 99 | return old_val <= 0; |
100 | } | 100 | } |
101 | 101 | ||
diff --git a/include/asm-s390/sfp-machine.h b/include/asm-s390/sfp-machine.h index de69dfa46fbb..8ca8c77b2d04 100644 --- a/include/asm-s390/sfp-machine.h +++ b/include/asm-s390/sfp-machine.h | |||
@@ -76,21 +76,23 @@ | |||
76 | unsigned int __r2 = (x2) + (y2); \ | 76 | unsigned int __r2 = (x2) + (y2); \ |
77 | unsigned int __r1 = (x1); \ | 77 | unsigned int __r1 = (x1); \ |
78 | unsigned int __r0 = (x0); \ | 78 | unsigned int __r0 = (x0); \ |
79 | __asm__ (" alr %2,%3\n" \ | 79 | asm volatile( \ |
80 | " brc 12,0f\n" \ | 80 | " alr %2,%3\n" \ |
81 | " lhi 0,1\n" \ | 81 | " brc 12,0f\n" \ |
82 | " alr %1,0\n" \ | 82 | " lhi 0,1\n" \ |
83 | " brc 12,0f\n" \ | 83 | " alr %1,0\n" \ |
84 | " alr %0,0\n" \ | 84 | " brc 12,0f\n" \ |
85 | "0:" \ | 85 | " alr %0,0\n" \ |
86 | : "+&d" (__r2), "+&d" (__r1), "+&d" (__r0) \ | 86 | "0:" \ |
87 | : "d" (y0), "i" (1) : "cc", "0" ); \ | 87 | : "+&d" (__r2), "+&d" (__r1), "+&d" (__r0) \ |
88 | __asm__ (" alr %1,%2\n" \ | 88 | : "d" (y0), "i" (1) : "cc", "0" ); \ |
89 | " brc 12,0f\n" \ | 89 | asm volatile( \ |
90 | " ahi %0,1\n" \ | 90 | " alr %1,%2\n" \ |
91 | "0:" \ | 91 | " brc 12,0f\n" \ |
92 | : "+&d" (__r2), "+&d" (__r1) \ | 92 | " ahi %0,1\n" \ |
93 | : "d" (y1) : "cc" ); \ | 93 | "0:" \ |
94 | : "+&d" (__r2), "+&d" (__r1) \ | ||
95 | : "d" (y1) : "cc"); \ | ||
94 | (r2) = __r2; \ | 96 | (r2) = __r2; \ |
95 | (r1) = __r1; \ | 97 | (r1) = __r1; \ |
96 | (r0) = __r0; \ | 98 | (r0) = __r0; \ |
@@ -100,21 +102,23 @@ | |||
100 | unsigned int __r2 = (x2) - (y2); \ | 102 | unsigned int __r2 = (x2) - (y2); \ |
101 | unsigned int __r1 = (x1); \ | 103 | unsigned int __r1 = (x1); \ |
102 | unsigned int __r0 = (x0); \ | 104 | unsigned int __r0 = (x0); \ |
103 | __asm__ (" slr %2,%3\n" \ | 105 | asm volatile( \ |
104 | " brc 3,0f\n" \ | 106 | " slr %2,%3\n" \ |
105 | " lhi 0,1\n" \ | 107 | " brc 3,0f\n" \ |
106 | " slr %1,0\n" \ | 108 | " lhi 0,1\n" \ |
107 | " brc 3,0f\n" \ | 109 | " slr %1,0\n" \ |
108 | " slr %0,0\n" \ | 110 | " brc 3,0f\n" \ |
109 | "0:" \ | 111 | " slr %0,0\n" \ |
110 | : "+&d" (__r2), "+&d" (__r1), "+&d" (__r0) \ | 112 | "0:" \ |
111 | : "d" (y0) : "cc", "0" ); \ | 113 | : "+&d" (__r2), "+&d" (__r1), "+&d" (__r0) \ |
112 | __asm__ (" slr %1,%2\n" \ | 114 | : "d" (y0) : "cc", "0"); \ |
113 | " brc 3,0f\n" \ | 115 | asm volatile( \ |
114 | " ahi %0,-1\n" \ | 116 | " slr %1,%2\n" \ |
115 | "0:" \ | 117 | " brc 3,0f\n" \ |
116 | : "+&d" (__r2), "+&d" (__r1) \ | 118 | " ahi %0,-1\n" \ |
117 | : "d" (y1) : "cc" ); \ | 119 | "0:" \ |
120 | : "+&d" (__r2), "+&d" (__r1) \ | ||
121 | : "d" (y1) : "cc"); \ | ||
118 | (r2) = __r2; \ | 122 | (r2) = __r2; \ |
119 | (r1) = __r1; \ | 123 | (r1) = __r1; \ |
120 | (r0) = __r0; \ | 124 | (r0) = __r0; \ |
diff --git a/include/asm-s390/sigp.h b/include/asm-s390/sigp.h index fc56458aff66..e16d56f8dfe1 100644 --- a/include/asm-s390/sigp.h +++ b/include/asm-s390/sigp.h | |||
@@ -70,16 +70,16 @@ typedef enum | |||
70 | static inline sigp_ccode | 70 | static inline sigp_ccode |
71 | signal_processor(__u16 cpu_addr, sigp_order_code order_code) | 71 | signal_processor(__u16 cpu_addr, sigp_order_code order_code) |
72 | { | 72 | { |
73 | register unsigned long reg1 asm ("1") = 0; | ||
73 | sigp_ccode ccode; | 74 | sigp_ccode ccode; |
74 | 75 | ||
75 | __asm__ __volatile__( | 76 | asm volatile( |
76 | " sr 1,1\n" /* parameter=0 in gpr 1 */ | 77 | " sigp %1,%2,0(%3)\n" |
77 | " sigp 1,%1,0(%2)\n" | 78 | " ipm %0\n" |
78 | " ipm %0\n" | 79 | " srl %0,28\n" |
79 | " srl %0,28\n" | 80 | : "=d" (ccode) |
80 | : "=d" (ccode) | 81 | : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]), |
81 | : "d" (__cpu_logical_map[cpu_addr]), "a" (order_code) | 82 | "a" (order_code) : "cc" , "memory"); |
82 | : "cc" , "memory", "1" ); | ||
83 | return ccode; | 83 | return ccode; |
84 | } | 84 | } |
85 | 85 | ||
@@ -87,20 +87,18 @@ signal_processor(__u16 cpu_addr, sigp_order_code order_code) | |||
87 | * Signal processor with parameter | 87 | * Signal processor with parameter |
88 | */ | 88 | */ |
89 | static inline sigp_ccode | 89 | static inline sigp_ccode |
90 | signal_processor_p(__u32 parameter, __u16 cpu_addr, | 90 | signal_processor_p(__u32 parameter, __u16 cpu_addr, sigp_order_code order_code) |
91 | sigp_order_code order_code) | ||
92 | { | 91 | { |
92 | register unsigned int reg1 asm ("1") = parameter; | ||
93 | sigp_ccode ccode; | 93 | sigp_ccode ccode; |
94 | 94 | ||
95 | __asm__ __volatile__( | 95 | asm volatile( |
96 | " lr 1,%1\n" /* parameter in gpr 1 */ | 96 | " sigp %1,%2,0(%3)\n" |
97 | " sigp 1,%2,0(%3)\n" | 97 | " ipm %0\n" |
98 | " ipm %0\n" | 98 | " srl %0,28\n" |
99 | " srl %0,28\n" | ||
100 | : "=d" (ccode) | 99 | : "=d" (ccode) |
101 | : "d" (parameter), "d" (__cpu_logical_map[cpu_addr]), | 100 | : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]), |
102 | "a" (order_code) | 101 | "a" (order_code) : "cc" , "memory"); |
103 | : "cc" , "memory", "1" ); | ||
104 | return ccode; | 102 | return ccode; |
105 | } | 103 | } |
106 | 104 | ||
@@ -108,24 +106,21 @@ signal_processor_p(__u32 parameter, __u16 cpu_addr, | |||
108 | * Signal processor with parameter and return status | 106 | * Signal processor with parameter and return status |
109 | */ | 107 | */ |
110 | static inline sigp_ccode | 108 | static inline sigp_ccode |
111 | signal_processor_ps(__u32 *statusptr, __u32 parameter, | 109 | signal_processor_ps(__u32 *statusptr, __u32 parameter, __u16 cpu_addr, |
112 | __u16 cpu_addr, sigp_order_code order_code) | 110 | sigp_order_code order_code) |
113 | { | 111 | { |
112 | register unsigned int reg1 asm ("1") = parameter; | ||
114 | sigp_ccode ccode; | 113 | sigp_ccode ccode; |
115 | 114 | ||
116 | __asm__ __volatile__( | 115 | asm volatile( |
117 | " sr 2,2\n" /* clear status */ | 116 | " sigp %1,%2,0(%3)\n" |
118 | " lr 3,%2\n" /* parameter in gpr 3 */ | 117 | " ipm %0\n" |
119 | " sigp 2,%3,0(%4)\n" | 118 | " srl %0,28\n" |
120 | " st 2,%1\n" | 119 | : "=d" (ccode), "+d" (reg1) |
121 | " ipm %0\n" | 120 | : "d" (__cpu_logical_map[cpu_addr]), "a" (order_code) |
122 | " srl %0,28\n" | 121 | : "cc" , "memory"); |
123 | : "=d" (ccode), "=m" (*statusptr) | 122 | *statusptr = reg1; |
124 | : "d" (parameter), "d" (__cpu_logical_map[cpu_addr]), | 123 | return ccode; |
125 | "a" (order_code) | ||
126 | : "cc" , "memory", "2" , "3" | ||
127 | ); | ||
128 | return ccode; | ||
129 | } | 124 | } |
130 | 125 | ||
131 | #endif /* __SIGP__ */ | 126 | #endif /* __SIGP__ */ |
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h index 9fb02e9779c9..c3cf030ada4d 100644 --- a/include/asm-s390/smp.h +++ b/include/asm-s390/smp.h | |||
@@ -56,7 +56,7 @@ static inline __u16 hard_smp_processor_id(void) | |||
56 | { | 56 | { |
57 | __u16 cpu_address; | 57 | __u16 cpu_address; |
58 | 58 | ||
59 | __asm__ ("stap %0\n" : "=m" (cpu_address)); | 59 | asm volatile("stap %0" : "=m" (cpu_address)); |
60 | return cpu_address; | 60 | return cpu_address; |
61 | } | 61 | } |
62 | 62 | ||
diff --git a/include/asm-s390/spinlock.h b/include/asm-s390/spinlock.h index 273dbecf8ace..ce3edf6d63b3 100644 --- a/include/asm-s390/spinlock.h +++ b/include/asm-s390/spinlock.h | |||
@@ -11,17 +11,36 @@ | |||
11 | #ifndef __ASM_SPINLOCK_H | 11 | #ifndef __ASM_SPINLOCK_H |
12 | #define __ASM_SPINLOCK_H | 12 | #define __ASM_SPINLOCK_H |
13 | 13 | ||
14 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) | ||
15 | |||
16 | static inline int | ||
17 | _raw_compare_and_swap(volatile unsigned int *lock, | ||
18 | unsigned int old, unsigned int new) | ||
19 | { | ||
20 | asm volatile( | ||
21 | " cs %0,%3,%1" | ||
22 | : "=d" (old), "=Q" (*lock) | ||
23 | : "0" (old), "d" (new), "Q" (*lock) | ||
24 | : "cc", "memory" ); | ||
25 | return old; | ||
26 | } | ||
27 | |||
28 | #else /* __GNUC__ */ | ||
29 | |||
14 | static inline int | 30 | static inline int |
15 | _raw_compare_and_swap(volatile unsigned int *lock, | 31 | _raw_compare_and_swap(volatile unsigned int *lock, |
16 | unsigned int old, unsigned int new) | 32 | unsigned int old, unsigned int new) |
17 | { | 33 | { |
18 | asm volatile ("cs %0,%3,0(%4)" | 34 | asm volatile( |
19 | : "=d" (old), "=m" (*lock) | 35 | " cs %0,%3,0(%4)" |
20 | : "0" (old), "d" (new), "a" (lock), "m" (*lock) | 36 | : "=d" (old), "=m" (*lock) |
21 | : "cc", "memory" ); | 37 | : "0" (old), "d" (new), "a" (lock), "m" (*lock) |
38 | : "cc", "memory" ); | ||
22 | return old; | 39 | return old; |
23 | } | 40 | } |
24 | 41 | ||
42 | #endif /* __GNUC__ */ | ||
43 | |||
25 | /* | 44 | /* |
26 | * Simple spin lock operations. There are two variants, one clears IRQ's | 45 | * Simple spin lock operations. There are two variants, one clears IRQ's |
27 | * on the local processor, one does not. | 46 | * on the local processor, one does not. |
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 | ||
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h index 16040048cd1b..ccbafe4bf2cb 100644 --- a/include/asm-s390/system.h +++ b/include/asm-s390/system.h | |||
@@ -23,74 +23,68 @@ struct task_struct; | |||
23 | 23 | ||
24 | extern struct task_struct *__switch_to(void *, void *); | 24 | extern struct task_struct *__switch_to(void *, void *); |
25 | 25 | ||
26 | #ifdef __s390x__ | ||
27 | #define __FLAG_SHIFT 56 | ||
28 | #else /* ! __s390x__ */ | ||
29 | #define __FLAG_SHIFT 24 | ||
30 | #endif /* ! __s390x__ */ | ||
31 | |||
32 | static inline void save_fp_regs(s390_fp_regs *fpregs) | 26 | static inline void save_fp_regs(s390_fp_regs *fpregs) |
33 | { | 27 | { |
34 | asm volatile ( | 28 | asm volatile( |
35 | " std 0,8(%1)\n" | 29 | " std 0,8(%1)\n" |
36 | " std 2,24(%1)\n" | 30 | " std 2,24(%1)\n" |
37 | " std 4,40(%1)\n" | 31 | " std 4,40(%1)\n" |
38 | " std 6,56(%1)" | 32 | " std 6,56(%1)" |
39 | : "=m" (*fpregs) : "a" (fpregs), "m" (*fpregs) : "memory" ); | 33 | : "=m" (*fpregs) : "a" (fpregs), "m" (*fpregs) : "memory"); |
40 | if (!MACHINE_HAS_IEEE) | 34 | if (!MACHINE_HAS_IEEE) |
41 | return; | 35 | return; |
42 | asm volatile( | 36 | asm volatile( |
43 | " stfpc 0(%1)\n" | 37 | " stfpc 0(%1)\n" |
44 | " std 1,16(%1)\n" | 38 | " std 1,16(%1)\n" |
45 | " std 3,32(%1)\n" | 39 | " std 3,32(%1)\n" |
46 | " std 5,48(%1)\n" | 40 | " std 5,48(%1)\n" |
47 | " std 7,64(%1)\n" | 41 | " std 7,64(%1)\n" |
48 | " std 8,72(%1)\n" | 42 | " std 8,72(%1)\n" |
49 | " std 9,80(%1)\n" | 43 | " std 9,80(%1)\n" |
50 | " std 10,88(%1)\n" | 44 | " std 10,88(%1)\n" |
51 | " std 11,96(%1)\n" | 45 | " std 11,96(%1)\n" |
52 | " std 12,104(%1)\n" | 46 | " std 12,104(%1)\n" |
53 | " std 13,112(%1)\n" | 47 | " std 13,112(%1)\n" |
54 | " std 14,120(%1)\n" | 48 | " std 14,120(%1)\n" |
55 | " std 15,128(%1)\n" | 49 | " std 15,128(%1)\n" |
56 | : "=m" (*fpregs) : "a" (fpregs), "m" (*fpregs) : "memory" ); | 50 | : "=m" (*fpregs) : "a" (fpregs), "m" (*fpregs) : "memory"); |
57 | } | 51 | } |
58 | 52 | ||
59 | static inline void restore_fp_regs(s390_fp_regs *fpregs) | 53 | static inline void restore_fp_regs(s390_fp_regs *fpregs) |
60 | { | 54 | { |
61 | asm volatile ( | 55 | asm volatile( |
62 | " ld 0,8(%0)\n" | 56 | " ld 0,8(%0)\n" |
63 | " ld 2,24(%0)\n" | 57 | " ld 2,24(%0)\n" |
64 | " ld 4,40(%0)\n" | 58 | " ld 4,40(%0)\n" |
65 | " ld 6,56(%0)" | 59 | " ld 6,56(%0)" |
66 | : : "a" (fpregs), "m" (*fpregs) ); | 60 | : : "a" (fpregs), "m" (*fpregs)); |
67 | if (!MACHINE_HAS_IEEE) | 61 | if (!MACHINE_HAS_IEEE) |
68 | return; | 62 | return; |
69 | asm volatile( | 63 | asm volatile( |
70 | " lfpc 0(%0)\n" | 64 | " lfpc 0(%0)\n" |
71 | " ld 1,16(%0)\n" | 65 | " ld 1,16(%0)\n" |
72 | " ld 3,32(%0)\n" | 66 | " ld 3,32(%0)\n" |
73 | " ld 5,48(%0)\n" | 67 | " ld 5,48(%0)\n" |
74 | " ld 7,64(%0)\n" | 68 | " ld 7,64(%0)\n" |
75 | " ld 8,72(%0)\n" | 69 | " ld 8,72(%0)\n" |
76 | " ld 9,80(%0)\n" | 70 | " ld 9,80(%0)\n" |
77 | " ld 10,88(%0)\n" | 71 | " ld 10,88(%0)\n" |
78 | " ld 11,96(%0)\n" | 72 | " ld 11,96(%0)\n" |
79 | " ld 12,104(%0)\n" | 73 | " ld 12,104(%0)\n" |
80 | " ld 13,112(%0)\n" | 74 | " ld 13,112(%0)\n" |
81 | " ld 14,120(%0)\n" | 75 | " ld 14,120(%0)\n" |
82 | " ld 15,128(%0)\n" | 76 | " ld 15,128(%0)\n" |
83 | : : "a" (fpregs), "m" (*fpregs) ); | 77 | : : "a" (fpregs), "m" (*fpregs)); |
84 | } | 78 | } |
85 | 79 | ||
86 | static inline void save_access_regs(unsigned int *acrs) | 80 | static inline void save_access_regs(unsigned int *acrs) |
87 | { | 81 | { |
88 | asm volatile ("stam 0,15,0(%0)" : : "a" (acrs) : "memory" ); | 82 | asm volatile("stam 0,15,0(%0)" : : "a" (acrs) : "memory"); |
89 | } | 83 | } |
90 | 84 | ||
91 | static inline void restore_access_regs(unsigned int *acrs) | 85 | static inline void restore_access_regs(unsigned int *acrs) |
92 | { | 86 | { |
93 | asm volatile ("lam 0,15,0(%0)" : : "a" (acrs) ); | 87 | asm volatile("lam 0,15,0(%0)" : : "a" (acrs)); |
94 | } | 88 | } |
95 | 89 | ||
96 | #define switch_to(prev,next,last) do { \ | 90 | #define switch_to(prev,next,last) do { \ |
@@ -126,7 +120,7 @@ extern void account_system_vtime(struct task_struct *); | |||
126 | account_vtime(prev); \ | 120 | account_vtime(prev); \ |
127 | } while (0) | 121 | } while (0) |
128 | 122 | ||
129 | #define nop() __asm__ __volatile__ ("nop") | 123 | #define nop() asm volatile("nop") |
130 | 124 | ||
131 | #define xchg(ptr,x) \ | 125 | #define xchg(ptr,x) \ |
132 | ({ \ | 126 | ({ \ |
@@ -147,15 +141,15 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size) | |||
147 | shift = (3 ^ (addr & 3)) << 3; | 141 | shift = (3 ^ (addr & 3)) << 3; |
148 | addr ^= addr & 3; | 142 | addr ^= addr & 3; |
149 | asm volatile( | 143 | asm volatile( |
150 | " l %0,0(%4)\n" | 144 | " l %0,0(%4)\n" |
151 | "0: lr 0,%0\n" | 145 | "0: lr 0,%0\n" |
152 | " nr 0,%3\n" | 146 | " nr 0,%3\n" |
153 | " or 0,%2\n" | 147 | " or 0,%2\n" |
154 | " cs %0,0,0(%4)\n" | 148 | " cs %0,0,0(%4)\n" |
155 | " jl 0b\n" | 149 | " jl 0b\n" |
156 | : "=&d" (old), "=m" (*(int *) addr) | 150 | : "=&d" (old), "=m" (*(int *) addr) |
157 | : "d" (x << shift), "d" (~(255 << shift)), "a" (addr), | 151 | : "d" (x << shift), "d" (~(255 << shift)), "a" (addr), |
158 | "m" (*(int *) addr) : "memory", "cc", "0" ); | 152 | "m" (*(int *) addr) : "memory", "cc", "0"); |
159 | x = old >> shift; | 153 | x = old >> shift; |
160 | break; | 154 | break; |
161 | case 2: | 155 | case 2: |
@@ -163,36 +157,36 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size) | |||
163 | shift = (2 ^ (addr & 2)) << 3; | 157 | shift = (2 ^ (addr & 2)) << 3; |
164 | addr ^= addr & 2; | 158 | addr ^= addr & 2; |
165 | asm volatile( | 159 | asm volatile( |
166 | " l %0,0(%4)\n" | 160 | " l %0,0(%4)\n" |
167 | "0: lr 0,%0\n" | 161 | "0: lr 0,%0\n" |
168 | " nr 0,%3\n" | 162 | " nr 0,%3\n" |
169 | " or 0,%2\n" | 163 | " or 0,%2\n" |
170 | " cs %0,0,0(%4)\n" | 164 | " cs %0,0,0(%4)\n" |
171 | " jl 0b\n" | 165 | " jl 0b\n" |
172 | : "=&d" (old), "=m" (*(int *) addr) | 166 | : "=&d" (old), "=m" (*(int *) addr) |
173 | : "d" (x << shift), "d" (~(65535 << shift)), "a" (addr), | 167 | : "d" (x << shift), "d" (~(65535 << shift)), "a" (addr), |
174 | "m" (*(int *) addr) : "memory", "cc", "0" ); | 168 | "m" (*(int *) addr) : "memory", "cc", "0"); |
175 | x = old >> shift; | 169 | x = old >> shift; |
176 | break; | 170 | break; |
177 | case 4: | 171 | case 4: |
178 | asm volatile ( | 172 | asm volatile( |
179 | " l %0,0(%3)\n" | 173 | " l %0,0(%3)\n" |
180 | "0: cs %0,%2,0(%3)\n" | 174 | "0: cs %0,%2,0(%3)\n" |
181 | " jl 0b\n" | 175 | " jl 0b\n" |
182 | : "=&d" (old), "=m" (*(int *) ptr) | 176 | : "=&d" (old), "=m" (*(int *) ptr) |
183 | : "d" (x), "a" (ptr), "m" (*(int *) ptr) | 177 | : "d" (x), "a" (ptr), "m" (*(int *) ptr) |
184 | : "memory", "cc" ); | 178 | : "memory", "cc"); |
185 | x = old; | 179 | x = old; |
186 | break; | 180 | break; |
187 | #ifdef __s390x__ | 181 | #ifdef __s390x__ |
188 | case 8: | 182 | case 8: |
189 | asm volatile ( | 183 | asm volatile( |
190 | " lg %0,0(%3)\n" | 184 | " lg %0,0(%3)\n" |
191 | "0: csg %0,%2,0(%3)\n" | 185 | "0: csg %0,%2,0(%3)\n" |
192 | " jl 0b\n" | 186 | " jl 0b\n" |
193 | : "=&d" (old), "=m" (*(long *) ptr) | 187 | : "=&d" (old), "=m" (*(long *) ptr) |
194 | : "d" (x), "a" (ptr), "m" (*(long *) ptr) | 188 | : "d" (x), "a" (ptr), "m" (*(long *) ptr) |
195 | : "memory", "cc" ); | 189 | : "memory", "cc"); |
196 | x = old; | 190 | x = old; |
197 | break; | 191 | break; |
198 | #endif /* __s390x__ */ | 192 | #endif /* __s390x__ */ |
@@ -224,55 +218,55 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | |||
224 | shift = (3 ^ (addr & 3)) << 3; | 218 | shift = (3 ^ (addr & 3)) << 3; |
225 | addr ^= addr & 3; | 219 | addr ^= addr & 3; |
226 | asm volatile( | 220 | asm volatile( |
227 | " l %0,0(%4)\n" | 221 | " l %0,0(%4)\n" |
228 | "0: nr %0,%5\n" | 222 | "0: nr %0,%5\n" |
229 | " lr %1,%0\n" | 223 | " lr %1,%0\n" |
230 | " or %0,%2\n" | 224 | " or %0,%2\n" |
231 | " or %1,%3\n" | 225 | " or %1,%3\n" |
232 | " cs %0,%1,0(%4)\n" | 226 | " cs %0,%1,0(%4)\n" |
233 | " jnl 1f\n" | 227 | " jnl 1f\n" |
234 | " xr %1,%0\n" | 228 | " xr %1,%0\n" |
235 | " nr %1,%5\n" | 229 | " nr %1,%5\n" |
236 | " jnz 0b\n" | 230 | " jnz 0b\n" |
237 | "1:" | 231 | "1:" |
238 | : "=&d" (prev), "=&d" (tmp) | 232 | : "=&d" (prev), "=&d" (tmp) |
239 | : "d" (old << shift), "d" (new << shift), "a" (ptr), | 233 | : "d" (old << shift), "d" (new << shift), "a" (ptr), |
240 | "d" (~(255 << shift)) | 234 | "d" (~(255 << shift)) |
241 | : "memory", "cc" ); | 235 | : "memory", "cc"); |
242 | return prev >> shift; | 236 | return prev >> shift; |
243 | case 2: | 237 | case 2: |
244 | addr = (unsigned long) ptr; | 238 | addr = (unsigned long) ptr; |
245 | shift = (2 ^ (addr & 2)) << 3; | 239 | shift = (2 ^ (addr & 2)) << 3; |
246 | addr ^= addr & 2; | 240 | addr ^= addr & 2; |
247 | asm volatile( | 241 | asm volatile( |
248 | " l %0,0(%4)\n" | 242 | " l %0,0(%4)\n" |
249 | "0: nr %0,%5\n" | 243 | "0: nr %0,%5\n" |
250 | " lr %1,%0\n" | 244 | " lr %1,%0\n" |
251 | " or %0,%2\n" | 245 | " or %0,%2\n" |
252 | " or %1,%3\n" | 246 | " or %1,%3\n" |
253 | " cs %0,%1,0(%4)\n" | 247 | " cs %0,%1,0(%4)\n" |
254 | " jnl 1f\n" | 248 | " jnl 1f\n" |
255 | " xr %1,%0\n" | 249 | " xr %1,%0\n" |
256 | " nr %1,%5\n" | 250 | " nr %1,%5\n" |
257 | " jnz 0b\n" | 251 | " jnz 0b\n" |
258 | "1:" | 252 | "1:" |
259 | : "=&d" (prev), "=&d" (tmp) | 253 | : "=&d" (prev), "=&d" (tmp) |
260 | : "d" (old << shift), "d" (new << shift), "a" (ptr), | 254 | : "d" (old << shift), "d" (new << shift), "a" (ptr), |
261 | "d" (~(65535 << shift)) | 255 | "d" (~(65535 << shift)) |
262 | : "memory", "cc" ); | 256 | : "memory", "cc"); |
263 | return prev >> shift; | 257 | return prev >> shift; |
264 | case 4: | 258 | case 4: |
265 | asm volatile ( | 259 | asm volatile( |
266 | " cs %0,%2,0(%3)\n" | 260 | " cs %0,%2,0(%3)\n" |
267 | : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr) | 261 | : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr) |
268 | : "memory", "cc" ); | 262 | : "memory", "cc"); |
269 | return prev; | 263 | return prev; |
270 | #ifdef __s390x__ | 264 | #ifdef __s390x__ |
271 | case 8: | 265 | case 8: |
272 | asm volatile ( | 266 | asm volatile( |
273 | " csg %0,%2,0(%3)\n" | 267 | " csg %0,%2,0(%3)\n" |
274 | : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr) | 268 | : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr) |
275 | : "memory", "cc" ); | 269 | : "memory", "cc"); |
276 | return prev; | 270 | return prev; |
277 | #endif /* __s390x__ */ | 271 | #endif /* __s390x__ */ |
278 | } | 272 | } |
@@ -289,8 +283,8 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | |||
289 | * all memory ops have completed wrt other CPU's ( see 7-15 POP DJB ). | 283 | * all memory ops have completed wrt other CPU's ( see 7-15 POP DJB ). |
290 | */ | 284 | */ |
291 | 285 | ||
292 | #define eieio() __asm__ __volatile__ ( "bcr 15,0" : : : "memory" ) | 286 | #define eieio() asm volatile("bcr 15,0" : : : "memory") |
293 | # define SYNC_OTHER_CORES(x) eieio() | 287 | #define SYNC_OTHER_CORES(x) eieio() |
294 | #define mb() eieio() | 288 | #define mb() eieio() |
295 | #define rmb() eieio() | 289 | #define rmb() eieio() |
296 | #define wmb() eieio() | 290 | #define wmb() eieio() |
@@ -307,117 +301,56 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | |||
307 | 301 | ||
308 | #ifdef __s390x__ | 302 | #ifdef __s390x__ |
309 | 303 | ||
310 | #define __ctl_load(array, low, high) ({ \ | 304 | #define __ctl_load(array, low, high) ({ \ |
311 | typedef struct { char _[sizeof(array)]; } addrtype; \ | 305 | typedef struct { char _[sizeof(array)]; } addrtype; \ |
312 | __asm__ __volatile__ ( \ | 306 | asm volatile( \ |
313 | " bras 1,0f\n" \ | 307 | " lctlg %1,%2,0(%0)\n" \ |
314 | " lctlg 0,0,0(%0)\n" \ | 308 | : : "a" (&array), "i" (low), "i" (high), \ |
315 | "0: ex %1,0(1)" \ | 309 | "m" (*(addrtype *)(array))); \ |
316 | : : "a" (&array), "a" (((low)<<4)+(high)), \ | ||
317 | "m" (*(addrtype *)(array)) : "1" ); \ | ||
318 | }) | 310 | }) |
319 | 311 | ||
320 | #define __ctl_store(array, low, high) ({ \ | 312 | #define __ctl_store(array, low, high) ({ \ |
321 | typedef struct { char _[sizeof(array)]; } addrtype; \ | 313 | typedef struct { char _[sizeof(array)]; } addrtype; \ |
322 | __asm__ __volatile__ ( \ | 314 | asm volatile( \ |
323 | " bras 1,0f\n" \ | 315 | " stctg %2,%3,0(%1)\n" \ |
324 | " stctg 0,0,0(%1)\n" \ | 316 | : "=m" (*(addrtype *)(array)) \ |
325 | "0: ex %2,0(1)" \ | 317 | : "a" (&array), "i" (low), "i" (high)); \ |
326 | : "=m" (*(addrtype *)(array)) \ | ||
327 | : "a" (&array), "a" (((low)<<4)+(high)) : "1" ); \ | ||
328 | }) | 318 | }) |
329 | 319 | ||
330 | #define __ctl_set_bit(cr, bit) ({ \ | ||
331 | __u8 __dummy[24]; \ | ||
332 | __asm__ __volatile__ ( \ | ||
333 | " bras 1,0f\n" /* skip indirect insns */ \ | ||
334 | " stctg 0,0,0(%1)\n" \ | ||
335 | " lctlg 0,0,0(%1)\n" \ | ||
336 | "0: ex %2,0(1)\n" /* execute stctl */ \ | ||
337 | " lg 0,0(%1)\n" \ | ||
338 | " ogr 0,%3\n" /* set the bit */ \ | ||
339 | " stg 0,0(%1)\n" \ | ||
340 | "1: ex %2,6(1)" /* execute lctl */ \ | ||
341 | : "=m" (__dummy) \ | ||
342 | : "a" ((((unsigned long) &__dummy) + 7) & ~7UL), \ | ||
343 | "a" (cr*17), "a" (1L<<(bit)) \ | ||
344 | : "cc", "0", "1" ); \ | ||
345 | }) | ||
346 | |||
347 | #define __ctl_clear_bit(cr, bit) ({ \ | ||
348 | __u8 __dummy[16]; \ | ||
349 | __asm__ __volatile__ ( \ | ||
350 | " bras 1,0f\n" /* skip indirect insns */ \ | ||
351 | " stctg 0,0,0(%1)\n" \ | ||
352 | " lctlg 0,0,0(%1)\n" \ | ||
353 | "0: ex %2,0(1)\n" /* execute stctl */ \ | ||
354 | " lg 0,0(%1)\n" \ | ||
355 | " ngr 0,%3\n" /* set the bit */ \ | ||
356 | " stg 0,0(%1)\n" \ | ||
357 | "1: ex %2,6(1)" /* execute lctl */ \ | ||
358 | : "=m" (__dummy) \ | ||
359 | : "a" ((((unsigned long) &__dummy) + 7) & ~7UL), \ | ||
360 | "a" (cr*17), "a" (~(1L<<(bit))) \ | ||
361 | : "cc", "0", "1" ); \ | ||
362 | }) | ||
363 | |||
364 | #else /* __s390x__ */ | 320 | #else /* __s390x__ */ |
365 | 321 | ||
366 | #define __ctl_load(array, low, high) ({ \ | 322 | #define __ctl_load(array, low, high) ({ \ |
367 | typedef struct { char _[sizeof(array)]; } addrtype; \ | 323 | typedef struct { char _[sizeof(array)]; } addrtype; \ |
368 | __asm__ __volatile__ ( \ | 324 | asm volatile( \ |
369 | " bras 1,0f\n" \ | 325 | " lctl %1,%2,0(%0)\n" \ |
370 | " lctl 0,0,0(%0)\n" \ | 326 | : : "a" (&array), "i" (low), "i" (high), \ |
371 | "0: ex %1,0(1)" \ | 327 | "m" (*(addrtype *)(array))); \ |
372 | : : "a" (&array), "a" (((low)<<4)+(high)), \ | 328 | }) |
373 | "m" (*(addrtype *)(array)) : "1" ); \ | ||
374 | }) | ||
375 | 329 | ||
376 | #define __ctl_store(array, low, high) ({ \ | 330 | #define __ctl_store(array, low, high) ({ \ |
377 | typedef struct { char _[sizeof(array)]; } addrtype; \ | 331 | typedef struct { char _[sizeof(array)]; } addrtype; \ |
378 | __asm__ __volatile__ ( \ | 332 | asm volatile( \ |
379 | " bras 1,0f\n" \ | 333 | " stctl %2,%3,0(%1)\n" \ |
380 | " stctl 0,0,0(%1)\n" \ | 334 | : "=m" (*(addrtype *)(array)) \ |
381 | "0: ex %2,0(1)" \ | 335 | : "a" (&array), "i" (low), "i" (high)); \ |
382 | : "=m" (*(addrtype *)(array)) \ | ||
383 | : "a" (&array), "a" (((low)<<4)+(high)): "1" ); \ | ||
384 | }) | 336 | }) |
385 | 337 | ||
386 | #define __ctl_set_bit(cr, bit) ({ \ | ||
387 | __u8 __dummy[16]; \ | ||
388 | __asm__ __volatile__ ( \ | ||
389 | " bras 1,0f\n" /* skip indirect insns */ \ | ||
390 | " stctl 0,0,0(%1)\n" \ | ||
391 | " lctl 0,0,0(%1)\n" \ | ||
392 | "0: ex %2,0(1)\n" /* execute stctl */ \ | ||
393 | " l 0,0(%1)\n" \ | ||
394 | " or 0,%3\n" /* set the bit */ \ | ||
395 | " st 0,0(%1)\n" \ | ||
396 | "1: ex %2,4(1)" /* execute lctl */ \ | ||
397 | : "=m" (__dummy) \ | ||
398 | : "a" ((((unsigned long) &__dummy) + 7) & ~7UL), \ | ||
399 | "a" (cr*17), "a" (1<<(bit)) \ | ||
400 | : "cc", "0", "1" ); \ | ||
401 | }) | ||
402 | |||
403 | #define __ctl_clear_bit(cr, bit) ({ \ | ||
404 | __u8 __dummy[16]; \ | ||
405 | __asm__ __volatile__ ( \ | ||
406 | " bras 1,0f\n" /* skip indirect insns */ \ | ||
407 | " stctl 0,0,0(%1)\n" \ | ||
408 | " lctl 0,0,0(%1)\n" \ | ||
409 | "0: ex %2,0(1)\n" /* execute stctl */ \ | ||
410 | " l 0,0(%1)\n" \ | ||
411 | " nr 0,%3\n" /* set the bit */ \ | ||
412 | " st 0,0(%1)\n" \ | ||
413 | "1: ex %2,4(1)" /* execute lctl */ \ | ||
414 | : "=m" (__dummy) \ | ||
415 | : "a" ((((unsigned long) &__dummy) + 7) & ~7UL), \ | ||
416 | "a" (cr*17), "a" (~(1<<(bit))) \ | ||
417 | : "cc", "0", "1" ); \ | ||
418 | }) | ||
419 | #endif /* __s390x__ */ | 338 | #endif /* __s390x__ */ |
420 | 339 | ||
340 | #define __ctl_set_bit(cr, bit) ({ \ | ||
341 | unsigned long __dummy; \ | ||
342 | __ctl_store(__dummy, cr, cr); \ | ||
343 | __dummy |= 1UL << (bit); \ | ||
344 | __ctl_load(__dummy, cr, cr); \ | ||
345 | }) | ||
346 | |||
347 | #define __ctl_clear_bit(cr, bit) ({ \ | ||
348 | unsigned long __dummy; \ | ||
349 | __ctl_store(__dummy, cr, cr); \ | ||
350 | __dummy &= ~(1UL << (bit)); \ | ||
351 | __ctl_load(__dummy, cr, cr); \ | ||
352 | }) | ||
353 | |||
421 | #include <linux/irqflags.h> | 354 | #include <linux/irqflags.h> |
422 | 355 | ||
423 | /* | 356 | /* |
@@ -427,8 +360,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | |||
427 | static inline void | 360 | static inline void |
428 | __set_psw_mask(unsigned long mask) | 361 | __set_psw_mask(unsigned long mask) |
429 | { | 362 | { |
430 | local_save_flags(mask); | 363 | __load_psw_mask(mask | (__raw_local_irq_stosm(0x00) & ~(-1UL >> 8))); |
431 | __load_psw_mask(mask); | ||
432 | } | 364 | } |
433 | 365 | ||
434 | #define local_mcck_enable() __set_psw_mask(PSW_KERNEL_BITS) | 366 | #define local_mcck_enable() __set_psw_mask(PSW_KERNEL_BITS) |
diff --git a/include/asm-s390/timex.h b/include/asm-s390/timex.h index 5d0332a4c2bd..4df4a41029a3 100644 --- a/include/asm-s390/timex.h +++ b/include/asm-s390/timex.h | |||
@@ -15,20 +15,21 @@ | |||
15 | 15 | ||
16 | typedef unsigned long long cycles_t; | 16 | typedef unsigned long long cycles_t; |
17 | 17 | ||
18 | static inline cycles_t get_cycles(void) | ||
19 | { | ||
20 | cycles_t cycles; | ||
21 | |||
22 | __asm__ __volatile__ ("stck 0(%1)" : "=m" (cycles) : "a" (&cycles) : "cc"); | ||
23 | return cycles >> 2; | ||
24 | } | ||
25 | |||
26 | static inline unsigned long long get_clock (void) | 18 | static inline unsigned long long get_clock (void) |
27 | { | 19 | { |
28 | unsigned long long clk; | 20 | unsigned long long clk; |
29 | 21 | ||
30 | __asm__ __volatile__ ("stck 0(%1)" : "=m" (clk) : "a" (&clk) : "cc"); | 22 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) |
23 | asm volatile("stck %0" : "=Q" (clk) : : "cc"); | ||
24 | #else /* __GNUC__ */ | ||
25 | asm volatile("stck 0(%1)" : "=m" (clk) : "a" (&clk) : "cc"); | ||
26 | #endif /* __GNUC__ */ | ||
31 | return clk; | 27 | return clk; |
32 | } | 28 | } |
33 | 29 | ||
30 | static inline cycles_t get_cycles(void) | ||
31 | { | ||
32 | return (cycles_t) get_clock() >> 2; | ||
33 | } | ||
34 | |||
34 | #endif | 35 | #endif |
diff --git a/include/asm-s390/tlbflush.h b/include/asm-s390/tlbflush.h index 73cd85bebfb2..fa4dc916a9bf 100644 --- a/include/asm-s390/tlbflush.h +++ b/include/asm-s390/tlbflush.h | |||
@@ -25,7 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #define local_flush_tlb() \ | 27 | #define local_flush_tlb() \ |
28 | do { __asm__ __volatile__("ptlb": : :"memory"); } while (0) | 28 | do { asm volatile("ptlb": : :"memory"); } while (0) |
29 | 29 | ||
30 | #ifndef CONFIG_SMP | 30 | #ifndef CONFIG_SMP |
31 | 31 | ||
@@ -68,24 +68,24 @@ extern void smp_ptlb_all(void); | |||
68 | 68 | ||
69 | static inline void global_flush_tlb(void) | 69 | static inline void global_flush_tlb(void) |
70 | { | 70 | { |
71 | register unsigned long reg2 asm("2"); | ||
72 | register unsigned long reg3 asm("3"); | ||
73 | register unsigned long reg4 asm("4"); | ||
74 | long dummy; | ||
75 | |||
71 | #ifndef __s390x__ | 76 | #ifndef __s390x__ |
72 | if (!MACHINE_HAS_CSP) { | 77 | if (!MACHINE_HAS_CSP) { |
73 | smp_ptlb_all(); | 78 | smp_ptlb_all(); |
74 | return; | 79 | return; |
75 | } | 80 | } |
76 | #endif /* __s390x__ */ | 81 | #endif /* __s390x__ */ |
77 | { | 82 | |
78 | register unsigned long addr asm("4"); | 83 | dummy = 0; |
79 | long dummy; | 84 | reg2 = reg3 = 0; |
80 | 85 | reg4 = ((unsigned long) &dummy) + 1; | |
81 | dummy = 0; | 86 | asm volatile( |
82 | addr = ((unsigned long) &dummy) + 1; | 87 | " csp %0,%2" |
83 | __asm__ __volatile__ ( | 88 | : : "d" (reg2), "d" (reg3), "d" (reg4), "m" (dummy) : "cc" ); |
84 | " slr 2,2\n" | ||
85 | " slr 3,3\n" | ||
86 | " csp 2,%0" | ||
87 | : : "a" (addr), "m" (dummy) : "cc", "2", "3" ); | ||
88 | } | ||
89 | } | 89 | } |
90 | 90 | ||
91 | /* | 91 | /* |
@@ -102,9 +102,9 @@ static inline void __flush_tlb_mm(struct mm_struct * mm) | |||
102 | if (unlikely(cpus_empty(mm->cpu_vm_mask))) | 102 | if (unlikely(cpus_empty(mm->cpu_vm_mask))) |
103 | return; | 103 | return; |
104 | if (MACHINE_HAS_IDTE) { | 104 | if (MACHINE_HAS_IDTE) { |
105 | asm volatile (".insn rrf,0xb98e0000,0,%0,%1,0" | 105 | asm volatile( |
106 | : : "a" (2048), | 106 | " .insn rrf,0xb98e0000,0,%0,%1,0" |
107 | "a" (__pa(mm->pgd)&PAGE_MASK) : "cc" ); | 107 | : : "a" (2048), "a" (__pa(mm->pgd)&PAGE_MASK) : "cc"); |
108 | return; | 108 | return; |
109 | } | 109 | } |
110 | preempt_disable(); | 110 | preempt_disable(); |
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h index e2047b0c9092..72ae4efddb49 100644 --- a/include/asm-s390/uaccess.h +++ b/include/asm-s390/uaccess.h | |||
@@ -38,25 +38,14 @@ | |||
38 | #define get_ds() (KERNEL_DS) | 38 | #define get_ds() (KERNEL_DS) |
39 | #define get_fs() (current->thread.mm_segment) | 39 | #define get_fs() (current->thread.mm_segment) |
40 | 40 | ||
41 | #ifdef __s390x__ | ||
42 | #define set_fs(x) \ | 41 | #define set_fs(x) \ |
43 | ({ \ | 42 | ({ \ |
44 | unsigned long __pto; \ | 43 | unsigned long __pto; \ |
45 | current->thread.mm_segment = (x); \ | 44 | current->thread.mm_segment = (x); \ |
46 | __pto = current->thread.mm_segment.ar4 ? \ | 45 | __pto = current->thread.mm_segment.ar4 ? \ |
47 | S390_lowcore.user_asce : S390_lowcore.kernel_asce; \ | 46 | S390_lowcore.user_asce : S390_lowcore.kernel_asce; \ |
48 | asm volatile ("lctlg 7,7,%0" : : "m" (__pto) ); \ | 47 | __ctl_load(__pto, 7, 7); \ |
49 | }) | 48 | }) |
50 | #else /* __s390x__ */ | ||
51 | #define set_fs(x) \ | ||
52 | ({ \ | ||
53 | unsigned long __pto; \ | ||
54 | current->thread.mm_segment = (x); \ | ||
55 | __pto = current->thread.mm_segment.ar4 ? \ | ||
56 | S390_lowcore.user_asce : S390_lowcore.kernel_asce; \ | ||
57 | asm volatile ("lctl 7,7,%0" : : "m" (__pto) ); \ | ||
58 | }) | ||
59 | #endif /* __s390x__ */ | ||
60 | 49 | ||
61 | #define segment_eq(a,b) ((a).ar4 == (b).ar4) | 50 | #define segment_eq(a,b) ((a).ar4 == (b).ar4) |
62 | 51 | ||
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h index d49c54cb5505..0361ac5dcde3 100644 --- a/include/asm-s390/unistd.h +++ b/include/asm-s390/unistd.h | |||
@@ -355,145 +355,145 @@ do { \ | |||
355 | 355 | ||
356 | #define _svc_clobber "1", "cc", "memory" | 356 | #define _svc_clobber "1", "cc", "memory" |
357 | 357 | ||
358 | #define _syscall0(type,name) \ | 358 | #define _syscall0(type,name) \ |
359 | type name(void) { \ | 359 | type name(void) { \ |
360 | register long __svcres asm("2"); \ | 360 | register long __svcres asm("2"); \ |
361 | long __res; \ | 361 | long __res; \ |
362 | __asm__ __volatile__ ( \ | 362 | asm volatile( \ |
363 | " .if %1 < 256\n" \ | 363 | " .if %1 < 256\n" \ |
364 | " svc %b1\n" \ | 364 | " svc %b1\n" \ |
365 | " .else\n" \ | 365 | " .else\n" \ |
366 | " la %%r1,%1\n" \ | 366 | " la %%r1,%1\n" \ |
367 | " svc 0\n" \ | 367 | " svc 0\n" \ |
368 | " .endif" \ | 368 | " .endif" \ |
369 | : "=d" (__svcres) \ | 369 | : "=d" (__svcres) \ |
370 | : "i" (__NR_##name) \ | 370 | : "i" (__NR_##name) \ |
371 | : _svc_clobber ); \ | 371 | : _svc_clobber); \ |
372 | __res = __svcres; \ | 372 | __res = __svcres; \ |
373 | __syscall_return(type,__res); \ | 373 | __syscall_return(type,__res); \ |
374 | } | 374 | } |
375 | 375 | ||
376 | #define _syscall1(type,name,type1,arg1) \ | 376 | #define _syscall1(type,name,type1,arg1) \ |
377 | type name(type1 arg1) { \ | 377 | type name(type1 arg1) { \ |
378 | register type1 __arg1 asm("2") = arg1; \ | 378 | register type1 __arg1 asm("2") = arg1; \ |
379 | register long __svcres asm("2"); \ | 379 | register long __svcres asm("2"); \ |
380 | long __res; \ | 380 | long __res; \ |
381 | __asm__ __volatile__ ( \ | 381 | asm volatile( \ |
382 | " .if %1 < 256\n" \ | 382 | " .if %1 < 256\n" \ |
383 | " svc %b1\n" \ | 383 | " svc %b1\n" \ |
384 | " .else\n" \ | 384 | " .else\n" \ |
385 | " la %%r1,%1\n" \ | 385 | " la %%r1,%1\n" \ |
386 | " svc 0\n" \ | 386 | " svc 0\n" \ |
387 | " .endif" \ | 387 | " .endif" \ |
388 | : "=d" (__svcres) \ | 388 | : "=d" (__svcres) \ |
389 | : "i" (__NR_##name), \ | 389 | : "i" (__NR_##name), \ |
390 | "0" (__arg1) \ | 390 | "0" (__arg1) \ |
391 | : _svc_clobber ); \ | 391 | : _svc_clobber); \ |
392 | __res = __svcres; \ | 392 | __res = __svcres; \ |
393 | __syscall_return(type,__res); \ | 393 | __syscall_return(type,__res); \ |
394 | } | 394 | } |
395 | 395 | ||
396 | #define _syscall2(type,name,type1,arg1,type2,arg2) \ | 396 | #define _syscall2(type,name,type1,arg1,type2,arg2) \ |
397 | type name(type1 arg1, type2 arg2) { \ | 397 | type name(type1 arg1, type2 arg2) { \ |
398 | register type1 __arg1 asm("2") = arg1; \ | 398 | register type1 __arg1 asm("2") = arg1; \ |
399 | register type2 __arg2 asm("3") = arg2; \ | 399 | register type2 __arg2 asm("3") = arg2; \ |
400 | register long __svcres asm("2"); \ | 400 | register long __svcres asm("2"); \ |
401 | long __res; \ | 401 | long __res; \ |
402 | __asm__ __volatile__ ( \ | 402 | asm volatile( \ |
403 | " .if %1 < 256\n" \ | 403 | " .if %1 < 256\n" \ |
404 | " svc %b1\n" \ | 404 | " svc %b1\n" \ |
405 | " .else\n" \ | 405 | " .else\n" \ |
406 | " la %%r1,%1\n" \ | 406 | " la %%r1,%1\n" \ |
407 | " svc 0\n" \ | 407 | " svc 0\n" \ |
408 | " .endif" \ | 408 | " .endif" \ |
409 | : "=d" (__svcres) \ | 409 | : "=d" (__svcres) \ |
410 | : "i" (__NR_##name), \ | 410 | : "i" (__NR_##name), \ |
411 | "0" (__arg1), \ | 411 | "0" (__arg1), \ |
412 | "d" (__arg2) \ | 412 | "d" (__arg2) \ |
413 | : _svc_clobber ); \ | 413 | : _svc_clobber ); \ |
414 | __res = __svcres; \ | 414 | __res = __svcres; \ |
415 | __syscall_return(type,__res); \ | 415 | __syscall_return(type,__res); \ |
416 | } | 416 | } |
417 | 417 | ||
418 | #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)\ | 418 | #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ |
419 | type name(type1 arg1, type2 arg2, type3 arg3) { \ | 419 | type name(type1 arg1, type2 arg2, type3 arg3) { \ |
420 | register type1 __arg1 asm("2") = arg1; \ | 420 | register type1 __arg1 asm("2") = arg1; \ |
421 | register type2 __arg2 asm("3") = arg2; \ | 421 | register type2 __arg2 asm("3") = arg2; \ |
422 | register type3 __arg3 asm("4") = arg3; \ | 422 | register type3 __arg3 asm("4") = arg3; \ |
423 | register long __svcres asm("2"); \ | 423 | register long __svcres asm("2"); \ |
424 | long __res; \ | 424 | long __res; \ |
425 | __asm__ __volatile__ ( \ | 425 | asm volatile( \ |
426 | " .if %1 < 256\n" \ | 426 | " .if %1 < 256\n" \ |
427 | " svc %b1\n" \ | 427 | " svc %b1\n" \ |
428 | " .else\n" \ | 428 | " .else\n" \ |
429 | " la %%r1,%1\n" \ | 429 | " la %%r1,%1\n" \ |
430 | " svc 0\n" \ | 430 | " svc 0\n" \ |
431 | " .endif" \ | 431 | " .endif" \ |
432 | : "=d" (__svcres) \ | 432 | : "=d" (__svcres) \ |
433 | : "i" (__NR_##name), \ | 433 | : "i" (__NR_##name), \ |
434 | "0" (__arg1), \ | 434 | "0" (__arg1), \ |
435 | "d" (__arg2), \ | 435 | "d" (__arg2), \ |
436 | "d" (__arg3) \ | 436 | "d" (__arg3) \ |
437 | : _svc_clobber ); \ | 437 | : _svc_clobber); \ |
438 | __res = __svcres; \ | 438 | __res = __svcres; \ |
439 | __syscall_return(type,__res); \ | 439 | __syscall_return(type,__res); \ |
440 | } | 440 | } |
441 | 441 | ||
442 | #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,\ | 442 | #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3, \ |
443 | type4,name4) \ | 443 | type4,name4) \ |
444 | type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ | 444 | type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ |
445 | register type1 __arg1 asm("2") = arg1; \ | 445 | register type1 __arg1 asm("2") = arg1; \ |
446 | register type2 __arg2 asm("3") = arg2; \ | 446 | register type2 __arg2 asm("3") = arg2; \ |
447 | register type3 __arg3 asm("4") = arg3; \ | 447 | register type3 __arg3 asm("4") = arg3; \ |
448 | register type4 __arg4 asm("5") = arg4; \ | 448 | register type4 __arg4 asm("5") = arg4; \ |
449 | register long __svcres asm("2"); \ | 449 | register long __svcres asm("2"); \ |
450 | long __res; \ | 450 | long __res; \ |
451 | __asm__ __volatile__ ( \ | 451 | asm volatile( \ |
452 | " .if %1 < 256\n" \ | 452 | " .if %1 < 256\n" \ |
453 | " svc %b1\n" \ | 453 | " svc %b1\n" \ |
454 | " .else\n" \ | 454 | " .else\n" \ |
455 | " la %%r1,%1\n" \ | 455 | " la %%r1,%1\n" \ |
456 | " svc 0\n" \ | 456 | " svc 0\n" \ |
457 | " .endif" \ | 457 | " .endif" \ |
458 | : "=d" (__svcres) \ | 458 | : "=d" (__svcres) \ |
459 | : "i" (__NR_##name), \ | 459 | : "i" (__NR_##name), \ |
460 | "0" (__arg1), \ | 460 | "0" (__arg1), \ |
461 | "d" (__arg2), \ | 461 | "d" (__arg2), \ |
462 | "d" (__arg3), \ | 462 | "d" (__arg3), \ |
463 | "d" (__arg4) \ | 463 | "d" (__arg4) \ |
464 | : _svc_clobber ); \ | 464 | : _svc_clobber); \ |
465 | __res = __svcres; \ | 465 | __res = __svcres; \ |
466 | __syscall_return(type,__res); \ | 466 | __syscall_return(type,__res); \ |
467 | } | 467 | } |
468 | 468 | ||
469 | #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,\ | 469 | #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3, \ |
470 | type4,name4,type5,name5) \ | 470 | type4,name4,type5,name5) \ |
471 | type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ | 471 | type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ |
472 | type5 arg5) { \ | 472 | type5 arg5) { \ |
473 | register type1 __arg1 asm("2") = arg1; \ | 473 | register type1 __arg1 asm("2") = arg1; \ |
474 | register type2 __arg2 asm("3") = arg2; \ | 474 | register type2 __arg2 asm("3") = arg2; \ |
475 | register type3 __arg3 asm("4") = arg3; \ | 475 | register type3 __arg3 asm("4") = arg3; \ |
476 | register type4 __arg4 asm("5") = arg4; \ | 476 | register type4 __arg4 asm("5") = arg4; \ |
477 | register type5 __arg5 asm("6") = arg5; \ | 477 | register type5 __arg5 asm("6") = arg5; \ |
478 | register long __svcres asm("2"); \ | 478 | register long __svcres asm("2"); \ |
479 | long __res; \ | 479 | long __res; \ |
480 | __asm__ __volatile__ ( \ | 480 | asm volatile( \ |
481 | " .if %1 < 256\n" \ | 481 | " .if %1 < 256\n" \ |
482 | " svc %b1\n" \ | 482 | " svc %b1\n" \ |
483 | " .else\n" \ | 483 | " .else\n" \ |
484 | " la %%r1,%1\n" \ | 484 | " la %%r1,%1\n" \ |
485 | " svc 0\n" \ | 485 | " svc 0\n" \ |
486 | " .endif" \ | 486 | " .endif" \ |
487 | : "=d" (__svcres) \ | 487 | : "=d" (__svcres) \ |
488 | : "i" (__NR_##name), \ | 488 | : "i" (__NR_##name), \ |
489 | "0" (__arg1), \ | 489 | "0" (__arg1), \ |
490 | "d" (__arg2), \ | 490 | "d" (__arg2), \ |
491 | "d" (__arg3), \ | 491 | "d" (__arg3), \ |
492 | "d" (__arg4), \ | 492 | "d" (__arg4), \ |
493 | "d" (__arg5) \ | 493 | "d" (__arg5) \ |
494 | : _svc_clobber ); \ | 494 | : _svc_clobber); \ |
495 | __res = __svcres; \ | 495 | __res = __svcres; \ |
496 | __syscall_return(type,__res); \ | 496 | __syscall_return(type,__res); \ |
497 | } | 497 | } |
498 | 498 | ||
499 | #define __ARCH_WANT_IPC_PARSE_VERSION | 499 | #define __ARCH_WANT_IPC_PARSE_VERSION |