diff options
author | bde <bde@FreeBSD.org> | 2000-01-01 12:28:48 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2000-01-01 12:28:48 +0000 |
commit | ae860f51bcd7de99301e26ddb53ba5250105c5ce (patch) | |
tree | 85d9fbedaf3e762aa641c50058410a1b1e6969bc /sys | |
parent | 0fb3f8eb84d36cf3aa47089037856d4171e8b4ab (diff) | |
download | FreeBSD-src-ae860f51bcd7de99301e26ddb53ba5250105c5ce.zip FreeBSD-src-ae860f51bcd7de99301e26ddb53ba5250105c5ce.tar.gz |
Finish (?) importing the Linux ext2fs files that our GPL'ed ext2fs
files seem to be based on. Don't bother importing <asm-i386/string.h>
just to get the Linux implementation of memscan() which is appended
to our i386-bitops.h. The BSD skpc() should have been used instead
of memscan().
Obtained from: Linux 1.2.2 distribution
Diffstat (limited to 'sys')
-rw-r--r-- | sys/gnu/ext2fs/i386-bitops.h | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/sys/gnu/ext2fs/i386-bitops.h b/sys/gnu/ext2fs/i386-bitops.h index a66679e..ee339bd 100644 --- a/sys/gnu/ext2fs/i386-bitops.h +++ b/sys/gnu/ext2fs/i386-bitops.h @@ -1,9 +1,3 @@ -/* - * this is mixture of i386/bitops.h and asm/string.h - * taken from the Linux source tree - * - * XXX replace with Mach routines or reprogram in C - */ #ifndef _I386_BITOPS_H #define _I386_BITOPS_H @@ -31,7 +25,7 @@ extern __inline__ int set_bit(int nr, void * addr) __asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"ir" (nr)); + :"r" (nr)); return oldbit; } @@ -41,7 +35,7 @@ extern __inline__ int clear_bit(int nr, void * addr) __asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"ir" (nr)); + :"r" (nr)); return oldbit; } @@ -51,7 +45,7 @@ extern __inline__ int change_bit(int nr, void * addr) __asm__ __volatile__("btcl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"ir" (nr)); + :"r" (nr)); return oldbit; } @@ -65,7 +59,7 @@ extern __inline__ int test_bit(int nr, void * addr) __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit) - :"m" (ADDR),"ir" (nr)); + :"m" (ADDR),"r" (nr)); return oldbit; } @@ -81,18 +75,20 @@ extern inline int find_first_zero_bit(void * addr, unsigned size) __asm__(" cld movl $-1,%%eax - xorl %%edx,%%edx repe; scasl je 1f - xorl -4(%%edi),%%eax subl $4,%%edi + movl (%%edi),%%eax + notl %%eax bsfl %%eax,%%edx -1: subl %%ebx,%%edi + jmp 2f +1: xorl %%edx,%%edx +2: subl %%ebx,%%edi shll $3,%%edi addl %%edi,%%edx" :"=d" (res) :"c" ((size + 31) >> 5), "D" (addr), "b" (addr) - :"ax", "cx", "di"); + :"ax", "bx", "cx", "di"); return res; } @@ -136,24 +132,4 @@ extern inline unsigned long ffz(unsigned long word) return word; } -/* - * memscan() taken from linux asm/string.h - */ -/* - * find the first occurrence of byte 'c', or 1 past the area if none - */ -extern inline char * memscan(void * addr, unsigned char c, int size) -{ - if (!size) - return addr; - __asm__("cld - repnz; scasb - jnz 1f - dec %%edi -1: " - : "=D" (addr), "=c" (size) - : "0" (addr), "1" (size), "a" (c)); - return addr; -} - #endif /* _I386_BITOPS_H */ |