Catch up with linux-user 430014bee7a6c26a70e9f3854428843d5918cdf5 and impelment begin_parallel_context. We'd already moved to using tb_flush__exclusive_or_serial, but need this in several places, like linux-user has.
Signed-off-by: Warner Losh <[email protected]> --- bsd-user/freebsd/os-thread.c | 6 +----- bsd-user/qemu.h | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/bsd-user/freebsd/os-thread.c b/bsd-user/freebsd/os-thread.c index eaab062d3d..4ffa76a798 100644 --- a/bsd-user/freebsd/os-thread.c +++ b/bsd-user/freebsd/os-thread.c @@ -16,7 +16,6 @@ #include "target_arch_thread.h" #include "qemu/guest-random.h" #include "tcg/startup.h" -#include "exec/tb-flush.h" #include "os-thread.h" @@ -1622,10 +1621,7 @@ abi_long do_freebsd_thr_new(CPUArchState *env, * generate code for parallel execution and flush old translations. * Do this now so that the copy gets CF_PARALLEL too. */ - if (!(cpu->tcg_cflags & CF_PARALLEL)) { - cpu->tcg_cflags |= CF_PARALLEL; - tb_flush__exclusive_or_serial(); - } + begin_parallel_context(cpu); new_env = cpu_copy(env); diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index d2dd8c2ee8..851b0c2c5f 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -41,6 +41,7 @@ extern char **environ; #include "target.h" #include "exec/gdbstub.h" #include "exec/page-protection.h" +#include "exec/tb-flush.h" #include "accel/tcg/vcpu-state.h" #include "qemu-os.h" @@ -529,4 +530,21 @@ static inline uint64_t target_arg64(uint32_t word0, uint32_t word1) #include "user/safe-syscall.h" +/* In user-internal.h in linux-user XXX consider similar cleanup */ + +/** + * begin_parallel_context + * @cs: the CPU context + * + * Called when starting the second vcpu, or joining shared memory. + */ +static inline void begin_parallel_context(CPUState *cs) +{ + if (!tcg_cflags_has(cs, CF_PARALLEL)) { + tb_flush__exclusive_or_serial(); + tcg_cflags_set(cs, CF_PARALLEL); + } +} + + #endif /* QEMU_H */ -- 2.55.0
