xref: /kvm-unit-tests/lib/x86/asm/bitops.h (revision e521b10727bd6233dfc94b1ef4058a0d19b791e3)
1 #ifndef _ASMX86_BITOPS_H_
2 #define _ASMX86_BITOPS_H_
3 
4 #ifndef _BITOPS_H_
5 #error only <bitops.h> can be included directly
6 #endif
7 
8 #ifdef __x86_64__
9 #define BITS_PER_LONG	64
10 #else
11 #define BITS_PER_LONG	32
12 #endif
13 
14 #define HAVE_BUILTIN_FLS 1
15 
16 static inline void test_and_set_bit(long nr, unsigned long *addr)
17 {
18 	asm volatile("lock; bts %1,%0"
19 		     : "+m" (*addr)
20 		     : "Ir" (nr)
21 		     : "memory");
22 }
23 
24 #endif
25