svn commit: r311898 - head/sys/sparc64/include

Mateusz Guzik mjg at FreeBSD.org
Tue Jan 10 21:10:21 UTC 2017


Author: mjg
Date: Tue Jan 10 21:10:20 2017
New Revision: 311898
URL: https://svnweb.freebsd.org/changeset/base/311898

Log:
  sparc64: add atomic_fcmpset
  
  Tested on hardware provided by feld.
  
  Reviewed by:	marius

Modified:
  head/sys/sparc64/include/atomic.h

Modified: head/sys/sparc64/include/atomic.h
==============================================================================
--- head/sys/sparc64/include/atomic.h	Tue Jan 10 20:52:44 2017	(r311897)
+++ head/sys/sparc64/include/atomic.h	Tue Jan 10 21:10:20 2017	(r311898)
@@ -219,6 +219,40 @@ atomic_cmpset_rel_ ## name(volatile ptyp
 	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)					\
 {									\


More information about the svn-src-head mailing list