summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
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/sparc64
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/sparc64')
-rw-r--r--sys/sparc64/include/atomic.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/sys/sparc64/include/atomic.h b/sys/sparc64/include/atomic.h
index 0ceced8..789ed24 100644
--- a/sys/sparc64/include/atomic.h
+++ b/sys/sparc64/include/atomic.h
@@ -279,6 +279,35 @@ atomic_store_rel_ ## name(volatile ptype p, vtype v) \
atomic_st_rel((p), (v), sz); \
}
+static __inline void
+atomic_thread_fence_acq(void)
+{
+
+ __compiler_membar();
+}
+
+static __inline void
+atomic_thread_fence_rel(void)
+{
+
+ __compiler_membar();
+}
+
+static __inline void
+atomic_thread_fence_acq_rel(void)
+{
+
+ __compiler_membar();
+}
+
+static __inline void
+atomic_thread_fence_seq_cst(void)
+{
+
+ membar(LoadLoad | LoadStore | StoreStore | StoreLoad);
+}
+
+
ATOMIC_GEN(int, u_int *, u_int, u_int, 32);
ATOMIC_GEN(32, uint32_t *, uint32_t, uint32_t, 32);
OpenPOWER on IntegriCloud