qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Jia Liu" <proljc@gmail.com>, "Andreas Färber" <afaerber@suse.de>,
	quintela@redhat.com
Subject: [Qemu-devel] [RFC qom-cpu-next 5/6] target-openrisc: Register VMStateDescription for OpenRISCCPU
Date: Sat,  2 Feb 2013 16:04:15 +0100	[thread overview]
Message-ID: <1359817456-25561-6-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1359817456-25561-1-git-send-email-afaerber@suse.de>

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 <proljc@gmail.com>
Signed-off-by: Andreas Färber <afaerber@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

  parent reply	other threads:[~2013-02-02 15:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-02 15:04 [Qemu-devel] [PATCH RFC qom-cpu-next 0/6] QOM CPUState VMStateDescriptions Andreas Färber
2013-02-02 15:04 ` [Qemu-devel] [PATCH RFC qom-cpu-next 1/6] cpu: Register VMStateDescription through CPUState Andreas Färber
2013-02-02 15:04 ` [Qemu-devel] [PATCH RFC qom-cpu-next 2/6] target-i386: Update VMStateDescription to X86CPU Andreas Färber
2013-02-02 15:04 ` [Qemu-devel] [PATCH RFC qom-cpu-next 3/6] target-lm32: Update VMStateDescription to LM32CPU Andreas Färber
2013-02-02 15:04 ` [Qemu-devel] [RFC qom-cpu-next 4/6] target-alpha: Register VMStateDescription for AlphaCPU Andreas Färber
2013-02-02 15:04 ` Andreas Färber [this message]
2013-02-02 15:04 ` [Qemu-devel] [RFC qom-cpu-next 6/6] cpu: Guard cpu_{save, load}() definitions Andreas Färber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359817456-25561-6-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=proljc@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).