@@ -69,5 +69,11 @@ static inline LM32CPU *lm32_env_get_cpu(CPULM32State *env)
#define ENV_GET_CPU(e) CPU(lm32_env_get_cpu(e))
+#ifdef CONFIG_USER_ONLY
+#define vmstate_lm32_cpu vmstate_dummy
+#else
+extern const struct VMStateDescription vmstate_lm32_cpu;
+#endif
+
#endif
@@ -83,6 +83,8 @@ static void lm32_cpu_class_init(ObjectClass *oc, void *data)
lcc->parent_reset = cc->reset;
cc->reset = lm32_cpu_reset;
+
+ cc->vmsd = &vmstate_lm32_cpu;
}
static const TypeInfo lm32_cpu_type_info = {
@@ -212,8 +212,6 @@ static inline CPULM32State *cpu_init(const char *cpu_model)
#define cpu_gen_code cpu_lm32_gen_code
#define cpu_signal_handler cpu_lm32_signal_handler
-#define CPU_SAVE_VERSION 1
-
int cpu_lm32_handle_mmu_fault(CPULM32State *env, target_ulong address, int rw,
int mmu_idx);
#define cpu_handle_mmu_fault cpu_lm32_handle_mmu_fault
@@ -1,33 +1,23 @@
#include "hw/hw.h"
#include "hw/boards.h"
-static const VMStateDescription vmstate_cpu = {
+const VMStateDescription vmstate_lm32_cpu = {
.name = "cpu",
- .version_id = CPU_SAVE_VERSION,
+ .version_id = 1,
.minimum_version_id = 1,
.minimum_version_id_old = 1,
.fields = (VMStateField[]) {
- VMSTATE_UINT32_ARRAY(regs, CPULM32State, 32),
- VMSTATE_UINT32(pc, CPULM32State),
- VMSTATE_UINT32(ie, CPULM32State),
- VMSTATE_UINT32(icc, CPULM32State),
- VMSTATE_UINT32(dcc, CPULM32State),
- VMSTATE_UINT32(cc, CPULM32State),
- VMSTATE_UINT32(eba, CPULM32State),
- VMSTATE_UINT32(dc, CPULM32State),
- VMSTATE_UINT32(deba, CPULM32State),
- VMSTATE_UINT32_ARRAY(bp, CPULM32State, 4),
- VMSTATE_UINT32_ARRAY(wp, CPULM32State, 4),
+ VMSTATE_UINT32_ARRAY(env.regs, LM32CPU, 32),
+ VMSTATE_UINT32(env.pc, LM32CPU),
+ VMSTATE_UINT32(env.ie, LM32CPU),
+ VMSTATE_UINT32(env.icc, LM32CPU),
+ VMSTATE_UINT32(env.dcc, LM32CPU),
+ VMSTATE_UINT32(env.cc, LM32CPU),
+ VMSTATE_UINT32(env.eba, LM32CPU),
+ VMSTATE_UINT32(env.dc, LM32CPU),
+ VMSTATE_UINT32(env.deba, LM32CPU),
+ VMSTATE_UINT32_ARRAY(env.bp, LM32CPU, 4),
+ VMSTATE_UINT32_ARRAY(env.wp, LM32CPU, 4),
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);
-}
Expose vmstate_cpu as vmstate_lm32_cpu and hook it up to CPUClass::vmsd. Adapt VMState fields to LM32CPU. Drop cpu_{save,load}(). Signed-off-by: Andreas Färber <afaerber@suse.de> --- target-lm32/cpu-qom.h | 6 ++++++ target-lm32/cpu.c | 2 ++ target-lm32/cpu.h | 2 -- target-lm32/machine.c | 36 +++++++++++++----------------------- 4 Dateien geändert, 21 Zeilen hinzugefügt(+), 25 Zeilen entfernt(-)