summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authormjg <mjg@FreeBSD.org>2017-03-16 06:00:27 +0000
committermjg <mjg@FreeBSD.org>2017-03-16 06:00:27 +0000
commitb8af6b78be197b6a24bf372442dcb6e044d729b3 (patch)
tree0496f4e01ec297971a9b02afb62b80c63b0dd969 /sys/sparc64
parent3100d6f6dfd7bea82a2fe7136cf72d8423b715bd (diff)
downloadFreeBSD-src-b8af6b78be197b6a24bf372442dcb6e044d729b3.zip
FreeBSD-src-b8af6b78be197b6a24bf372442dcb6e044d729b3.tar.gz
MFC r311169,r311898,r312925,r312973,r312975,r313007,r313040,r313080,
r313254,r313341 amd64: add atomic_fcmpset == sparc64: add atomic_fcmpset == Implement atomic_fcmpset_* for arm and arm64. == Add atomic_fcmpset_*() inlines for powerpc Summary: atomic_fcmpset_*() is analogous to atomic_cmpset(), but saves off the read value from the target memory location into the 'old' pointer in the case of failure. == i386: add atomic_fcmpset == Don't retry a lost reservation in atomic_fcmpset() The desired behavior of atomic_fcmpset_() is to always exit on error. Instead of retrying on lost reservation, leave the retry to the caller, and return == Add atomic_fcmpset_*() inlines for MIPS atomic_fcmpset_*() is analogous to atomic_cmpset(), but saves off the read value from the target memory location into the 'old' pointer. == i386: fixup fcmpset An incorrect output specifier was used which worked with clang by accident, but breaks with the in-tree gcc version. While here plug a whitespace nit. == Implement atomic_fcmpset_*() for RISC-V. == Use 64bit store instruction in atomic_fcmpset_64.
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/include/atomic.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/sparc64/include/atomic.h b/sys/sparc64/include/atomic.h
index c70e99a..b2fd8cc 100644
--- a/sys/sparc64/include/atomic.h
+++ b/sys/sparc64/include/atomic.h
@@ -219,6 +219,40 @@ atomic_cmpset_rel_ ## name(volatile ptype p, vtype e, vtype s) \
return (((vtype)atomic_cas_rel((p), (e), (s), sz)) == (e)); \
} \
\
+static __inline int \
+atomic_fcmpset_ ## name(volatile ptype p, vtype *ep, vtype s) \
+{ \
+ vtype t; \
+ \
+ t = (vtype)atomic_cas((p), (*ep), (s), sz); \
+ if (t == (*ep)) \
+ return (1); \
+ *ep = t; \
+ return (0); \
+} \
+static __inline int \
+atomic_fcmpset_acq_ ## name(volatile ptype p, vtype *ep, vtype s) \
+{ \
+ vtype t; \
+ \
+ t = (vtype)atomic_cas_acq((p), (*ep), (s), sz); \
+ if (t == (*ep)) \
+ return (1); \
+ *ep = t; \
+ return (0); \
+} \
+static __inline int \
+atomic_fcmpset_rel_ ## name(volatile ptype p, vtype *ep, vtype s) \
+{ \
+ vtype t; \
+ \
+ t = (vtype)atomic_cas_rel((p), (*ep), (s), sz); \
+ if (t == (*ep)) \
+ return (1); \
+ *ep = t; \
+ return (0); \
+} \
+ \
static __inline vtype \
atomic_load_ ## name(volatile ptype p) \
{ \
OpenPOWER on IntegriCloud