Make atomic_cmpset_32 correctly return 0 on failure.

This commit is contained in:
Benno Rice 2002-02-24 23:31:49 +00:00
parent 0077e8223b
commit dfc02c301d

View File

@ -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");