summaryrefslogtreecommitdiffstats
path: root/sys/mips
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-07-08 18:12:24 +0000
committerkib <kib@FreeBSD.org>2015-07-08 18:12:24 +0000
commitc17f8bfdd50cd481c229672bc267cb3c845ace07 (patch)
treebcad6726cce83587071eccc899bb9aa9ec819f44 /sys/mips
parent52af6a67b662366f80816c510628a1be8fd2ba0c (diff)
downloadFreeBSD-src-c17f8bfdd50cd481c229672bc267cb3c845ace07.zip
FreeBSD-src-c17f8bfdd50cd481c229672bc267cb3c845ace07.tar.gz
Add the atomic_thread_fence() family of functions with intent to
provide a semantic defined by the C11 fences with corresponding memory_order. atomic_thread_fence_acq() gives r | r, w, where r and w are read and write accesses, and | denotes the fence itself. atomic_thread_fence_rel() is r, w | w. atomic_thread_fence_acq_rel() is the combination of the acquire and release in single operation. Note that reads after the acq+rel fence could be made visible before writes preceeding the fence. atomic_thread_fence_seq_cst() orders all accesses before/after the fence, and the fence itself is globally ordered against other sequentially consistent atomic operations. Reviewed by: alc Discussed with: bde Sponsored by: The FreeBSD Foundation MFC after: 3 weeks
Diffstat (limited to 'sys/mips')
-rw-r--r--sys/mips/include/atomic.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/sys/mips/include/atomic.h b/sys/mips/include/atomic.h
index b43cc61..d4b951e 100644
--- a/sys/mips/include/atomic.h
+++ b/sys/mips/include/atomic.h
@@ -496,6 +496,34 @@ atomic_fetchadd_64(__volatile uint64_t *p, uint64_t v)
}
#endif
+static __inline void
+atomic_thread_fence_acq(void)
+{
+
+ mips_sync();
+}
+
+static __inline void
+atomic_thread_fence_rel(void)
+{
+
+ mips_sync();
+}
+
+static __inline void
+atomic_thread_fence_acq_rel(void)
+{
+
+ mips_sync();
+}
+
+static __inline void
+atomic_thread_fence_seq_cst(void)
+{
+
+ mips_sync();
+}
+
/* Operations on chars. */
#define atomic_set_char atomic_set_8
#define atomic_set_acq_char atomic_set_acq_8
OpenPOWER on IntegriCloud