Skip to contentSkip to conversation

exec: save exception_index field

PATCH In review Pavel Dovgaluk 2 participants 4 messages Jul 31, 2014 – Aug 25, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 exec: save exception_index field

This patch adds 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.

---
 exec.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
exec.c +35 -0
index 765bd94..7581c06 100644
@@ -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 */
+        }
     }
 };
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Am 31.07.2014 07:41, schrieb Pavel Dovgaluk:

Quoted 9 lines

This patch adds 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.

---
 exec.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

Doh, this resolves my request from the big series,

I'll wait for more review before I take it, please keep me CC'ed.

Thanks,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#2 lore raw
Quoted 12 lines

From: Andreas Färber [mailto:[email protected]]
Am 31.07.2014 07:41, schrieb Pavel Dovgaluk:

Quoted 9 lines

This patch adds 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.

---
 exec.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
Quoted 5 lines

Doh, this resolves my request from the big series,

I'll wait for more review before I take it, please keep me CC'ed.

No more reviews yet.
Will this patch be applied?

Pavel Dovgalyuk

#3 lore raw

Am 25.08.2014 13:09, schrieb Pavel Dovgaluk:

Quoted 12 lines
Quoted 12 lines

From: Andreas Färber [mailto:[email protected]]
Am 31.07.2014 07:41, schrieb Pavel Dovgaluk:

Quoted 9 lines

This patch adds 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.

---
 exec.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
Quoted 8 lines
Quoted 5 lines

Doh, this resolves my request from the big series,

I'll wait for more review before I take it, please keep me CC'ed.

No more reviews yet.
Will this patch be applied?

Thanks for the reminder, applied to qom-cpu now:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg