Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Feb 2005 20:25:20 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 71492 for review
Message-ID:  <200502212025.j1LKPKm5060546@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=71492

Change 71492 by jhb@jhb_slimer on 2005/02/21 20:25:13

	MFi386: Don't use fences at all for UP kernels.

Affected files ...

.. //depot/projects/smpng/sys/amd64/include/atomic.h#6 edit

Differences ...

==== //depot/projects/smpng/sys/amd64/include/atomic.h#6 (text+ko) ====

@@ -162,6 +162,8 @@
 
 #if defined(__GNUC__)
 
+#if defined(_KERNEL) && !defined(SMP)
+
 #define ATOMIC_STORE_LOAD(TYPE)				\
 static __inline u_##TYPE				\
 atomic_load_acq_##TYPE(volatile u_##TYPE *p)		\
@@ -169,6 +171,25 @@
 	u_##TYPE v;					\
 							\
 	v = *p;						\
+	return (v);					\
+}							\
+							\
+static __inline void					\
+atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\
+{							\
+	*p = v;						\
+}							\
+struct __hack
+
+#else /* defined(SMP) */
+
+#define ATOMIC_STORE_LOAD(TYPE)				\
+static __inline u_##TYPE				\
+atomic_load_acq_##TYPE(volatile u_##TYPE *p)		\
+{							\
+	u_##TYPE v;					\
+							\
+	v = *p;						\
 	__asm __volatile("lfence" ::: "memory");	\
 	return (v);					\
 }							\
@@ -181,6 +202,8 @@
 }							\
 struct __hack
 
+#endif	/* !define(SMP) */
+
 #else /* !defined(__GNUC__) */
 
 extern int atomic_cmpset_int(volatile u_int *, u_int, u_int);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200502212025.j1LKPKm5060546>