Module Name: src
Committed By: martin
Date: Tue Feb 18 13:21:04 UTC 2014
Modified Files:
src/common/lib/libc/atomic: atomic_nand_64_cas.c atomic_sub_64_cas.c
atomic_xor_64_cas.c
Log Message:
Make the _and_fetch_8 primitives return the new value they calculated
and set - not whatever is found in memory later.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_nand_64_cas.c \
src/common/lib/libc/atomic/atomic_sub_64_cas.c \
src/common/lib/libc/atomic/atomic_xor_64_cas.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/common/lib/libc/atomic/atomic_nand_64_cas.c
diff -u src/common/lib/libc/atomic/atomic_nand_64_cas.c:1.1 src/common/lib/libc/atomic/atomic_nand_64_cas.c:1.2
--- src/common/lib/libc/atomic/atomic_nand_64_cas.c:1.1 Tue Feb 18 10:16:55 2014
+++ src/common/lib/libc/atomic/atomic_nand_64_cas.c Tue Feb 18 13:21:04 2014
@@ -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 @@ nand_and_fetch_8(volatile uint64_t *addr
old = *addr;
new = ~(old & val);
} while (atomic_cas_64(addr, old, new) != old);
- return *addr;
+ return new;
}
#endif
Index: src/common/lib/libc/atomic/atomic_sub_64_cas.c
diff -u src/common/lib/libc/atomic/atomic_sub_64_cas.c:1.1 src/common/lib/libc/atomic/atomic_sub_64_cas.c:1.2
--- src/common/lib/libc/atomic/atomic_sub_64_cas.c:1.1 Tue Feb 18 10:16:55 2014
+++ src/common/lib/libc/atomic/atomic_sub_64_cas.c Tue Feb 18 13:21:04 2014
@@ -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 @@ sub_and_fetch_8(volatile uint64_t *addr,
old = *addr;
new = old - val;
} while (atomic_cas_64(addr, old, new) != old);
- return *addr;
+ return new;
}
#endif
Index: src/common/lib/libc/atomic/atomic_xor_64_cas.c
diff -u src/common/lib/libc/atomic/atomic_xor_64_cas.c:1.1 src/common/lib/libc/atomic/atomic_xor_64_cas.c:1.2
--- src/common/lib/libc/atomic/atomic_xor_64_cas.c:1.1 Tue Feb 18 10:16:55 2014
+++ src/common/lib/libc/atomic/atomic_xor_64_cas.c Tue Feb 18 13:21:04 2014
@@ -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 @@ xor_and_fetch_8(volatile uint64_t *addr,
old = *addr;
new = old ^ val;
} while (atomic_cas_64(addr, old, new) != old);
- return *addr;
+ return new;
}
#endif