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\n\t"
"pushl %%eax\n\t" //fixed:
"movl $-1,%%eax\n\t"
"xorl %%edx,%%edx\n\t"
"repe; scasl\n\t"
"je 1f\n\t"
"xorl -4(%%edi),%%eax\n\t"
"subl $4,%%edi\n\t"
"bsfl %%eax,%%edx\n"
"1:\tsubl %%ebx,%%edi\n\t"
"shll $3,%%edi\n\t"
"addl %%edi,%%edx\n\t"
"popl %%eax"
:"=d" (res)
:"c" ((size + 31) >> 5), "D" (addr), "b" (addr)
/*:"ax", "cx", "di"*/);
return res;
}