svn commit: r248071 - stable/9/sys/cddl/dev/dtrace

Ryan Stone rstone at FreeBSD.org
Fri Mar 8 21:03:36 UTC 2013


Author: rstone
Date: Fri Mar  8 21:03:35 2013
New Revision: 248071
URL: http://svnweb.freebsd.org/changeset/base/248071

Log:
  MFC r226452 (by marcel@)
  
    Define dtrace_cmpset_long in terms of atomic_cmpset_long
    and not by virtue of inline assembly. Now this file
    compiles on all supported architectures.

Modified:
  stable/9/sys/cddl/dev/dtrace/dtrace_debug.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cddl/dev/dtrace/dtrace_debug.c
==============================================================================
--- stable/9/sys/cddl/dev/dtrace/dtrace_debug.c	Fri Mar  8 20:33:50 2013	(r248070)
+++ stable/9/sys/cddl/dev/dtrace/dtrace_debug.c	Fri Mar  8 21:03:35 2013	(r248071)
@@ -31,49 +31,9 @@
 
 #ifdef DEBUG
 
-#if defined(__amd64__)
-static __inline int
-dtrace_cmpset_long(volatile u_long *dst, u_long exp, u_long src)
-{
-	u_char res;
-
-	__asm __volatile(
-	"	 lock ; 		"
-	"	cmpxchgq %2,%1 ;	"
-	"       sete	%0 ;		"
-	"1:				"
-	"# dtrace_cmpset_long"
-	: "=a" (res),			/* 0 */
-	  "=m" (*dst)			/* 1 */
-	: "r" (src),			/* 2 */
-	  "a" (exp),			/* 3 */
-	  "m" (*dst)			/* 4 */
-	: "memory");
-
-	return (res);
-}
-#elif defined(__i386__)
-static __inline int
-dtrace_cmpset_long(volatile u_long *dst, u_long exp, u_long src)
-{
-	u_char res;
-
-	__asm __volatile(
-	"        lock ;            	"
-	"       cmpxchgl %2,%1 ;        "
-	"       sete    %0 ;            "
-	"1:                             "
-	"# dtrace_cmpset_long"
-	: "=a" (res),                   /* 0 */
-	  "=m" (*dst)                   /* 1 */
-	: "r" (src),                    /* 2 */
-	  "a" (exp),                    /* 3 */
-	  "m" (*dst)                    /* 4 */
-	: "memory");
+#include <machine/atomic.h>
 
-	return (res);
-}
-#endif
+#define	dtrace_cmpset_long	atomic_cmpset_long
 
 #define DTRACE_DEBUG_BUFR_SIZE	(32 * 1024)
 


More information about the svn-src-stable-9 mailing list