提交 da697214 编写于 作者: A Andreas Färber

target-openrisc: Register VMStateDescription for OpenRISCCPU

Since commit e67db06e (target-or32: Add
target stubs and QOM cpu) a VMStateDescription existed, but
CPU_SAVE_VERSION was not set, so it was never registered.

Drop cpu_{save,load}() and register VMStateDescription via DeviceState.
Use a version_id of 1 and specify minimum versions as well.
Reviewed-by: NJuan Quintela <quintela@redhat.com>
Signed-off-by: NAndreas Färber <afaerber@suse.de>
上级 fe31e737
...@@ -149,6 +149,7 @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data) ...@@ -149,6 +149,7 @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data)
cc->class_by_name = openrisc_cpu_class_by_name; cc->class_by_name = openrisc_cpu_class_by_name;
cc->do_interrupt = openrisc_cpu_do_interrupt; cc->do_interrupt = openrisc_cpu_do_interrupt;
device_class_set_vmsd(dc, &vmstate_openrisc_cpu);
} }
static void cpu_register(const OpenRISCCPUInfo *info) static void cpu_register(const OpenRISCCPUInfo *info)
......
...@@ -360,6 +360,8 @@ int cpu_openrisc_signal_handler(int host_signum, void *pinfo, void *puc); ...@@ -360,6 +360,8 @@ int cpu_openrisc_signal_handler(int host_signum, void *pinfo, void *puc);
#define cpu_signal_handler cpu_openrisc_signal_handler #define cpu_signal_handler cpu_openrisc_signal_handler
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
extern const struct VMStateDescription vmstate_openrisc_cpu;
/* hw/openrisc_pic.c */ /* hw/openrisc_pic.c */
void cpu_openrisc_pic_init(OpenRISCCPU *cpu); void cpu_openrisc_pic_init(OpenRISCCPU *cpu);
......
...@@ -20,8 +20,11 @@ ...@@ -20,8 +20,11 @@
#include "hw/hw.h" #include "hw/hw.h"
#include "hw/boards.h" #include "hw/boards.h"
static const VMStateDescription vmstate_cpu = { static const VMStateDescription vmstate_env = {
.name = "cpu", .name = "env",
.version_id = 1,
.minimum_version_id = 1,
.minimum_version_id_old = 1,
.fields = (VMStateField[]) { .fields = (VMStateField[]) {
VMSTATE_UINT32_ARRAY(gpr, CPUOpenRISCState, 32), VMSTATE_UINT32_ARRAY(gpr, CPUOpenRISCState, 32),
VMSTATE_UINT32(sr, CPUOpenRISCState), VMSTATE_UINT32(sr, CPUOpenRISCState),
...@@ -36,12 +39,14 @@ static const VMStateDescription vmstate_cpu = { ...@@ -36,12 +39,14 @@ static const VMStateDescription vmstate_cpu = {
} }
}; };
void cpu_save(QEMUFile *f, void *opaque) const VMStateDescription vmstate_openrisc_cpu = {
{ .name = "cpu",
vmstate_save_state(f, &vmstate_cpu, opaque); .version_id = 1,
} .minimum_version_id = 1,
.minimum_version_id_old = 1,
int cpu_load(QEMUFile *f, void *opaque, int version_id) .fields = (VMStateField[]) {
{ VMSTATE_CPU(),
return vmstate_load_state(f, &vmstate_cpu, opaque, version_id); VMSTATE_STRUCT(env, OpenRISCCPU, 1, vmstate_env, CPUOpenRISCState),
} VMSTATE_END_OF_LIST()
}
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册