From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Michael Walle" <michael@walle.cc>,
"Andreas Färber" <afaerber@suse.de>,
quintela@redhat.com
Subject: [Qemu-devel] [PATCH RFC qom-cpu-next 3/6] target-lm32: Update VMStateDescription to LM32CPU
Date: Sat, 2 Feb 2013 16:04:13 +0100 [thread overview]
Message-ID: <1359817456-25561-4-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1359817456-25561-1-git-send-email-afaerber@suse.de>
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 | 2 ++
target-lm32/cpu.c | 4 ++++
target-lm32/cpu.h | 2 --
target-lm32/machine.c | 36 +++++++++++++-----------------------
4 Dateien geändert, 19 Zeilen hinzugefügt(+), 25 Zeilen entfernt(-)
diff --git a/target-lm32/cpu-qom.h b/target-lm32/cpu-qom.h
index d7525b3..9dd9d66 100644
--- a/target-lm32/cpu-qom.h
+++ b/target-lm32/cpu-qom.h
@@ -69,5 +69,7 @@ static inline LM32CPU *lm32_env_get_cpu(CPULM32State *env)
#define ENV_GET_CPU(e) CPU(lm32_env_get_cpu(e))
+extern const struct VMStateDescription vmstate_lm32_cpu;
+
#endif
diff --git a/target-lm32/cpu.c b/target-lm32/cpu.c
index 5f16734..89c365b 100644
--- a/target-lm32/cpu.c
+++ b/target-lm32/cpu.c
@@ -81,6 +81,10 @@ static void lm32_cpu_class_init(ObjectClass *oc, void *data)
lcc->parent_reset = cc->reset;
cc->reset = lm32_cpu_reset;
+
+#ifndef CONFIG_USER_ONLY
+ cc->vmsd = &vmstate_lm32_cpu;
+#endif
}
static const TypeInfo lm32_cpu_type_info = {
diff --git a/target-lm32/cpu.h b/target-lm32/cpu.h
index 4e202db..65fc366 100644
--- a/target-lm32/cpu.h
+++ b/target-lm32/cpu.h
@@ -213,8 +213,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
diff --git a/target-lm32/machine.c b/target-lm32/machine.c
index 6802e81..aa4a9e1 100644
--- a/target-lm32/machine.c
+++ b/target-lm32/machine.c
@@ -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);
-}
--
1.7.10.4
next prev 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 ` Andreas Färber [this message]
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 ` [Qemu-devel] [RFC qom-cpu-next 5/6] target-openrisc: Register VMStateDescription for OpenRISCCPU Andreas Färber
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-4-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=michael@walle.cc \
--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).