]> git.hungrycats.org Git - linux/commitdiff
[PATCH] x86_64 has buggy ffs() implementation
authorAnton Altaparmakov <aia21@cam.ac.uk>
Fri, 14 May 2004 14:53:01 +0000 (07:53 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 14 May 2004 14:53:01 +0000 (07:53 -0700)
x86_64 has an incorrect ffs() implementation.  The asm uses "g" instead
of "rm" for the bsfl instruction.  (This was spotted by Yuri Per.)

bsfl does not accept constant values but only memory or register ones.
On i386 the correct "rm" is used.

This causes NTFS build to fail as gcc optimizes a variable into a
constant and ffs() then fails to assemble.

include/asm-x86_64/bitops.h

index 5ce5dcef4f35bf056f521ba3837cb84e376dc955..ae42bca7343d9821f52cf8c7238f566413d71b62 100644 (file)
@@ -458,7 +458,7 @@ static __inline__ int ffs(int x)
 
        __asm__("bsfl %1,%0\n\t"
                "cmovzl %2,%0" 
-               : "=r" (r) : "g" (x), "r" (-1));
+               : "=r" (r) : "rm" (x), "r" (-1));
        return r+1;
 }