diff options
| -rw-r--r-- | include/asm-x86/bitops.h | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/include/asm-x86/bitops.h b/include/asm-x86/bitops.h index daf1a72bdc4b..b81a4d4d3337 100644 --- a/include/asm-x86/bitops.h +++ b/include/asm-x86/bitops.h | |||
| @@ -62,9 +62,7 @@ static inline void set_bit(int nr, volatile void *addr) | |||
| 62 | */ | 62 | */ |
| 63 | static inline void __set_bit(int nr, volatile void *addr) | 63 | static inline void __set_bit(int nr, volatile void *addr) |
| 64 | { | 64 | { |
| 65 | asm volatile("bts %1,%0" | 65 | asm volatile("bts %1,%0" : ADDR : "Ir" (nr) : "memory"); |
| 66 | : ADDR | ||
| 67 | : "Ir" (nr) : "memory"); | ||
| 68 | } | 66 | } |
| 69 | 67 | ||
| 70 | /** | 68 | /** |
| @@ -296,13 +294,11 @@ static inline int variable_test_bit(int nr, volatile const void *addr) | |||
| 296 | static int test_bit(int nr, const volatile unsigned long *addr); | 294 | static int test_bit(int nr, const volatile unsigned long *addr); |
| 297 | #endif | 295 | #endif |
| 298 | 296 | ||
| 299 | #define test_bit(nr,addr) \ | 297 | #define test_bit(nr, addr) \ |
| 300 | (__builtin_constant_p(nr) ? \ | 298 | (__builtin_constant_p((nr)) \ |
| 301 | constant_test_bit((nr),(addr)) : \ | 299 | ? constant_test_bit((nr), (addr)) \ |
| 302 | variable_test_bit((nr),(addr))) | 300 | : variable_test_bit((nr), (addr))) |
| 303 | 301 | ||
| 304 | #undef BASE_ADDR | ||
| 305 | #undef BIT_ADDR | ||
| 306 | /** | 302 | /** |
| 307 | * __ffs - find first set bit in word | 303 | * __ffs - find first set bit in word |
| 308 | * @word: The word to search | 304 | * @word: The word to search |
| @@ -311,9 +307,9 @@ static int test_bit(int nr, const volatile unsigned long *addr); | |||
| 311 | */ | 307 | */ |
| 312 | static inline unsigned long __ffs(unsigned long word) | 308 | static inline unsigned long __ffs(unsigned long word) |
| 313 | { | 309 | { |
| 314 | __asm__("bsf %1,%0" | 310 | asm("bsf %1,%0" |
| 315 | :"=r" (word) | 311 | : "=r" (word) |
| 316 | :"rm" (word)); | 312 | : "rm" (word)); |
| 317 | return word; | 313 | return word; |
| 318 | } | 314 | } |
| 319 | 315 | ||
| @@ -325,9 +321,9 @@ static inline unsigned long __ffs(unsigned long word) | |||
| 325 | */ | 321 | */ |
| 326 | static inline unsigned long ffz(unsigned long word) | 322 | static inline unsigned long ffz(unsigned long word) |
| 327 | { | 323 | { |
| 328 | __asm__("bsf %1,%0" | 324 | asm("bsf %1,%0" |
| 329 | :"=r" (word) | 325 | : "=r" (word) |
| 330 | :"r" (~word)); | 326 | : "r" (~word)); |
| 331 | return word; | 327 | return word; |
| 332 | } | 328 | } |
| 333 | 329 | ||
| @@ -339,9 +335,9 @@ static inline unsigned long ffz(unsigned long word) | |||
| 339 | */ | 335 | */ |
| 340 | static inline unsigned long __fls(unsigned long word) | 336 | static inline unsigned long __fls(unsigned long word) |
| 341 | { | 337 | { |
| 342 | __asm__("bsr %1,%0" | 338 | asm("bsr %1,%0" |
| 343 | :"=r" (word) | 339 | : "=r" (word) |
| 344 | :"rm" (word)); | 340 | : "rm" (word)); |
| 345 | return word; | 341 | return word; |
| 346 | } | 342 | } |
| 347 | 343 | ||
| @@ -361,14 +357,14 @@ static inline int ffs(int x) | |||
| 361 | { | 357 | { |
| 362 | int r; | 358 | int r; |
| 363 | #ifdef CONFIG_X86_CMOV | 359 | #ifdef CONFIG_X86_CMOV |
| 364 | __asm__("bsfl %1,%0\n\t" | 360 | asm("bsfl %1,%0\n\t" |
| 365 | "cmovzl %2,%0" | 361 | "cmovzl %2,%0" |
| 366 | : "=r" (r) : "rm" (x), "r" (-1)); | 362 | : "=r" (r) : "rm" (x), "r" (-1)); |
| 367 | #else | 363 | #else |
| 368 | __asm__("bsfl %1,%0\n\t" | 364 | asm("bsfl %1,%0\n\t" |
| 369 | "jnz 1f\n\t" | 365 | "jnz 1f\n\t" |
| 370 | "movl $-1,%0\n" | 366 | "movl $-1,%0\n" |
| 371 | "1:" : "=r" (r) : "rm" (x)); | 367 | "1:" : "=r" (r) : "rm" (x)); |
| 372 | #endif | 368 | #endif |
| 373 | return r + 1; | 369 | return r + 1; |
| 374 | } | 370 | } |
| @@ -388,19 +384,21 @@ static inline int fls(int x) | |||
| 388 | { | 384 | { |
| 389 | int r; | 385 | int r; |
| 390 | #ifdef CONFIG_X86_CMOV | 386 | #ifdef CONFIG_X86_CMOV |
| 391 | __asm__("bsrl %1,%0\n\t" | 387 | asm("bsrl %1,%0\n\t" |
| 392 | "cmovzl %2,%0" | 388 | "cmovzl %2,%0" |
| 393 | : "=&r" (r) : "rm" (x), "rm" (-1)); | 389 | : "=&r" (r) : "rm" (x), "rm" (-1)); |
| 394 | #else | 390 | #else |
| 395 | __asm__("bsrl %1,%0\n\t" | 391 | asm("bsrl %1,%0\n\t" |
| 396 | "jnz 1f\n\t" | 392 | "jnz 1f\n\t" |
| 397 | "movl $-1,%0\n" | 393 | "movl $-1,%0\n" |
| 398 | "1:" : "=r" (r) : "rm" (x)); | 394 | "1:" : "=r" (r) : "rm" (x)); |
| 399 | #endif | 395 | #endif |
| 400 | return r + 1; | 396 | return r + 1; |
| 401 | } | 397 | } |
| 402 | #endif /* __KERNEL__ */ | 398 | #endif /* __KERNEL__ */ |
| 403 | 399 | ||
| 400 | #undef BASE_ADDR | ||
| 401 | #undef BIT_ADDR | ||
| 404 | #undef ADDR | 402 | #undef ADDR |
| 405 | 403 | ||
| 406 | static inline void set_bit_string(unsigned long *bitmap, | 404 | static inline void set_bit_string(unsigned long *bitmap, |
