This change adds a Unikraft macro for the raw compare-exchange
operation, which in contrast to the existing macro may modify its
arguments.
Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
GitHub-Closes: #1156
#define ukarch_exchange_n(dst, v) \
__atomic_exchange_n(dst, v, __ATOMIC_SEQ_CST)
+#define ukarch_compare_exchange_n(dst, exp, des) \
+ __atomic_compare_exchange_n(dst, exp, des, 0, \
+ __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
+
#define ukarch_compare_exchange_sync(ptr, old, new) \
({ \
__typeof__(*ptr) stored = old; \