@@ -10,6 +10,22 @@
#define ACCEL_TCG_INTERNAL_H
#include "exec/exec-all.h"
+#include "qemu/accel.h"
+
+struct TCGState {
+ AccelState parent_obj;
+
+ bool mttcg_enabled;
+ bool one_insn_per_tb;
+ int splitwx_enabled;
+ unsigned long tb_size;
+};
+typedef struct TCGState TCGState;
+
+#define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg")
+
+DECLARE_INSTANCE_CHECKER(TCGState, TCG_STATE,
+ TYPE_TCG_ACCEL)
/*
* Access to the various translations structures need to be serialised
@@ -162,9 +162,6 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t start, size_t length);
int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
void *ptr, size_t len, bool is_write);
-/* vl.c */
-extern int singlestep;
-
void list_cpus(const char *optarg);
#endif /* CPU_COMMON_H */
@@ -149,17 +149,18 @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu)
uint32_t curr_cflags(CPUState *cpu)
{
uint32_t cflags = cpu->tcg_cflags;
+ TCGState *tcgstate = TCG_STATE(current_accel());
/*
* Record gdb single-step. We should be exiting the TB by raising
* EXCP_DEBUG, but to simplify other tests, disable chaining too.
*
- * For singlestep and -d nochain, suppress goto_tb so that
+ * For one-insn-per-tb and -d nochain, suppress goto_tb so that
* we can log -d cpu,exec after every TB.
*/
if (unlikely(cpu->singlestep_enabled)) {
cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | CF_SINGLE_STEP | 1;
- } else if (singlestep) {
+ } else if (tcgstate->one_insn_per_tb) {
cflags |= CF_NO_GOTO_TB | 1;
} else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
cflags |= CF_NO_GOTO_TB;
@@ -38,21 +38,6 @@
#endif
#include "internal.h"
-struct TCGState {
- AccelState parent_obj;
-
- bool mttcg_enabled;
- bool one_insn_per_tb;
- int splitwx_enabled;
- unsigned long tb_size;
-};
-typedef struct TCGState TCGState;
-
-#define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg")
-
-DECLARE_INSTANCE_CHECKER(TCGState, TCG_STATE,
- TYPE_TCG_ACCEL)
-
/*
* We default to false if we know other options have been enabled
* which are currently incompatible with MTTCG. Otherwise when each
@@ -219,8 +204,6 @@ static void tcg_set_one_insn_per_tb(Object *obj, bool value, Error **errp)
{
TCGState *s = TCG_STATE(obj);
s->one_insn_per_tb = value;
- /* For the moment, set the global also: this changes the behaviour */
- singlestep = value;
}
static int tcg_gdbstub_supported_sstep_flags(void)
@@ -49,7 +49,6 @@
#include "host-os.h"
#include "target_arch_cpu.h"
-int singlestep;
static bool opt_one_insn_per_tb;
uintptr_t guest_base;
bool have_guest_base;
@@ -68,7 +68,6 @@
char *exec_path;
char real_exec_path[PATH_MAX];
-int singlestep;
static bool opt_one_insn_per_tb;
static const char *argv0;
static const char *gdbstub;
@@ -43,7 +43,6 @@ int vga_interface_type = VGA_NONE;
bool vga_interface_created;
Chardev *parallel_hds[MAX_PARALLEL_PORTS];
int win2k_install_hack;
-int singlestep;
int fd_bootchk = 1;
int graphic_rotate;
QEMUOptionRom option_rom[MAX_OPTION_ROMS];
Change curr_cflags() to look at the one-insn-per-tb accelerator property instead of the old singlestep global variable. Since this is the final remaining use of the global, we can delete it entirely. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- This is the "clean" way of doing it. I dunno how much of a hot path curr_cflags is; if it's really critical we could have a global that's private to accel/tcg/internals.h I guess. --- accel/tcg/internal.h | 16 ++++++++++++++++ include/exec/cpu-common.h | 3 --- accel/tcg/cpu-exec.c | 5 +++-- accel/tcg/tcg-all.c | 17 ----------------- bsd-user/main.c | 1 - linux-user/main.c | 1 - softmmu/globals.c | 1 - 7 files changed, 19 insertions(+), 25 deletions(-)