Re: bitops porting question

2 messages, 2 authors, 2000-11-21 · open the first message on its own page

Re: bitops porting question

From: Andi Kleen <hidden>
Date: 2000-11-21 14:20:56

On Tue, Nov 21, 2000 at 06:44:50AM -0600, Todd Inglett wrote:
So set_bit(2, &b_state) will set a bit in the 4th byte of the virtual
doubleword.  Not good.  A simple fix seems to be to change the
set_bit(), etc, functions to 64 bit.  In general I think this is the
best approach, but consider what will happen with the following:

    int flags;		/* 32 bits */

    set_bit(2, &flags);  /* bad memory ref! */

On a little endian machine this won't happen since the low order bytes
come first.
iirc David Miller did a big sweep of such things in the generic source
when doing the sparc64 port which has exactly the same problem.
To make sure you should probably define the macro so that you get
a warning for &flags being anything that unsigned long, e.g. using
a inline with a prototype and do a regular grep of the tree if anything
shows these warnings.


-Andi

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

Re: bitops porting question

From: Todd Inglett <hidden>
Date: 2000-11-21 16:10:16

Andi Kleen wrote:
iirc David Miller did a big sweep of such things in the generic source
when doing the sparc64 port which has exactly the same problem.
To make sure you should probably define the macro so that you get
a warning for &flags being anything that unsigned long, e.g. using
a inline with a prototype and do a regular grep of the tree if anything
shows these warnings.
Cool.  I was hoping sparc64 cleaned some of this up.  I don't read sparc
asm very well and for lack of comments in sparc64's bitops.S I wasn't
sure if it went 64 bit or not.  I'll change the prototypes to catch
offenders.

BTW, it appears to be working.
--
-todd

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help