Since commit e67db06e9f6d7e514ee2a9b9b769ecd42977f6fb (target-or32: Add target stubs and QOM cpu) a VMStateDescription existed, but CPU_SAVE_VERSION was not set, so it was never registered.
Register it through CPUState. Use a version_id of 1 and specify minimum versions as well. Cc: Jia Liu <pro...@gmail.com> Signed-off-by: Andreas Färber <afaer...@suse.de> --- target-openrisc/cpu.c | 3 +++ target-openrisc/cpu.h | 2 ++ target-openrisc/machine.c | 33 +++++++++++++-------------------- 3 Dateien geändert, 18 Zeilen hinzugefügt(+), 20 Zeilen entfernt(-) diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c index d8cc533..d0873e8 100644 --- a/target-openrisc/cpu.c +++ b/target-openrisc/cpu.c @@ -146,6 +146,9 @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data) cc->reset = openrisc_cpu_reset; cc->class_by_name = openrisc_cpu_class_by_name; +#ifndef CONFIG_USER_ONLY + cc->vmsd = &vmstate_openrisc_cpu; +#endif } static void cpu_register(const OpenRISCCPUInfo *info) diff --git a/target-openrisc/cpu.h b/target-openrisc/cpu.h index 419f007..1d350d2 100644 --- a/target-openrisc/cpu.h +++ b/target-openrisc/cpu.h @@ -358,6 +358,8 @@ int cpu_openrisc_signal_handler(int host_signum, void *pinfo, void *puc); #define cpu_signal_handler cpu_openrisc_signal_handler #ifndef CONFIG_USER_ONLY +extern const struct VMStateDescription vmstate_openrisc_cpu; + /* hw/openrisc_pic.c */ void cpu_openrisc_pic_init(OpenRISCCPU *cpu); diff --git a/target-openrisc/machine.c b/target-openrisc/machine.c index cba9811..7d335e0 100644 --- a/target-openrisc/machine.c +++ b/target-openrisc/machine.c @@ -20,28 +20,21 @@ #include "hw/hw.h" #include "hw/boards.h" -static const VMStateDescription vmstate_cpu = { +const VMStateDescription vmstate_openrisc_cpu = { .name = "cpu", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, .fields = (VMStateField[]) { - VMSTATE_UINT32_ARRAY(gpr, CPUOpenRISCState, 32), - VMSTATE_UINT32(sr, CPUOpenRISCState), - VMSTATE_UINT32(epcr, CPUOpenRISCState), - VMSTATE_UINT32(eear, CPUOpenRISCState), - VMSTATE_UINT32(esr, CPUOpenRISCState), - VMSTATE_UINT32(fpcsr, CPUOpenRISCState), - VMSTATE_UINT32(pc, CPUOpenRISCState), - VMSTATE_UINT32(npc, CPUOpenRISCState), - VMSTATE_UINT32(ppc, CPUOpenRISCState), + VMSTATE_UINT32_ARRAY(env.gpr, OpenRISCCPU, 32), + VMSTATE_UINT32(env.sr, OpenRISCCPU), + VMSTATE_UINT32(env.epcr, OpenRISCCPU), + VMSTATE_UINT32(env.eear, OpenRISCCPU), + VMSTATE_UINT32(env.esr, OpenRISCCPU), + VMSTATE_UINT32(env.fpcsr, OpenRISCCPU), + VMSTATE_UINT32(env.pc, OpenRISCCPU), + VMSTATE_UINT32(env.npc, OpenRISCCPU), + VMSTATE_UINT32(env.ppc, OpenRISCCPU), VMSTATE_END_OF_LIST() } }; - -void cpu_save(QEMUFile *f, void *opaque) -{ - vmstate_save_state(f, &vmstate_cpu, opaque); -} - -int cpu_load(QEMUFile *f, void *opaque, int version_id) -{ - return vmstate_load_state(f, &vmstate_cpu, opaque, version_id); -} -- 1.7.10.4