lkml.org 
[lkml]   [2006]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.4.x: i386/x86_64 bitops clobberings
Willy Tarreau wrote:
> I've done it too, but unfortunately, I discovered that it does not build
> with gcc-2.95 anymore, while 3.3 is fine :
>
> cyclades.c: In function `cyy_interrupt':
> /usr/src/git/linux-2.4/include/asm/bitops.h:130: inconsistent operand constraints in an `asm'
> cyclades.c: In function `cyz_handle_rx':
> /usr/src/git/linux-2.4/include/asm/bitops.h:130: inconsistent operand constraints in an `asm'
>
> 127 __asm__ __volatile__( LOCK_PREFIX
> 128 "btsl %2,%1\n\tsbbl %0,%0"
> 129 :"=r" (oldbit),"+m" (ADDR)
> 130 :"Ir" (nr) : "memory");
>
>
> I don't know what the right solution should be. I'm not fond of #ifdefs,
> and I'm embarrassed to know that gcc can do all sorts of nasty things due
> to a wrong clobbering :-/
>
> If you have any idea on the subject, I'm willing to try.

What about

#if __GNUC__ < 3
#define ADDR_DEPS "=m"
#else
#define ADDR_DEPS "+m"
#endif

__asm__ __volatile__( LOCK_PREFIX
"btsl %2,%1\n\tsbbl %0,%0"
:"=r" (oldbit),ADDR_DEPS (ADDR)
:"Ir" (nr) : "memory");

or something similar? Would keep the number of #ifs low.

Jan

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2006-10-09 08:31    [W:0.057 / U:0.940 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site