summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Dovgaluk <Pavel.Dovgaluk@ispras.ru>2014-07-31 09:41:17 +0400
committerMichael Roth <mdroth@linux.vnet.ibm.com>2014-09-10 09:30:58 -0500
commit5dd076a9f85139264b309aab023f6ce44af50af5 (patch)
tree1d32801c55b491e762a0f46888cc7def5ca949c5
parent257e9cfce21e8f2f0db99992cfc2452fb83debe8 (diff)
downloadqemu-5dd076a9f85139264b309aab023f6ce44af50af5.tar.gz
exec: Save CPUState::exception_index field
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> Cc: qemu-stable@nongnu.org Signed-off-by: Andreas Färber <afaerber@suse.de> (cherry picked from commit 6c3bff0ed8a40921464b9a07aa0fe079e860c978) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r--exec.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/exec.c b/exec.c
index 765bd942eb..307bc2484d 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 */
+ }
}
};