Ensures that a QOM-created ARMCPU is usable.
Signed-off-by: Andreas Färber <afaerber@suse.de>
static void arm_cpu_initfn(Object *obj)
{
ARMCPU *cpu = ARM_CPU(obj);
+ static bool inited;
cpu_exec_init(&cpu->env);
cpu->cp_regs = g_hash_table_new_full(g_int_hash, g_int_equal,
g_free, g_free);
+
+ if (tcg_enabled() && !inited) {
+ inited = true;
+ arm_translate_init();
+ }
}
static void arm_cpu_finalizefn(Object *obj)
ARMCPU *cpu;
CPUARMState *env;
ObjectClass *oc;
- static int inited = 0;
oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model);
if (!oc) {
/* TODO this should be set centrally, once possible */
object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
- if (tcg_enabled() && !inited) {
- inited = 1;
- arm_translate_init();
- }
-
return cpu;
}