diff options
author | benno <benno@FreeBSD.org> | 2002-02-24 23:31:49 +0000 |
---|---|---|
committer | benno <benno@FreeBSD.org> | 2002-02-24 23:31:49 +0000 |
commit | d4d68be2fe6502f0ab8bf5abbd9a06a166649315 (patch) | |
tree | 7493c47d70bfd8b78cf1aca907bed311cd26ff06 /sys/powerpc/include/atomic.h | |
parent | 82577a6d21f497904d29a5d605c5cb14e7e2027c (diff) | |
download | FreeBSD-src-d4d68be2fe6502f0ab8bf5abbd9a06a166649315.zip FreeBSD-src-d4d68be2fe6502f0ab8bf5abbd9a06a166649315.tar.gz |
Make atomic_cmpset_32 correctly return 0 on failure.
Diffstat (limited to 'sys/powerpc/include/atomic.h')
-rw-r--r-- | sys/powerpc/include/atomic.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/powerpc/include/atomic.h b/sys/powerpc/include/atomic.h index 218e973..194b6c1 100644 --- a/sys/powerpc/include/atomic.h +++ b/sys/powerpc/include/atomic.h @@ -345,7 +345,10 @@ atomic_cmpset_32(volatile u_int32_t* p, u_int32_t cmpval, u_int32_t newval) "bne- 1b\n\t" /* spin if failed */ "eieio\n" /* memory barrier */ "sync\n" + "b 3f\n\t" /* we've succeeded */ "2:\t\n" + "xor %0,%0,%0\t\n" /* failure, so return 0 */ + "3:\t\n" : "=&r" (ret) : "r" (cmpval), "r" (newval), "r" (p) : "memory"); |