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 09:21:15 -0500 (CDT), John D. Baker wrote:
> Mind you, I don't actually have any sparc-fu, but am mainly cargo-culting
> the patches and examining the db4-4.7.25.3 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-4.7.25.3 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?

The 'stbar' mandates strict ordering of memory accesses, see
<http://docs.oracle.com/cd/E19683-01/806-5222/hwovr-17/index.html>.
 
> 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-4.7.25.3 source:
> 
> #define       MUTEX_MEMBAR(x)         ({asm volatile("stbar");})
> 
> GCC likes either one, so I guess that's not really an issue.

Unless you invoke it with -ansi, which makes 'asm' illegal. Is there a 
general preference within pkgsrc?

hauke

-- 
Hauke Fath                        <hauke%Espresso.Rhein-Neckar.DE@localhost>
Ernst-Ludwig-Straße 15
64625 Bensheim
Germany


Home | Main Index | Thread Index | Old Index