]> git.proxmox.com Git - qemu.git/commitdiff
target-lm32: Update VMStateDescription to LM32CPU
authorAndreas Färber <afaerber@suse.de>
Sat, 2 Feb 2013 12:45:29 +0000 (13:45 +0100)
committerAndreas Färber <afaerber@suse.de>
Tue, 12 Mar 2013 09:35:55 +0000 (10:35 +0100)
Add a vmstate_lm32_cpu referencing the previous VMStateDescription as a
sub-struct and hook it up to CPUClass::vmsd. Drop cpu_{save,load}().

Acked-by: Michael Walle <michael@walle.cc>
Signed-off-by: Andreas Färber <afaerber@suse.de>
target-lm32/cpu-qom.h
target-lm32/cpu.c
target-lm32/cpu.h
target-lm32/machine.c

index 3ba86b7c88906c3f900565fccbe2c27e20c9634d..957186075bf86079f20f87570716f62d7f07fef6 100644 (file)
@@ -71,6 +71,10 @@ static inline LM32CPU *lm32_env_get_cpu(CPULM32State *env)
 
 #define ENV_OFFSET offsetof(LM32CPU, env)
 
+#ifndef CONFIG_USER_ONLY
+extern const struct VMStateDescription vmstate_lm32_cpu;
+#endif
+
 void lm32_cpu_do_interrupt(CPUState *cpu);
 
 #endif
index a4692b7d5f562978624c87d0241119f89a1f689a..bbb7fbf7680c50360724291dc419a07703ffa634 100644 (file)
@@ -85,6 +85,7 @@ static void lm32_cpu_class_init(ObjectClass *oc, void *data)
     cc->reset = lm32_cpu_reset;
 
     cc->do_interrupt = lm32_cpu_do_interrupt;
+    cpu_class_set_vmsd(cc, &vmstate_lm32_cpu);
 }
 
 static const TypeInfo lm32_cpu_type_info = {
index 1be9778400c604ca0822c485f031d77d0f13bbed..fd50b534fc006223585cbddb77c397f060013e89 100644 (file)
@@ -211,8 +211,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
index 6802e818f81653cbc64443a0533a183d2e2c3d40..9e0919c2545ee2f0c92a5af71f55451c78fad9c2 100644 (file)
@@ -1,9 +1,9 @@
 #include "hw/hw.h"
 #include "hw/boards.h"
 
-static const VMStateDescription vmstate_cpu = {
-    .name = "cpu",
-    .version_id = CPU_SAVE_VERSION,
+static const VMStateDescription vmstate_env = {
+    .name = "env",
+    .version_id = 1,
     .minimum_version_id = 1,
     .minimum_version_id_old = 1,
     .fields      = (VMStateField[]) {
@@ -22,12 +22,13 @@ static const VMStateDescription vmstate_cpu = {
     }
 };
 
-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);
-}
+const VMStateDescription vmstate_lm32_cpu = {
+    .name = "cpu",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField[]) {
+        VMSTATE_STRUCT(env, LM32CPU, 1, vmstate_env, CPULM32State),
+        VMSTATE_END_OF_LIST()
+    }
+};