Module Name:    src
Committed By:   chs
Date:           Wed Jul  7 01:13:29 UTC 2010

Modified Files:
        src/sys/arch/amd64/amd64: copy.S

Log Message:
fix more bugs in ucas_*():
move the "old" value to %*ax so that cmpxchg* can work.
remove the PCB_ONFAULT stuff, onfault_handler() handles this already.
return the error from fault handler in ucas_fault rather than forcing EFAULT.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/amd64/amd64/copy.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/copy.S
diff -u src/sys/arch/amd64/amd64/copy.S:1.17 src/sys/arch/amd64/amd64/copy.S:1.18
--- src/sys/arch/amd64/amd64/copy.S:1.17	Tue Jun 22 18:26:05 2010
+++ src/sys/arch/amd64/amd64/copy.S	Wed Jul  7 01:13:29 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.S,v 1.17 2010/06/22 18:26:05 rmind Exp $	*/
+/*	$NetBSD: copy.S,v 1.18 2010/07/07 01:13:29 chs Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -502,13 +502,11 @@
 	movq	$VM_MAXUSER_ADDRESS-8, %r8
 	cmpq	%r8, %rdi
 	ja	_C_LABEL(ucas_fault)
-	/* Label for fault handler */
+	movq	%rsi, %rax
 .Lucas64_start:
 	/* Perform the CAS */
 	lock
 	cmpxchgq %rdx, (%rdi)
-	/* Clear the fault handler */
-	movq	%rax, PCB_ONFAULT(%r8)
 .Lucas64_end:
 	/*
 	 * Note: %rax is "old" value.
@@ -516,8 +514,6 @@
 	 */
 	movq	%rax, (%rcx)
 	xorq	%rax, %rax
-	/* Clear the fault handler */
-	movq	%rax, PCB_ONFAULT(%r8)
 	ret
 	DEFERRED_SWITCH_CALL
 
@@ -530,7 +526,7 @@
 	movq	$VM_MAXUSER_ADDRESS-4, %r8
 	cmpq	%r8, %rdi
 	ja	_C_LABEL(ucas_fault)
-	/* Label for fault handler */
+	movl	%esi, %eax
 .Lucas32_start:
 	/* Perform the CAS */
 	lock
@@ -546,15 +542,15 @@
 	DEFERRED_SWITCH_CALL
 
 /*
- * Fault handler for ucas_32() and ucas_64().
- * Unset the handler and return the failure.
+ * Fault handler for ucas_*().
+ * Just return the error set by trap().
  */
 NENTRY(ucas_fault)
-	movq	$EFAULT, %rax
 	ret
 
 /*
- * int	ucas_ptr(volatile void *uptr, void *old, void *new, void *ret);
+ * int	ucas_ptr(volatile void **uptr, void *old, void *new, void **ret);
+ * int	ucas_int(volatile int *uptr, int old, intnew, int *ret);
  */
 STRONG_ALIAS(ucas_ptr, ucas_64)
 STRONG_ALIAS(ucas_int, ucas_32)

Reply via email to