cvs commit: src/sys/i386/include atomic.h

John Baldwin jhb at freebsd.org
Tue Mar 28 20:37:38 UTC 2006


On Tuesday 28 March 2006 15:28, John Baldwin wrote:
> On Tuesday 28 March 2006 15:04, Daniel Eischen wrote:
> > On Tue, 28 Mar 2006, Dag-Erling [iso-8859-1] Smørgrav wrote:
> > 
> > > John Baldwin <jhb at freebsd.org> writes:
> > > > s/off/on/ I trust
> > > >
> > > > Not true.  The tinderbox would attest to that.  Please see code such as
> > > > this:  [...]
> > >
> > > which uses uintptr_t, not actual pointers, to avoid warnings.  In
> > > effect, that code is broken.
> > >
> > > Apply the attached patch, see how far a buildkernel gets...
> > >
> > > I think the proper thing to do, to cover all your bases, would be to
> > > define a MD atomic_*_intptr family which operated on uintptr_t, and
> > > define an MI atomic_*_ptr family which operates on void * based on
> > > that.
> > 
> > I would like to see that.
> > 
> > > > Even userland uses casts when it uses void * rather than uintptr_t for
> > > > the underlying type.  See src/lib/libpthread/sys/lock.c or
> > > > src/lib/libthr/thr_umtx.h.
> > 
> > I didn't like having to do that in libpthread.  It was confusing
> > to me.  I'd be happy if I never had to deal with uintptr_t.
> 
> Then please provide the C idiom for declaring a pointer to a volatile
> void pointer.  volatile void ** declares a pointer to a pointer to a
> volatile void.  This is a real issue that was causing problems with
> refcounting on mbuf's on sparc64 last year due to us not properly
> letting the compiler know what values were being invalidated.
> 
> cdecl doesn't seem up to the task.  And again, we already had this
> discussion N months ago.

Actually, my cdecl skills are in decline. :(

declare foo as pointer to volatile pointer to void
void * volatile *foo

The different placement of volatile broken sparc64 though.  However,
an MI wrapper would work around that issue.  I can pursue a patch
that adds the wrapper unless one of you two wants to do it.  I really
wish you'd have spoken up earlier though.  This was changed back in
July.

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the cvs-src mailing list