1.3.100
find_first_zero_bit在使用gcc 4.2.4 编译时,需要保护%eax
find_first_zero_bit 修订后:
/*
* Find-bit routines..
*/
extern __inline__ int find_first_zero_bit(void * addr, unsigned size)
{
int res;
if (!size)
return 0;
__asm__ ("cld
"
"pushl %%eax
" //fixed:
"movl $-1,%%eax
"
"xorl %%edx,%%edx
"
"repe; scasl
"
"je 1f
"
"xorl -4(%%edi),%%eax
"
"subl $4,%%edi
"
"bsfl %%eax,%%edx
"
"1: subl %%ebx,%%edi
"
"shll $3,%%edi
"
"addl %%edi,%%edx
"
"popl %%eax"
:"=d" (res)
:"c" ((size + 31) >> 5), "D" (addr), "b" (addr)
/*:"ax", "cx", "di"*/);
return res;
}