Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Nix mb_* on sparc and sparc64.



details:   https://anonhg.NetBSD.org/src/rev/11ae8adbe53b
branches:  trunk
changeset: 465599:11ae8adbe53b
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Nov 29 20:06:34 2019 +0000

description:
Nix mb_* on sparc and sparc64.

diffstat:

 sys/arch/sparc/include/lock.h    |  44 +---------------------------------------
 sys/arch/sparc64/include/mutex.h |   8 +++++-
 2 files changed, 7 insertions(+), 45 deletions(-)

diffs (78 lines):

diff -r 4e43fa988281 -r 11ae8adbe53b sys/arch/sparc/include/lock.h
--- a/sys/arch/sparc/include/lock.h     Fri Nov 29 20:06:08 2019 +0000
+++ b/sys/arch/sparc/include/lock.h     Fri Nov 29 20:06:34 2019 +0000
@@ -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 @@
        *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 */
diff -r 4e43fa988281 -r 11ae8adbe53b sys/arch/sparc64/include/mutex.h
--- a/sys/arch/sparc64/include/mutex.h  Fri Nov 29 20:06:08 2019 +0000
+++ b/sys/arch/sparc64/include/mutex.h  Fri Nov 29 20:06:34 2019 +0000
@@ -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 @@
 #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.



Home | Main Index | Thread Index | Old Index