mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-09 22:55:31 +00:00
include/qemu/atomic.h: Add signal_barrier
We have some potential race conditions vs our user-exec signal handler that will be solved with this barrier. Backports commit 359896dfa4e9707e1acea99129d324250fccab04 from qemu
This commit is contained in:
parent
d291a311ee
commit
ec81aef8c0
|
@ -96,6 +96,13 @@ void _ReadWriteBarrier(void);
|
||||||
#define smp_read_barrier_depends() barrier()
|
#define smp_read_barrier_depends() barrier()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A signal barrier forces all pending local memory ops to be observed before
|
||||||
|
* a SIGSEGV is delivered to the *same* thread. In practice this is exactly
|
||||||
|
* the same as barrier(), but since we have the correct builtin, use it.
|
||||||
|
*/
|
||||||
|
#define signal_barrier() __atomic_signal_fence(__ATOMIC_SEQ_CST)
|
||||||
|
|
||||||
/* Sanity check that the size of an atomic operation isn't "overly large".
|
/* Sanity check that the size of an atomic operation isn't "overly large".
|
||||||
* Despite the fact that e.g. i686 has 64-bit atomic operations, we do not
|
* Despite the fact that e.g. i686 has 64-bit atomic operations, we do not
|
||||||
* want to use them because we ought not need them, and this lets us do a
|
* want to use them because we ought not need them, and this lets us do a
|
||||||
|
@ -325,6 +332,10 @@ void _ReadWriteBarrier(void);
|
||||||
#define smp_read_barrier_depends() barrier()
|
#define smp_read_barrier_depends() barrier()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef signal_barrier
|
||||||
|
#define signal_barrier() barrier()
|
||||||
|
#endif
|
||||||
|
|
||||||
/* These will only be atomic if the processor does the fetch or store
|
/* These will only be atomic if the processor does the fetch or store
|
||||||
* in a single issue memory operation
|
* in a single issue memory operation
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue