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
This commit is contained in:
Eduardo Habkost 2018-02-24 03:23:04 -05:00 committed by Lioncash
parent fee2c27f2b
commit 9c04a28bd2
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -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)