Subject: bug in _atomic_cas_64 ?
To: None <>
From: Manuel Bouyer <>
List: port-amd64
Date: 12/10/2007 13:16:01
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

after updating my source tree I found I couldn't boot a amd64 XEN kernel
any more, it failed very early with a rwlock assertion failure. Looking
closer I found the owner field of the rwlock was tructated to 32bits, and
I found _atomic_cas_64 was using a 32bit register. Is the attached patch
correct ?

Manuel Bouyer, LIP6, Universite Paris VI. 
     NetBSD: 26 ans d'experience feront toujours la difference

Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: lib/libc/arch/x86_64/atomic/atomic.S
RCS file: /cvsroot/src/common/lib/libc/arch/x86_64/atomic/atomic.S,v
retrieving revision 1.6
diff -u -r1.6 atomic.S
--- lib/libc/arch/x86_64/atomic/atomic.S	9 Dec 2007 17:33:56 -0000	1.6
+++ lib/libc/arch/x86_64/atomic/atomic.S	10 Dec 2007 12:13:12 -0000
@@ -210,7 +210,7 @@
 	movq	%rsi, %rax
-	cmpxchgl %edx, (%rdi)
+	cmpxchgq %rdx, (%rdi)
 	/* %eax now contains the old value */