96,8 → 96,9 |
static inline long test_and_set(atomic_t *val) |
{ |
uint64_t v = 1; |
volatile uintptr_t x = (uint64_t) &val->count; |
|
__asm__ volatile ("casx %0, %2, %1\n" : "+m" (*val), "+r" (v) : "r" (0)); |
__asm__ volatile ("casx %0, %2, %1\n" : "+m" (*((uint64_t *) x)), "+r" (v) : "r" (0)); |
|
return v; |
} |
107,6 → 108,8 |
uint64_t tmp1 = 1; |
uint64_t tmp2; |
|
volatile uintptr_t x = (uint64_t) &val->count; |
|
__asm__ volatile ( |
"0:\n" |
"casx %0, %3, %1\n" |
119,7 → 122,7 |
"ba 1b\n" |
"nop\n" |
"2:\n" |
: "+m" (*val), "+r" (tmp1), "+r" (tmp2) : "r" (0) |
: "+m" (*((uint64_t *) x)), "+r" (tmp1), "+r" (tmp2) : "r" (0) |
); |
|
/* |