Commit edd53aa9 authored by Anton Altaparmakov's avatar Anton Altaparmakov Committed by Linus Torvalds

[PATCH] x86_64 has buggy ffs() implementation

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.
parent 9bdcb64b
...@@ -458,7 +458,7 @@ static __inline__ int ffs(int x) ...@@ -458,7 +458,7 @@ static __inline__ int ffs(int x)
__asm__("bsfl %1,%0\n\t" __asm__("bsfl %1,%0\n\t"
"cmovzl %2,%0" "cmovzl %2,%0"
: "=r" (r) : "g" (x), "r" (-1)); : "=r" (r) : "rm" (x), "r" (-1));
return r+1; return r+1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment