]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/asm-x86/bitops.h
signals: x86 TS_RESTORE_SIGMASK
[karo-tx-linux.git] / include / asm-x86 / bitops.h
index 1b6f547cb6bd153f429d4c88808d6400cf84e71f..b81a4d4d333787e4c9e8b69cb74fd190f09c4e69 100644 (file)
@@ -62,9 +62,7 @@ static inline void set_bit(int nr, volatile void *addr)
  */
 static inline void __set_bit(int nr, volatile void *addr)
 {
-       asm volatile("bts %1,%0"
-                    : ADDR
-                    : "Ir" (nr) : "memory");
+       asm volatile("bts %1,%0" : ADDR : "Ir" (nr) : "memory");
 }
 
 /**
@@ -296,13 +294,11 @@ static inline int variable_test_bit(int nr, volatile const void *addr)
 static int test_bit(int nr, const volatile unsigned long *addr);
 #endif
 
-#define test_bit(nr,addr)                      \
-       (__builtin_constant_p(nr) ?             \
-        constant_test_bit((nr),(addr)) :       \
-        variable_test_bit((nr),(addr)))
+#define test_bit(nr, addr)                     \
+       (__builtin_constant_p((nr))             \
+        ? constant_test_bit((nr), (addr))      \
+        : variable_test_bit((nr), (addr)))
 
-#undef BASE_ADDR
-#undef BIT_ADDR
 /**
  * __ffs - find first set bit in word
  * @word: The word to search
@@ -311,9 +307,9 @@ static int test_bit(int nr, const volatile unsigned long *addr);
  */
 static inline unsigned long __ffs(unsigned long word)
 {
-       __asm__("bsf %1,%0"
-               :"=r" (word)
-               :"rm" (word));
+       asm("bsf %1,%0"
+               : "=r" (word)
+               : "rm" (word));
        return word;
 }
 
@@ -325,9 +321,9 @@ static inline unsigned long __ffs(unsigned long word)
  */
 static inline unsigned long ffz(unsigned long word)
 {
-       __asm__("bsf %1,%0"
-               :"=r" (word)
-               :"r" (~word));
+       asm("bsf %1,%0"
+               : "=r" (word)
+               : "r" (~word));
        return word;
 }
 
@@ -339,9 +335,9 @@ static inline unsigned long ffz(unsigned long word)
  */
 static inline unsigned long __fls(unsigned long word)
 {
-       __asm__("bsr %1,%0"
-               :"=r" (word)
-               :"rm" (word));
+       asm("bsr %1,%0"
+           "=r" (word)
+           "rm" (word));
        return word;
 }
 
@@ -361,14 +357,14 @@ static inline int ffs(int x)
 {
        int r;
 #ifdef CONFIG_X86_CMOV
-       __asm__("bsfl %1,%0\n\t"
-               "cmovzl %2,%0"
-               : "=r" (r) : "rm" (x), "r" (-1));
+       asm("bsfl %1,%0\n\t"
+           "cmovzl %2,%0"
+           : "=r" (r) : "rm" (x), "r" (-1));
 #else
-       __asm__("bsfl %1,%0\n\t"
-               "jnz 1f\n\t"
-               "movl $-1,%0\n"
-               "1:" : "=r" (r) : "rm" (x));
+       asm("bsfl %1,%0\n\t"
+           "jnz 1f\n\t"
+           "movl $-1,%0\n"
+           "1:" : "=r" (r) : "rm" (x));
 #endif
        return r + 1;
 }
@@ -388,25 +384,55 @@ static inline int fls(int x)
 {
        int r;
 #ifdef CONFIG_X86_CMOV
-       __asm__("bsrl %1,%0\n\t"
-               "cmovzl %2,%0"
-               : "=&r" (r) : "rm" (x), "rm" (-1));
+       asm("bsrl %1,%0\n\t"
+           "cmovzl %2,%0"
+           : "=&r" (r) : "rm" (x), "rm" (-1));
 #else
-       __asm__("bsrl %1,%0\n\t"
-               "jnz 1f\n\t"
-               "movl $-1,%0\n"
-               "1:" : "=r" (r) : "rm" (x));
+       asm("bsrl %1,%0\n\t"
+           "jnz 1f\n\t"
+           "movl $-1,%0\n"
+           "1:" : "=r" (r) : "rm" (x));
 #endif
        return r + 1;
 }
 #endif /* __KERNEL__ */
 
+#undef BASE_ADDR
+#undef BIT_ADDR
 #undef ADDR
 
-#ifdef CONFIG_X86_32
-# include "bitops_32.h"
-#else
-# include "bitops_64.h"
-#endif
+static inline void set_bit_string(unsigned long *bitmap,
+               unsigned long i, int len)
+{
+       unsigned long end = i + len;
+       while (i < end) {
+               __set_bit(i, bitmap);
+               i++;
+       }
+}
+
+#ifdef __KERNEL__
+
+#include <asm-generic/bitops/sched.h>
 
+#define ARCH_HAS_FAST_MULTIPLIER 1
+
+#include <asm-generic/bitops/hweight.h>
+
+#endif /* __KERNEL__ */
+
+#include <asm-generic/bitops/fls64.h>
+
+#ifdef __KERNEL__
+
+#include <asm-generic/bitops/ext2-non-atomic.h>
+
+#define ext2_set_bit_atomic(lock, nr, addr)                    \
+       test_and_set_bit((nr), (unsigned long *)(addr))
+#define ext2_clear_bit_atomic(lock, nr, addr)                  \
+       test_and_clear_bit((nr), (unsigned long *)(addr))
+
+#include <asm-generic/bitops/minix.h>
+
+#endif /* __KERNEL__ */
 #endif /* _ASM_X86_BITOPS_H */