diff mbox

[02/12] target-mips: update cpu_save/cpu_load to support KScratch registers

Message ID 1403189143-54609-3-git-send-email-leon.alrae@imgtec.com
State New
Headers show

Commit Message

Leon Alrae June 19, 2014, 2:45 p.m. UTC
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
---
 target-mips/machine.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

Comments

Richard Henderson June 19, 2014, 5:43 p.m. UTC | #1
You must update CPU_SAVE_VERSION when you change the contents of the save data.

For extra credit, consider updating target-mips to VMStateDescription structure(s).


r~
Leon Alrae July 8, 2014, 8:31 a.m. UTC | #2
On 19/06/2014 18:43, Richard Henderson wrote:
> You must update CPU_SAVE_VERSION when you change the contents of the save data.
> 
> For extra credit, consider updating target-mips to VMStateDescription structure(s).
> 
> 
> r~
> 

v2 contains updated CPU_SAVE_VERSION.

VMStateDescription structures sound like nice to have in target-mips -
at the moment I'm not able to look at this, but I'll keep that in mind.

Thanks,
Leon
diff mbox

Patch

diff --git a/target-mips/machine.c b/target-mips/machine.c
index 0496faa..966c5ef 100644
--- a/target-mips/machine.c
+++ b/target-mips/machine.c
@@ -144,6 +144,9 @@  void cpu_save(QEMUFile *f, void *opaque)
     qemu_put_sbe32s(f, &env->CP0_DataHi);
     qemu_put_betls(f, &env->CP0_ErrorEPC);
     qemu_put_sbe32s(f, &env->CP0_DESAVE);
+    for (i = 0; i < MIPS_KSCRATCH_NUM; i++) {
+        qemu_put_betls(f, &env->CP0_KScratch[i]);
+    }
 
     /* Save inactive TC state */
     for (i = 0; i < MIPS_SHADOW_SET_MAX; i++)
@@ -301,6 +304,11 @@  int cpu_load(QEMUFile *f, void *opaque, int version_id)
     qemu_get_sbe32s(f, &env->CP0_DataHi);
     qemu_get_betls(f, &env->CP0_ErrorEPC);
     qemu_get_sbe32s(f, &env->CP0_DESAVE);
+    if (version_id >= 4) {
+        for (i = 0; i < MIPS_KSCRATCH_NUM; i++) {
+            qemu_get_betls(f, &env->CP0_KScratch[i]);
+        }
+    }
 
     /* Load inactive TC state */
     for (i = 0; i < MIPS_SHADOW_SET_MAX; i++) {