Re: spinlock

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Wed, 1 Dec 1999 02:15:38 +0100


David Wragg wrote:
> > If volatile causes asm "m" constraints to always use the original memory
> > location, that would be quite useful but it is not documented to do so.
>
> As far as I know, it doesn't and isn't.
>
> However, the volatile qualifier is defined in the ISO C standard. If
> gcc breaks the restrictions on what it is allowed to do with volatile
> objects implied by that definition, then it has a bug. If the same
> restrictions don't also apply for the C expressions in inline asm
> constraints, then that would also be a bug, since it would be
> worthless as a feature.

As far as I know, volatile requires that the compiler actually perform
all reads and writes implied by the program, in whatever order is
implied by the program.

In the case of GCC's extended asm, that means it is ok to read a
volatile, pass the effective address of the /copy/ as the asm operand,
then write the modified copy back to the volatile.

-- Jamie

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