Commit a7a044f29e288c64aafc8e82ccfeeb9c6aa49017

Authored by blueswir1
1 parent bc0129d9

Handle wrapped registers correctly when saving

Fix typo
Save and load interrupt_index and pil_in
Original patch by Luis Pureza


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4980 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 11 additions and 1 deletions
target-sparc/machine.c
... ... @@ -31,6 +31,10 @@ void cpu_save(QEMUFile *f, void *opaque)
31 31 int i;
32 32 uint32_t tmp;
33 33  
  34 + // if env->cwp == env->nwindows - 1, this will set the ins of the last
  35 + // window as the outs of the first window
  36 + cpu_set_cwp(env, env->cwp);
  37 +
34 38 for(i = 0; i < 8; i++)
35 39 qemu_put_betls(f, &env->gregs[i]);
36 40 qemu_put_be32s(f, &env->nwindows);
... ... @@ -54,6 +58,9 @@ void cpu_save(QEMUFile *f, void *opaque)
54 58 qemu_put_be32(f, tmp);
55 59 qemu_put_betls(f, &env->fsr);
56 60 qemu_put_betls(f, &env->tbr);
  61 + tmp = env->interrupt_index;
  62 + qemu_put_be32(f, tmp);
  63 + qemu_put_be32s(f, &env->pil_in);
57 64 #ifndef TARGET_SPARC64
58 65 qemu_put_be32s(f, &env->wim);
59 66 /* MMU */
... ... @@ -110,7 +117,7 @@ void cpu_save(QEMUFile *f, void *opaque)
110 117 qemu_put_be64s(f, &env->hver);
111 118 qemu_put_be64s(f, &env->hstick_cmpr);
112 119 qemu_put_be64s(f, &env->ssr);
113   - qemu_get_ptimer(f, env->hstick);
  120 + qemu_put_ptimer(f, env->hstick);
114 121 #endif
115 122 }
116 123  
... ... @@ -147,6 +154,9 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
147 154 PUT_PSR(env, tmp);
148 155 qemu_get_betls(f, &env->fsr);
149 156 qemu_get_betls(f, &env->tbr);
  157 + tmp = qemu_get_be32(f);
  158 + env->interrupt_index = tmp;
  159 + qemu_get_be32s(f, &env->pil_in);
150 160 #ifndef TARGET_SPARC64
151 161 qemu_get_be32s(f, &env->wim);
152 162 /* MMU */
... ...