PERFORCE change 28104 for review

Peter Wemm peter at FreeBSD.org
Fri Apr 4 17:49:57 PST 2003


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

Change 28104 by peter at peter_daintree on 2003/04/04 17:49:16

	implement some more.  This is just about done I think.  Have to check
	the gcc manual for how to specify 64 bit regs though.

Affected files ...

.. //depot/projects/hammer/sys/x86_64/include/atomic.h#6 edit

Differences ...

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

@@ -141,25 +141,21 @@
 static __inline int
 atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src)
 {
-#if 0
 	long res = exp;
 
 	__asm __volatile (
 	"	" __XSTRING(MPLOCKED) "	"
-	"	cmpxchgl %1,%2 ;	"
+	"	cmpxchgq %1,%2 ;	"
 	"       setz	%%al ;		"
 	"	movzbl	%%al,%0 ;	"
 	"1:				"
 	"# atomic_cmpset_int"
-	: "+a" (res)			/* 0 (result) */
+	: "+a" (res)			/* 0 (result) %rax, XXX check */
 	: "r" (src),			/* 1 */
 	  "m" (*(dst))			/* 2 */
 	: "memory");				 
 
 	return (res);
-#else
-	return (0);
-#endif
 }
 #endif /* defined(__GNUC__) */
 
@@ -392,8 +388,8 @@
 	u_long result;
 
 	__asm __volatile (
-	"	xorl	%0,%0 ;		"
-	"	xchgl	%1,%0 ;		"
+	"	xorq	%0,%0 ;		"
+	"	xchgq	%1,%0 ;		"
 	"# atomic_readandclear_int"
 	: "=&r" (result)		/* 0 (result) */
 	: "m" (*addr));			/* 1 (addr) */


More information about the p4-projects mailing list