PERFORCE change 29844 for review

Juli Mallett jmallett at FreeBSD.org
Sat Apr 26 18:06:22 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=29844

Change 29844 by jmallett at jmallett_dalek on 2003/04/26 18:06:14

	Add acq and rel membar forms of cmpset atomics.

Affected files ...

.. //depot/projects/mips/sys/mips/include/atomic.h#13 edit

Differences ...

==== //depot/projects/mips/sys/mips/include/atomic.h#13 (text+ko) ====

@@ -43,6 +43,16 @@
 	mips_write_membar();						\
 }
 
+#define	ATOMIC_ACQ_CMPSET(type)						\
+static __inline int							\
+atomic_cmpset_acq_ ## type(volatile u_ ## type *p, u_ ## type old, u_ ## type val)	\
+{									\
+	int r;								\
+	r = atomic_cmpset_ ## type(p, old, val);			\
+	mips_write_membar();						\
+	return (r);							\
+}
+
 #define	ATOMIC_REL_OP(type, op)						\
 static __inline void							\
 atomic_ ## op ## _rel_ ## type(volatile u_ ## type *p, u_ ## type val)	\
@@ -51,6 +61,16 @@
 	atomic_ ## op ## _ ## type(p, val);				\
 }
 
+#define	ATOMIC_REL_CMPSET(type)						\
+static __inline int							\
+atomic_cmpset_rel_ ## type(volatile u_ ## type *p, u_ ## type old, u_ ## type val)	\
+{									\
+	int r;								\
+	mips_read_membar();						\
+	atomic_cmpset_ ## type(p, old, val);				\
+	return (r);							\
+}
+
 #define	ATOMIC_ACQ_LOAD(type)						\
 static __inline u_ ## type						\
 atomic_load_acq_ ## type(volatile u_ ## type *p)			\
@@ -134,6 +154,9 @@
 	return res;
 }
 
+ATOMIC_ACQ_CMPSET(int)
+ATOMIC_REL_CMPSET(int)
+
 static __inline u_int
 atomic_readandclear_int(volatile u_int *p)
 {
@@ -219,6 +242,9 @@
 	return res;
 }
 
+ATOMIC_ACQ_CMPSET(long)
+ATOMIC_REL_CMPSET(long)
+
 static __inline u_long
 atomic_readandclear_long(volatile u_long *p)
 {
@@ -308,7 +334,9 @@
  * Clean up after the membar stuff.
  */
 #undef ATOMIC_ACQ_OP
+#undef ATOMIC_ACQ_CMPSET
 #undef ATOMIC_REL_OP
+#undef ATOMIC_REL_CMPSET
 #undef ATOMIC_ACQ_LOAD
 #undef ATOMIC_REL_STORE
 


More information about the p4-projects mailing list