tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Mutex implementation on m68k/netbsd-7?

On Mon, 8 Sep 2014, Hauke Fath wrote:

> On Sun, 7 Sep 2014 18:22:43 -0500 (CDT), John D. Baker wrote:
> > I've finally got a tuit of the circular variety to investigate the
> > patches on db4{8}.  The only reason they didn't apply cleanly is because
> > Thanks for the help.
> Well, thanks to you for picking up the ball!

Mind you, I don't actually have any sparc-fu, but am mainly cargo-culting
the patches and examining the db4- sources for comparison.

The only difference I noticed is that your patch inserts the following
in "dbinc/mutex_int.h":

#define MUTEX_UNSET(tsl) ({                                             \
        __asm__ volatile ("stbar");                                     \
        *(tsl) = 0; })

while the db4- version of that file simply has:

#define MUTEX_UNSET(tsl)        (*(tsl) = 0)

Lacking sparc-fu of my own, I'd hazard that's a cache-coherency tactic?

Also, the variant of the "asm" reserved word used is different.  In your
patch (like the sparc-v9 macros):

#define MUTEX_MEMBAR(x) \
        ({ __asm__ volatile ("stbar"); })

while in the db4- source:

#define MUTEX_MEMBAR(x)         ({asm volatile("stbar");})

GCC likes either one, so I guess that's not really an issue.

|/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
|\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
| X  No HTML/proprietary data in email.   BSD just sits there and works!
|/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

Home | Main Index | Thread Index | Old Index