[lkml]   [2001]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Kernel's X86 ffs() doesn't work on constants.
Followup to:  <>
By author: "Justin T. Gibbs" <>
In newsgroup:
> If you attempt to call ffs(SOME_CONSTAT) in an x86 kernel under
> Linux, you get messages like this:
> {standard input}: Assembler messages:
> {standard input}:14864: Error: suffix or operands invalid for `bsf'
> I'm not enough of a GCC asm syntax guru to understand why the
> compiler/assembler doesn't handle this, but it is hightly anoying.
> "Why not just code in the constant bit offset?", you ask? If
> the constant the bit offset is based on is ever changed, I must
> recognize that the change occured and change the second constant.
> For constants that are maintained outside of my code, I'd rather
> code the dependency once and let the compiler ensure that the constants
> are in sync.

Try changing the "g" in the definition of ffs() (asm/bitops.h) to
"rm"; the "g" constrains incorrectly allows immediate operands.

<> at work, <> in private!
"Unix gives you enough rope to shoot yourself in the foot." <>
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:13    [W:0.027 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site