summary refs log tree commit diff stats
path: root/target-sparc/machine.c
diff options
context:
space:
mode:
Diffstat (limited to 'target-sparc/machine.c')
-rw-r--r--target-sparc/machine.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/target-sparc/machine.c b/target-sparc/machine.c
index 0e7a23e9f8..aaac30b1e8 100644
--- a/target-sparc/machine.c
+++ b/target-sparc/machine.c
@@ -31,7 +31,8 @@ void cpu_save(QEMUFile *f, void *opaque)
 
     for(i = 0; i < 8; i++)
         qemu_put_betls(f, &env->gregs[i]);
-    for(i = 0; i < NWINDOWS * 16; i++)
+    qemu_put_be32s(f, &env->nwindows);
+    for(i = 0; i < env->nwindows * 16; i++)
         qemu_put_betls(f, &env->regbase[i]);
 
     /* FPU */
@@ -65,9 +66,12 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
     int i;
     uint32_t tmp;
 
+    if (version_id != 4)
+        return -EINVAL;
     for(i = 0; i < 8; i++)
         qemu_get_betls(f, &env->gregs[i]);
-    for(i = 0; i < NWINDOWS * 16; i++)
+    qemu_get_be32s(f, &env->nwindows);
+    for(i = 0; i < env->nwindows * 16; i++)
         qemu_get_betls(f, &env->regbase[i]);
 
     /* FPU */