Apply bug fixes

Submitted by:	marius
This commit is contained in:
Doug Barton 2011-07-06 00:47:27 +00:00
parent 410cde006a
commit 09103e4808

View File

@ -72,9 +72,9 @@ isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) {
for (prev = *(volatile isc_int32_t *)p; ; prev = swapped) { for (prev = *(volatile isc_int32_t *)p; ; prev = swapped) {
swapped = prev + val; swapped = prev + val;
__asm__ volatile( __asm__ volatile(
"casa [%1] %2, %3, %0" "casa [%2] %3, %4, %0"
: "+r"(swapped) : "+r"(swapped), "=m"(*p)
: "r"(p), "n"(ASI_P), "r"(prev)); : "r"(p), "n"(ASI_P), "r"(prev), "m"(*p));
if (swapped == prev) if (swapped == prev)
break; break;
} }
@ -92,10 +92,9 @@ isc_atomic_store(isc_int32_t *p, isc_int32_t val) {
for (prev = *(volatile isc_int32_t *)p; ; prev = swapped) { for (prev = *(volatile isc_int32_t *)p; ; prev = swapped) {
swapped = val; swapped = val;
__asm__ volatile( __asm__ volatile(
"casa [%1] %2, %3, %0" "casa [%2] %3, %4, %0"
: "+r"(swapped) : "+r"(swapped), "=m"(*p)
: "r"(p), "n"(ASI_P), "r"(prev) : "r"(p), "n"(ASI_P), "r"(prev), "m"(*p));
: "memory");
if (swapped == prev) if (swapped == prev)
break; break;
} }
@ -111,9 +110,9 @@ isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) {
isc_int32_t temp = val; isc_int32_t temp = val;
__asm__ volatile( __asm__ volatile(
"casa [%1] %2, %3, %0" "casa [%2] %3, %4, %0"
: "+r"(temp) : "+r"(temp), "=m"(*p)
: "r"(p), "n"(ASI_P), "r"(cmpval)); : "r"(p), "n"(ASI_P), "r"(cmpval), "m"(*p));
return (temp); return (temp);
} }