diff options
Diffstat (limited to 'target-m68k/cpu.c')
-rw-r--r-- | target-m68k/cpu.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/target-m68k/cpu.c b/target-m68k/cpu.c index 5c7803181d..c71f715174 100644 --- a/target-m68k/cpu.c +++ b/target-m68k/cpu.c @@ -20,6 +20,7 @@ #include "cpu.h" #include "qemu-common.h" +#include "migration/vmstate.h" static void m68k_set_feature(CPUM68KState *env, int feature) @@ -58,12 +59,15 @@ static void m68k_cpu_reset(CPUState *s) static ObjectClass *m68k_cpu_class_by_name(const char *cpu_model) { ObjectClass *oc; + char *typename; if (cpu_model == NULL) { return NULL; } - oc = object_class_by_name(cpu_model); + typename = g_strdup_printf("%s-" TYPE_M68K_CPU, cpu_model); + oc = object_class_by_name(typename); + g_free(typename); if (oc != NULL && (object_class_dynamic_cast(oc, TYPE_M68K_CPU) == NULL || object_class_is_abstract(oc))) { return NULL; @@ -143,26 +147,34 @@ static void m68k_cpu_initfn(Object *obj) cpu_exec_init(env); } +static const VMStateDescription vmstate_m68k_cpu = { + .name = "cpu", + .unmigratable = 1, +}; + static void m68k_cpu_class_init(ObjectClass *c, void *data) { M68kCPUClass *mcc = M68K_CPU_CLASS(c); CPUClass *cc = CPU_CLASS(c); + DeviceClass *dc = DEVICE_CLASS(c); mcc->parent_reset = cc->reset; cc->reset = m68k_cpu_reset; cc->class_by_name = m68k_cpu_class_by_name; + dc->vmsd = &vmstate_m68k_cpu; } static void register_cpu_type(const M68kCPUInfo *info) { TypeInfo type_info = { - .name = info->name, .parent = TYPE_M68K_CPU, .instance_init = info->instance_init, }; + type_info.name = g_strdup_printf("%s-" TYPE_M68K_CPU, info->name); type_register(&type_info); + g_free((void *)type_info.name); } static const TypeInfo m68k_cpu_type_info = { |