qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH qom-cpu v3 3/6] cpu: Introduce VMSTATE_CPU() macro f


From: Andreas Färber
Subject: [Qemu-devel] [PATCH qom-cpu v3 3/6] cpu: Introduce VMSTATE_CPU() macro for CPUState
Date: Tue, 18 Jun 2013 02:29:42 +0200

To be used to embed common CPU state into CPU subclasses.

Signed-off-by: Andreas Färber <address@hidden>
---
 exec.c            |  5 ++---
 include/qom/cpu.h | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/exec.c b/exec.c
index 5b8b40d..0bee004 100644
--- a/exec.c
+++ b/exec.c
@@ -246,7 +246,7 @@ static int cpu_common_post_load(void *opaque, int 
version_id)
     return 0;
 }
 
-static const VMStateDescription vmstate_cpu_common = {
+const VMStateDescription vmstate_cpu_common = {
     .name = "cpu_common",
     .version_id = 1,
     .minimum_version_id = 1,
@@ -258,8 +258,7 @@ static const VMStateDescription vmstate_cpu_common = {
         VMSTATE_END_OF_LIST()
     }
 };
-#else
-#define vmstate_cpu_common vmstate_dummy
+
 #endif
 
 CPUState *qemu_get_cpu(int index)
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 397219b..3e8cc47 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -378,4 +378,18 @@ void cpu_reset_interrupt(CPUState *cpu, int mask);
  */
 void cpu_resume(CPUState *cpu);
 
+#ifdef CONFIG_SOFTMMU
+extern const struct VMStateDescription vmstate_cpu_common;
+#else
+#define vmstate_cpu_common vmstate_dummy
+#endif
+
+#define VMSTATE_CPU() {                                                     \
+    .name = "parent_obj",                                                   \
+    .size = sizeof(CPUState),                                               \
+    .vmsd = &vmstate_cpu_common,                                            \
+    .flags = VMS_STRUCT,                                                    \
+    .offset = 0,                                                            \
+}
+
 #endif
-- 
1.8.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]