37,6 → 37,7 |
|
#include <arch/barrier.h> |
#include <arch/types.h> |
#include <preemption.h> |
|
/** Atomic add operation. |
* |
56,7 → 57,8 |
|
a = *((uint64_t *) x); |
b = a + i; |
asm volatile ("casx %0, %2, %1\n" : "+m" (*((uint64_t *)x)), "+r" (b) : "r" (a)); |
asm volatile ("casx %0, %2, %1\n" : "+m" (*((uint64_t *)x)), |
"+r" (b) : "r" (a)); |
} while (a != b); |
|
return a; |
97,7 → 99,8 |
uint64_t v = 1; |
volatile uintptr_t x = (uint64_t) &val->count; |
|
asm volatile ("casx %0, %2, %1\n" : "+m" (*((uint64_t *) x)), "+r" (v) : "r" (0)); |
asm volatile ("casx %0, %2, %1\n" : "+m" (*((uint64_t *) x)), |
"+r" (v) : "r" (0)); |
|
return v; |
} |
109,6 → 112,8 |
|
volatile uintptr_t x = (uint64_t) &val->count; |
|
preemption_disable(); |
|
asm volatile ( |
"0:\n" |
"casx %0, %3, %1\n" |