Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Apr 2003 17:49:54 -0800 (PST)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 28104 for review
Message-ID:  <200304050149.h351ns0H090282@repoman.freebsd.org>

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

Change 28104 by peter@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) */



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