On 17/4/23 18:40, Peter Maydell wrote:
The only place left that looks at the old 'singlestep' global variable is the TCG curr_cflags() function. Replace the old global with a new 'one_insn_per_tb' which is defined in tcg-all.c and declared in accel/tcg/internal.h. This keeps it restricted to the TCG code, unlike 'singlestep' which was available to every file in the system and defined in multiple different places for softmmu vs linux-user vs bsd-user. While we're making this change, use qatomic_read() and qatomic_set() on the accesses to the new global, because TCG will read it without holding a lock. Signed-off-by: Peter Maydell <peter.maydell@xxxxxxxxxx> --- In discussion on v2, we talked about combining this with the 'nochain' flag so as to have a single 'tcg_cflags_global' that held the flags for the current (one_insn_per_tb, nochain) state. I have not attempted that here, because it's a little tricky: * util/log.c is built into some binaries that don't have an accelerator at all (the tools), so it can't simply call current_accel() to get the TCG accelerator * the initial value of the logging flags is set before the TCG accelerator is even created So I leave that to somebody else to have a go at if they like. --- accel/tcg/internal.h | 2 ++ include/exec/cpu-common.h | 2 -- accel/tcg/cpu-exec.c | 2 +- accel/tcg/tcg-all.c | 6 ++++-- bsd-user/main.c | 1 - linux-user/main.c | 1 - softmmu/globals.c | 1 - 7 files changed, 7 insertions(+), 8 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>