From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Andreas Färber" <afaerber@suse.de>,
"Pavel Dovgalyuk" <pavel.dovgaluk@ispras.ru>
Subject: [Qemu-devel] [PULL v2 1/3] exec: Save CPUState::exception_index field
Date: Thu, 4 Sep 2014 19:20:11 +0200 [thread overview]
Message-ID: <1409851213-14330-2-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1409851213-14330-1-git-send-email-afaerber@suse.de>
From: Pavel Dovgaluk <Pavel.Dovgaluk@ispras.ru>
This patch adds a subsection with exception_index field to the VMState for
correct saving the CPU state.
Without this patch, simulator could miss the pending exception in the saved
virtual machine state.
Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
exec.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/exec.c b/exec.c
index 5122a33..7dddcc8 100644
--- a/exec.c
+++ b/exec.c
@@ -430,15 +430,50 @@ static int cpu_common_post_load(void *opaque, int version_id)
return 0;
}
+static int cpu_common_pre_load(void *opaque)
+{
+ CPUState *cpu = opaque;
+
+ cpu->exception_index = 0;
+
+ return 0;
+}
+
+static bool cpu_common_exception_index_needed(void *opaque)
+{
+ CPUState *cpu = opaque;
+
+ return cpu->exception_index != 0;
+}
+
+static const VMStateDescription vmstate_cpu_common_exception_index = {
+ .name = "cpu_common/exception_index",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_INT32(exception_index, CPUState),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
const VMStateDescription vmstate_cpu_common = {
.name = "cpu_common",
.version_id = 1,
.minimum_version_id = 1,
+ .pre_load = cpu_common_pre_load,
.post_load = cpu_common_post_load,
.fields = (VMStateField[]) {
VMSTATE_UINT32(halted, CPUState),
VMSTATE_UINT32(interrupt_request, CPUState),
VMSTATE_END_OF_LIST()
+ },
+ .subsections = (VMStateSubsection[]) {
+ {
+ .vmsd = &vmstate_cpu_common_exception_index,
+ .needed = cpu_common_exception_index_needed,
+ } , {
+ /* empty */
+ }
}
};
--
1.8.4.5
next prev parent reply other threads:[~2014-09-04 17:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-04 17:20 [Qemu-devel] [PULL 0/3] QOM CPUState patch queue 2014-09-04 Andreas Färber
2014-09-04 17:20 ` Andreas Färber [this message]
2014-09-04 22:50 ` [Qemu-devel] [PULL v2 1/3] exec: Save CPUState::exception_index field Peter Maydell
2014-09-05 12:16 ` Andreas Färber
2014-09-04 17:20 ` [Qemu-devel] [PULL v2 2/3] target-i386: Support migratable=no properly Andreas Färber
2014-09-04 17:20 ` [Qemu-devel] [PULL v2 3/3] target-i386: Reject invalid CPU feature names on the command-line Andreas Färber
2014-09-04 18:17 ` Eduardo Habkost
2014-09-04 18:40 ` [Qemu-devel] [PULL 0/3] QOM CPUState patch queue 2014-09-04 Peter Maydell
2014-09-05 14:45 ` 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=1409851213-14330-2-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=pavel.dovgaluk@ispras.ru \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).