Re: [PATCH] [2.5] asm-generic/atomic.h and changes to arm, parisc, mips, m68k, sh, cris to use it

From: Roman Zippel (zippel@linux-m68k.org)
Date: Thu Aug 08 2002 - 18:04:40 EST


Hi,

On 9 Aug 2002, Luca Barbieri wrote:

> > The compiler can cache the value in a register
> It shouldn't since it is volatile and the machine has instructions with
> memory operands.

volatile is no guarantee for that:

volatile int x;

void f(int y)
{
        x += y;
}

becomes:

        move.l x,%d0
        add.l 8(%a6),%d0
        move.l %d0,x

I agree that volatile should avoid caching, but it does not guarantee an
atomic modify.

bye, Roman

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 15 2002 - 22:00:18 EST