aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2007-01-10 19:52:44 -0500
committerAndi Kleen <andi@basil.nowhere.org>2007-01-10 19:52:44 -0500
commit24420760c3701ff422b344e047a20ca09b76fc64 (patch)
tree0dabf46c0825c632775705185244c31b821cdd4a
parent343cde51b3b856470eea24a89f00166b8e2d7272 (diff)
[PATCH] x86-64: Use different constraint for gcc < 4.1 in bitops.h
+m is really correct for a RMW instruction, but some older gccs error out. I finally gave in and ifdefed it. This fixes compilation errors with some compiler version. Signed-off-by: Andi Kleen <ak@suse.de>
-rw-r--r--include/asm-x86_64/bitops.h34
1 files changed, 20 insertions, 14 deletions
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
index 5b535eaf5309..8da9609070f4 100644
--- a/include/asm-x86_64/bitops.h
+++ b/include/asm-x86_64/bitops.h
@@ -7,7 +7,13 @@
7 7
8#include <asm/alternative.h> 8#include <asm/alternative.h>
9 9
10#define ADDR (*(volatile long *) addr) 10#if __GNUC__ < 4 || __GNUC_MINOR__ < 1
11/* Technically wrong, but this avoids compilation errors on some gcc
12 versions. */
13#define ADDR "=m" (*(volatile long *) addr)
14#else
15#define ADDR "+m" (*(volatile long *) addr)
16#endif
11 17
12/** 18/**
13 * set_bit - Atomically set a bit in memory 19 * set_bit - Atomically set a bit in memory
@@ -23,7 +29,7 @@ static __inline__ void set_bit(int nr, volatile void * addr)
23{ 29{
24 __asm__ __volatile__( LOCK_PREFIX 30 __asm__ __volatile__( LOCK_PREFIX
25 "btsl %1,%0" 31 "btsl %1,%0"
26 :"+m" (ADDR) 32 :ADDR
27 :"dIr" (nr) : "memory"); 33 :"dIr" (nr) : "memory");
28} 34}
29 35
@@ -40,7 +46,7 @@ static __inline__ void __set_bit(int nr, volatile void * addr)
40{ 46{
41 __asm__ volatile( 47 __asm__ volatile(
42 "btsl %1,%0" 48 "btsl %1,%0"
43 :"+m" (ADDR) 49 :ADDR
44 :"dIr" (nr) : "memory"); 50 :"dIr" (nr) : "memory");
45} 51}
46 52
@@ -58,7 +64,7 @@ static __inline__ void clear_bit(int nr, volatile void * addr)
58{ 64{
59 __asm__ __volatile__( LOCK_PREFIX 65 __asm__ __volatile__( LOCK_PREFIX
60 "btrl %1,%0" 66 "btrl %1,%0"
61 :"+m" (ADDR) 67 :ADDR
62 :"dIr" (nr)); 68 :"dIr" (nr));
63} 69}
64 70
@@ -66,7 +72,7 @@ static __inline__ void __clear_bit(int nr, volatile void * addr)
66{ 72{
67 __asm__ __volatile__( 73 __asm__ __volatile__(
68 "btrl %1,%0" 74 "btrl %1,%0"
69 :"+m" (ADDR) 75 :ADDR
70 :"dIr" (nr)); 76 :"dIr" (nr));
71} 77}
72 78
@@ -86,7 +92,7 @@ static __inline__ void __change_bit(int nr, volatile void * addr)
86{ 92{
87 __asm__ __volatile__( 93 __asm__ __volatile__(
88 "btcl %1,%0" 94 "btcl %1,%0"
89 :"+m" (ADDR) 95 :ADDR
90 :"dIr" (nr)); 96 :"dIr" (nr));
91} 97}
92 98
@@ -103,7 +109,7 @@ static __inline__ void change_bit(int nr, volatile void * addr)
103{ 109{
104 __asm__ __volatile__( LOCK_PREFIX 110 __asm__ __volatile__( LOCK_PREFIX
105 "btcl %1,%0" 111 "btcl %1,%0"
106 :"+m" (ADDR) 112 :ADDR
107 :"dIr" (nr)); 113 :"dIr" (nr));
108} 114}
109 115
@@ -121,7 +127,7 @@ static __inline__ int test_and_set_bit(int nr, volatile void * addr)
121 127
122 __asm__ __volatile__( LOCK_PREFIX 128 __asm__ __volatile__( LOCK_PREFIX
123 "btsl %2,%1\n\tsbbl %0,%0" 129 "btsl %2,%1\n\tsbbl %0,%0"
124 :"=r" (oldbit),"+m" (ADDR) 130 :"=r" (oldbit),ADDR
125 :"dIr" (nr) : "memory"); 131 :"dIr" (nr) : "memory");
126 return oldbit; 132 return oldbit;
127} 133}
@@ -141,7 +147,7 @@ static __inline__ int __test_and_set_bit(int nr, volatile void * addr)
141 147
142 __asm__( 148 __asm__(
143 "btsl %2,%1\n\tsbbl %0,%0" 149 "btsl %2,%1\n\tsbbl %0,%0"
144 :"=r" (oldbit),"+m" (ADDR) 150 :"=r" (oldbit),ADDR
145 :"dIr" (nr)); 151 :"dIr" (nr));
146 return oldbit; 152 return oldbit;
147} 153}
@@ -160,7 +166,7 @@ static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
160 166
161 __asm__ __volatile__( LOCK_PREFIX 167 __asm__ __volatile__( LOCK_PREFIX
162 "btrl %2,%1\n\tsbbl %0,%0" 168 "btrl %2,%1\n\tsbbl %0,%0"
163 :"=r" (oldbit),"+m" (ADDR) 169 :"=r" (oldbit),ADDR
164 :"dIr" (nr) : "memory"); 170 :"dIr" (nr) : "memory");
165 return oldbit; 171 return oldbit;
166} 172}
@@ -180,7 +186,7 @@ static __inline__ int __test_and_clear_bit(int nr, volatile void * addr)
180 186
181 __asm__( 187 __asm__(
182 "btrl %2,%1\n\tsbbl %0,%0" 188 "btrl %2,%1\n\tsbbl %0,%0"
183 :"=r" (oldbit),"+m" (ADDR) 189 :"=r" (oldbit),ADDR
184 :"dIr" (nr)); 190 :"dIr" (nr));
185 return oldbit; 191 return oldbit;
186} 192}
@@ -192,7 +198,7 @@ static __inline__ int __test_and_change_bit(int nr, volatile void * addr)
192 198
193 __asm__ __volatile__( 199 __asm__ __volatile__(
194 "btcl %2,%1\n\tsbbl %0,%0" 200 "btcl %2,%1\n\tsbbl %0,%0"
195 :"=r" (oldbit),"+m" (ADDR) 201 :"=r" (oldbit),ADDR
196 :"dIr" (nr) : "memory"); 202 :"dIr" (nr) : "memory");
197 return oldbit; 203 return oldbit;
198} 204}
@@ -211,7 +217,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
211 217
212 __asm__ __volatile__( LOCK_PREFIX 218 __asm__ __volatile__( LOCK_PREFIX
213 "btcl %2,%1\n\tsbbl %0,%0" 219 "btcl %2,%1\n\tsbbl %0,%0"
214 :"=r" (oldbit),"+m" (ADDR) 220 :"=r" (oldbit),ADDR
215 :"dIr" (nr) : "memory"); 221 :"dIr" (nr) : "memory");
216 return oldbit; 222 return oldbit;
217} 223}
@@ -237,7 +243,7 @@ static __inline__ int variable_test_bit(int nr, volatile const void * addr)
237 __asm__ __volatile__( 243 __asm__ __volatile__(
238 "btl %2,%1\n\tsbbl %0,%0" 244 "btl %2,%1\n\tsbbl %0,%0"
239 :"=r" (oldbit) 245 :"=r" (oldbit)
240 :"m" (ADDR),"dIr" (nr)); 246 :"m" (*(volatile long *)addr),"dIr" (nr));
241 return oldbit; 247 return oldbit;
242} 248}
243 249