diff mbox

[RFC,v2,16/49] target: save cpu state fields

Message ID 20140717110329.8352.10419.stgit@PASHA-ISP
State New
Headers show

Commit Message

Pavel Dovgalyuk July 17, 2014, 11:03 a.m. UTC
This patch adds interrupt fields to VMState for correct saving the CPU state.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
---
 target-arm/machine.c  |    5 ++++-
 target-i386/machine.c |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

Comments

Andreas Färber July 31, 2014, 6:48 a.m. UTC | #1
Am 17.07.2014 13:03, schrieb Pavel Dovgalyuk:
> This patch adds interrupt fields to VMState for correct saving the CPU state.
> 
> Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
> ---
>  target-arm/machine.c  |    5 ++++-
>  target-i386/machine.c |    5 ++++-
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/target-arm/machine.c b/target-arm/machine.c
> index 3bcc7cc..29bfc10 100644
> --- a/target-arm/machine.c
> +++ b/target-arm/machine.c
> @@ -218,7 +218,7 @@ static int cpu_post_load(void *opaque, int version_id)
>  
>  const VMStateDescription vmstate_arm_cpu = {
>      .name = "cpu",
> -    .version_id = 20,
> +    .version_id = 21,
>      .minimum_version_id = 20,
>      .pre_save = cpu_pre_save,
>      .post_load = cpu_post_load,
> @@ -259,6 +259,9 @@ const VMStateDescription vmstate_arm_cpu = {
>          VMSTATE_UINT64(env.exception.vaddress, ARMCPU),
>          VMSTATE_TIMER(gt_timer[GTIMER_PHYS], ARMCPU),
>          VMSTATE_TIMER(gt_timer[GTIMER_VIRT], ARMCPU),
> +        /* Fields required by replay */
> +        VMSTATE_UINT32_V(parent_obj.interrupt_request, ARMCPU, 21),
> +        VMSTATE_INT32_V(parent_obj.exception_index, ARMCPU, 21),
>          VMSTATE_END_OF_LIST()
>      },
>      .subsections = (VMStateSubsection[]) {
> diff --git a/target-i386/machine.c b/target-i386/machine.c
> index 16d2f6a..9dfac33 100644
> --- a/target-i386/machine.c
> +++ b/target-i386/machine.c
> @@ -605,7 +605,7 @@ static const VMStateDescription vmstate_msr_hyperv_time = {
>  
>  VMStateDescription vmstate_x86_cpu = {
>      .name = "cpu",
> -    .version_id = 12,
> +    .version_id = 13,
>      .minimum_version_id = 3,
>      .pre_save = cpu_pre_save,
>      .post_load = cpu_post_load,
> @@ -702,6 +702,9 @@ VMStateDescription vmstate_x86_cpu = {
>          VMSTATE_UINT64_V(env.xcr0, X86CPU, 12),
>          VMSTATE_UINT64_V(env.xstate_bv, X86CPU, 12),
>          VMSTATE_YMMH_REGS_VARS(env.ymmh_regs, X86CPU, CPU_NB_REGS, 12),
> +        /* Fields required by replay */
> +        VMSTATE_UINT32_V(parent_obj.interrupt_request, X86CPU, 13),
> +        VMSTATE_INT32_V(parent_obj.exception_index, X86CPU, 13),
>          VMSTATE_END_OF_LIST()
>          /* The above list is not sorted /wrt version numbers, watch out! */
>      },

Instead of messing with parent_obj here and above, can you please add
common CPUState stuff to vmstate_cpu_common in exec.c?

Regards,
Andreas
diff mbox

Patch

diff --git a/target-arm/machine.c b/target-arm/machine.c
index 3bcc7cc..29bfc10 100644
--- a/target-arm/machine.c
+++ b/target-arm/machine.c
@@ -218,7 +218,7 @@  static int cpu_post_load(void *opaque, int version_id)
 
 const VMStateDescription vmstate_arm_cpu = {
     .name = "cpu",
-    .version_id = 20,
+    .version_id = 21,
     .minimum_version_id = 20,
     .pre_save = cpu_pre_save,
     .post_load = cpu_post_load,
@@ -259,6 +259,9 @@  const VMStateDescription vmstate_arm_cpu = {
         VMSTATE_UINT64(env.exception.vaddress, ARMCPU),
         VMSTATE_TIMER(gt_timer[GTIMER_PHYS], ARMCPU),
         VMSTATE_TIMER(gt_timer[GTIMER_VIRT], ARMCPU),
+        /* Fields required by replay */
+        VMSTATE_UINT32_V(parent_obj.interrupt_request, ARMCPU, 21),
+        VMSTATE_INT32_V(parent_obj.exception_index, ARMCPU, 21),
         VMSTATE_END_OF_LIST()
     },
     .subsections = (VMStateSubsection[]) {
diff --git a/target-i386/machine.c b/target-i386/machine.c
index 16d2f6a..9dfac33 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -605,7 +605,7 @@  static const VMStateDescription vmstate_msr_hyperv_time = {
 
 VMStateDescription vmstate_x86_cpu = {
     .name = "cpu",
-    .version_id = 12,
+    .version_id = 13,
     .minimum_version_id = 3,
     .pre_save = cpu_pre_save,
     .post_load = cpu_post_load,
@@ -702,6 +702,9 @@  VMStateDescription vmstate_x86_cpu = {
         VMSTATE_UINT64_V(env.xcr0, X86CPU, 12),
         VMSTATE_UINT64_V(env.xstate_bv, X86CPU, 12),
         VMSTATE_YMMH_REGS_VARS(env.ymmh_regs, X86CPU, CPU_NB_REGS, 12),
+        /* Fields required by replay */
+        VMSTATE_UINT32_V(parent_obj.interrupt_request, X86CPU, 13),
+        VMSTATE_INT32_V(parent_obj.exception_index, X86CPU, 13),
         VMSTATE_END_OF_LIST()
         /* The above list is not sorted /wrt version numbers, watch out! */
     },