Subject: Re: bus_space and barriers
To: Chris G. Demetriou <cgd@sibyte.com>
From: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
List: tech-kern
Date: 10/20/2000 17:43:20
> > #define write() do { \
> > if (readsp) asm("mb"); \
> > else asm("wmb"); \
> > readsp = 0; \
> > asm("write"); \
> > } while (0)
> >
> >
> > #define read() do { \
> > asm("mb"); \
> > asm("read"); \
> > readsp = 1; \
> > } while (0)
>
> except, in truly generic macros like this, you cannot reasonably use
> 'extern int' unless you know that the macros will be used without any
> possibility of taking an interrupt or exception. you really should be
> using volatile int, and in that case, because if you do not you
> _might_ lose. (actually, even if you do, you might lose, since
> there's no atomicity of access.)
.. and then there's also the minor matter of MP..
- Bill