From 9c04a28bd22c37a81fd50fbb88a85fe1bdc2d998 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Sat, 24 Feb 2018 03:23:04 -0500 Subject: [PATCH] target-i386: Move TCG initialization to realize time QOM instance_init functions are not supposed to have any side-effects, as new objects may be created at any moment for querying property information (see qmp_device_list_properties()). Move TCG initialization to realize time so it won't be called when just doing object_new() on a X86CPU subclass. Backports commit 57f2453ab48a771b30aeced01b329ee85853bb7b from qemu --- qemu/target-i386/cpu.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/qemu/target-i386/cpu.c b/qemu/target-i386/cpu.c index 312e1b0e..0fd58048 100644 --- a/qemu/target-i386/cpu.c +++ b/qemu/target-i386/cpu.c @@ -2785,6 +2785,10 @@ static int x86_cpu_realizefn(struct uc_struct *uc, DeviceState *dev, Error **err goto out; } + if (tcg_enabled(env->uc)) { + tcg_x86_init(env->uc); + } + #ifndef CONFIG_USER_ONLY //qemu_register_reset(x86_cpu_machine_reset_cb, cpu); @@ -2874,11 +2878,6 @@ static void x86_cpu_initfn(struct uc_struct *uc, Object *obj, void *opaque) cpu->apic_id = -1; x86_cpu_load_def(cpu, xcc->cpu_def, &error_abort); - - /* init various static tables used in TCG mode */ - if (tcg_enabled(env->uc)) { - tcg_x86_init(env->uc); - } } static int64_t x86_cpu_get_arch_id(CPUState *cs)