6 #include "func_defines.h"
9 * Finds the first set bit in a bitmap.
11 * @returns Index of the first set bit.
12 * @returns -1 if no clear bit was found.
13 * @param pvBitmap Pointer to the bitmap.
14 * @param cBits The number of bits in the bitmap. Multiple of 32.
16 DECLINLINE(int) ASMBitFirstSet(volatile void *pvBitmap
, uint32_t cBits
)
21 # ifdef RT_INLINE_ASM_GNU_STYLE
22 RTCCUINTREG uEAX
, uECX
, uEDI
;
23 cBits
= RT_ALIGN_32(cBits
, 32);
24 __asm__
__volatile__("repe; scasl\n\t"
27 "lea -4(%%rdi), %%rdi\n\t"
28 "movl (%%rdi), %%eax\n\t"
31 "lea -4(%%edi), %%edi\n\t"
32 "movl (%%edi), %%eax\n\t"
36 "bsfl %%eax, %%edx\n\t"
37 "addl %%edi, %%edx\n\t"
49 cBits
= RT_ALIGN_32(cBits
, 32);
87 * Gets the content of the CPU timestamp counter register.
91 DECLINLINE(uint64_t) ASMReadTSC(void)
94 # ifdef RT_INLINE_ASM_GNU_STYLE
95 __asm__
__volatile__ ("rdtsc\n\t" : "=a" (u
.s
.Lo
), "=d" (u
.s
.Hi
));
97 # if RT_INLINE_ASM_USES_INTRIN