20 #ifndef __L4UTIL__INCLUDE__ARCH_AMD64__BITOPS_ARCH_H__ 21 #define __L4UTIL__INCLUDE__ARCH_AMD64__BITOPS_ARCH_H__ 29 #define __L4UTIL_BITOPS_HAVE_ARCH_SET_BIT 35 "lock; bts %1,%0 \n\t" 46 #define __L4UTIL_BITOPS_HAVE_ARCH_CLEAR_BIT 52 "lock; btr %1,%0 \n\t" 63 #define __L4UTIL_BITOPS_HAVE_ARCH_COMPLEMENT_BIT 69 "lock; btc %1,%0 \n\t" 80 #define __L4UTIL_BITOPS_HAVE_ARCH_TEST_BIT 104 #define __L4UTIL_BITOPS_HAVE_ARCH_BIT_TEST_AND_SET 112 "lock; bts %2,%1 \n\t" 127 #define __L4UTIL_BITOPS_HAVE_ARCH_BIT_TEST_AND_RESET 135 "lock; btr %2,%1 \n\t" 150 #define __L4UTIL_BITOPS_HAVE_ARCH_BIT_TEST_AND_COMPLEMENT 158 "lock; btc %2,%1 \n\t" 173 #define __L4UTIL_BITOPS_HAVE_ARCH_BIT_SCAN_REVERSE 195 #define __L4UTIL_BITOPS_HAVE_ARCH_BIT_SCAN_FORWARD 216 #define __L4UTIL_BITOPS_HAVE_ARCH_FIND_FIRST_SET_BIT 224 "xor %%rax,%%rax \n\t" 227 "lea -4(%%rdi),%%rdi \n\t" 228 "bsfq (%%rdi),%%rax \n" 230 "sub %%rbx,%%rdi \n\t" 232 "add %%rdi,%%rax \n\t" 234 "=a" (res),
"=&c" (dummy0),
"=&D" (dummy1)
236 "1" ((size + 31) >> 5),
"2" (dest),
"b" (dest)
243 #define __L4UTIL_BITOPS_HAVE_ARCH_FIND_FIRST_ZERO_BIT 255 "xor %%rdx,%%rdx \n\t" 258 "xor -4(%%rdi),%%rax \n\t" 262 "sub %[dest],%%rdi \n\t" 264 "add %%rdi,%%rdx \n\t" 266 "=d" (res),
"=&c" (dummy0),
"=&D" (dummy1),
"=&a" (dummy2)
268 "1" ((size + 31) >> 5),
"2" (dest), [dest]
"S" (dest)
unsigned int l4_size_t
Unsigned size type.
signed char l4_int8_t
Signed 8bit value.
int l4util_test_bit(int b, const volatile l4_umword_t *dest)
Test bit (return value of bit)
signed long l4_mword_t
Signed machine word.
#define EXTERN_C_END
End section with C types and functions.
int l4util_btc(int b, volatile l4_umword_t *dest)
Bit test and complement.
int l4util_btr(int b, volatile l4_umword_t *dest)
Bit test and reset.
#define L4_UNLIKELY(x)
Expression is unlikely to execute.
int l4util_find_first_zero_bit(const void *dest, l4_size_t size)
Find the first zero bit in a memory region.
void l4util_complement_bit(int b, volatile l4_umword_t *dest)
Complement bit in memory.
int l4util_bsf(l4_umword_t word)
Bit scan forward.
void l4util_set_bit(int b, volatile l4_umword_t *dest)
Set bit in memory.
unsigned long l4_umword_t
Unsigned machine word.
#define EXTERN_C_BEGIN
Start section with C types and functions.
int l4util_bts(int b, volatile l4_umword_t *dest)
Bit test and set.
int l4util_find_first_set_bit(const void *dest, l4_size_t size)
Find the first set bit in a memory region.
void l4util_clear_bit(int b, volatile l4_umword_t *dest)
Clear bit in memory.
int l4util_bsr(l4_umword_t word)
Bit scan reverse.