mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
make one-insn-per-tb an accel option
This commit adds 'one-insn-per-tb' as a property on the TCG accelerator object, so you can enable it with -accel tcg,one-insn-per-tb=on It has the same behaviour as the existing '-singlestep' command line option. We use a different name because 'singlestep' has always been a confusing choice, because it doesn't have anything to do with single-stepping the CPU. What it does do is force TCG emulation to put one guest instruction in each TB, which can be useful in some situations (such as analysing debug logs). The existing '-singlestep' commandline options are decoupled from the global 'singlestep' variable and instead now are syntactic sugar for setting the accel property. (These can then go away after a deprecation period.) The global variable remains for the moment as: * what the TCG code looks at to change its behaviour * what HMP and QMP use to query and set the behaviour In the following commits we'll clean those up to not directly look at the global variable. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20230417164041.684562-2-peter.maydell@linaro.org
This commit is contained in:
parent
f802ff1e28
commit
3cfb0456c3
5 changed files with 55 additions and 6 deletions
17
softmmu/vl.c
17
softmmu/vl.c
|
@ -182,6 +182,7 @@ static const char *log_file;
|
|||
static bool list_data_dirs;
|
||||
static const char *qtest_chrdev;
|
||||
static const char *qtest_log;
|
||||
static bool opt_one_insn_per_tb;
|
||||
|
||||
static int has_defaults = 1;
|
||||
static int default_serial = 1;
|
||||
|
@ -2220,7 +2221,19 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
|
|||
qemu_opt_foreach(opts, accelerator_set_property,
|
||||
accel,
|
||||
&error_fatal);
|
||||
|
||||
/*
|
||||
* If legacy -singlestep option is set, honour it for TCG and
|
||||
* silently ignore for any other accelerator (which is how this
|
||||
* option has always behaved).
|
||||
*/
|
||||
if (opt_one_insn_per_tb) {
|
||||
/*
|
||||
* This will always succeed for TCG, and we want to ignore
|
||||
* the error from trying to set a nonexistent property
|
||||
* on any other accelerator.
|
||||
*/
|
||||
object_property_set_bool(OBJECT(accel), "one-insn-per-tb", true, NULL);
|
||||
}
|
||||
ret = accel_init_machine(accel, current_machine);
|
||||
if (ret < 0) {
|
||||
if (!qtest_with_kvm || ret != -ENOENT) {
|
||||
|
@ -2955,7 +2968,7 @@ void qemu_init(int argc, char **argv)
|
|||
qdict_put_str(machine_opts_dict, "firmware", optarg);
|
||||
break;
|
||||
case QEMU_OPTION_singlestep:
|
||||
singlestep = 1;
|
||||
opt_one_insn_per_tb = true;
|
||||
break;
|
||||
case QEMU_OPTION_S:
|
||||
autostart = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue