Nix mb_* on sparc and sparc64.

This commit is contained in:
riastradh 2019-11-29 20:06:34 +00:00
parent 47bbf2f62d
commit 445d23458a
2 changed files with 7 additions and 45 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lock.h,v 1.32 2017/09/17 00:01:08 christos Exp $ */
/* $NetBSD: lock.h,v 1.33 2019/11/29 20:06:34 riastradh Exp $ */
/*-
* Copyright (c) 1998, 1999, 2006 The NetBSD Foundation, Inc.
@ -140,46 +140,4 @@ __cpu_simple_unlock(__cpu_simple_lock_t *alp)
*alp = __SIMPLELOCK_UNLOCKED;
}
#if defined(__sparc_v9__)
static __inline void
mb_read(void)
{
__asm __volatile("membar #LoadLoad" : : : "memory");
}
static __inline void
mb_write(void)
{
__asm __volatile("" : : : "memory");
}
static __inline void
mb_memory(void)
{
__asm __volatile("membar #MemIssue" : : : "memory");
}
#else /* __sparc_v9__ */
static __inline void
mb_read(void)
{
static volatile int junk;
__asm volatile("st %%g0,[%0]"
:
: "r" (&junk)
: "memory");
}
static __inline void
mb_write(void)
{
__insn_barrier();
}
static __inline void
mb_memory(void)
{
mb_read();
}
#endif /* __sparc_v9__ */
#endif /* _MACHINE_LOCK_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mutex.h,v 1.4 2008/04/28 20:23:37 martin Exp $ */
/* $NetBSD: mutex.h,v 1.5 2019/11/29 20:06:34 riastradh Exp $ */
/*-
* Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@ -55,7 +55,11 @@ struct kmutex {
#define __HAVE_MUTEX_STUBS 1
#define __HAVE_SIMPLE_MUTEXES 1
#define MUTEX_RECEIVE(mtx) mb_read()
/*
* XXX Should this be LoadLoad|LoadStore, or does the assumption of a
* preceding atomic r/m/w operation obviate the need for that?
*/
#define MUTEX_RECEIVE(mtx) __asm __volatile("membar #LoadLoad" : : : "memory")
/*
* MUTEX_GIVE: no memory barrier required, as _lock_cas() will take care of it.