Tue Feb 18 13:21:04 2014 UTC ()
Make the _and_fetch_8 primitives return the new value they calculated
and set - not whatever is found in memory later.


(martin)
diff -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_nand_64_cas.c
diff -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_sub_64_cas.c
diff -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_xor_64_cas.c

cvs diff -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_nand_64_cas.c (expand / switch to context diff)
--- src/common/lib/libc/atomic/atomic_nand_64_cas.c 2014/02/18 10:16:55 1.1
+++ src/common/lib/libc/atomic/atomic_nand_64_cas.c 2014/02/18 13:21:04 1.2
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_nand_64_cas.c,v 1.1 2014/02/18 10:16:55 martin Exp $	*/
+/*	$NetBSD: atomic_nand_64_cas.c,v 1.2 2014/02/18 13:21:04 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 		old = *addr;
 		new = ~(old & val);
 	} while (atomic_cas_64(addr, old, new) != old);
-	return *addr;
+	return new;
 }
 
 #endif

cvs diff -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_sub_64_cas.c (expand / switch to context diff)
--- src/common/lib/libc/atomic/atomic_sub_64_cas.c 2014/02/18 10:16:55 1.1
+++ src/common/lib/libc/atomic/atomic_sub_64_cas.c 2014/02/18 13:21:04 1.2
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_sub_64_cas.c,v 1.1 2014/02/18 10:16:55 martin Exp $	*/
+/*	$NetBSD: atomic_sub_64_cas.c,v 1.2 2014/02/18 13:21:04 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 		old = *addr;
 		new = old - val;
 	} while (atomic_cas_64(addr, old, new) != old);
-	return *addr;
+	return new;
 }
 
 #endif

cvs diff -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_xor_64_cas.c (expand / switch to context diff)
--- src/common/lib/libc/atomic/atomic_xor_64_cas.c 2014/02/18 10:16:55 1.1
+++ src/common/lib/libc/atomic/atomic_xor_64_cas.c 2014/02/18 13:21:04 1.2
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_xor_64_cas.c,v 1.1 2014/02/18 10:16:55 martin Exp $	*/
+/*	$NetBSD: atomic_xor_64_cas.c,v 1.2 2014/02/18 13:21:04 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 		old = *addr;
 		new = old ^ val;
 	} while (atomic_cas_64(addr, old, new) != old);
-	return *addr;
+	return new;
 }
 
 #endif