atomic: add stub atomic_load_consume_ptr

This commit is contained in:
Mateusz Guzik 2021-01-25 21:09:41 +01:00
parent cc96f92a57
commit 054ce2b037
2 changed files with 13 additions and 0 deletions

View File

@ -236,6 +236,11 @@ void kcsan_atomic_thread_fence_seq_cst(void);
__retptr; \
})
#define atomic_load_acq_ptr kcsan_atomic_load_acq_ptr
#define atomic_load_consume_ptr(x) ({ \
__typeof(*x) __retptr; \
__retptr = (void *)kcsan_atomic_load_acq_ptr((volatile uintptr_t *)(x));\
__retptr; \
})
#define atomic_readandclear_ptr kcsan_atomic_readandclear_ptr
#define atomic_set_ptr kcsan_atomic_set_ptr
#define atomic_set_acq_ptr kcsan_atomic_set_acq_ptr

View File

@ -70,4 +70,12 @@
(*(volatile uint64_t *)(p) = (uint64_t)(v))
#endif
/*
* Currently all architectures provide acquire and release fences on their own,
* but they don't provide consume. Kludge below allows relevant code to stop
* openly resorting to the stronger acquire fence, to be sorted out.
*/
#define atomic_load_consume_ptr(p) \
((__typeof(*p)) atomic_load_acq_ptr((uintptr_t *)p))
#endif