Commit 0b8f1b102b9e134ad363f41061eafa91adad77db
1 parent
688ea2eb
Sparc32: save/load all MMU registers, Sparc64: add CPU save/load
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4938 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
110 additions
and
4 deletions
target-sparc/cpu.h
... | ... | @@ -397,7 +397,7 @@ void cpu_check_irqs(CPUSPARCState *env); |
397 | 397 | #define cpu_signal_handler cpu_sparc_signal_handler |
398 | 398 | #define cpu_list sparc_cpu_list |
399 | 399 | |
400 | -#define CPU_SAVE_VERSION 4 | |
400 | +#define CPU_SAVE_VERSION 5 | |
401 | 401 | |
402 | 402 | /* MMU modes definitions */ |
403 | 403 | #define MMU_MODE0_SUFFIX _user | ... | ... |
target-sparc/machine.c
1 | 1 | #include "hw/hw.h" |
2 | 2 | #include "hw/boards.h" |
3 | +#include "qemu-timer.h" | |
3 | 4 | |
4 | 5 | #include "exec-all.h" |
5 | 6 | |
... | ... | @@ -56,8 +57,60 @@ void cpu_save(QEMUFile *f, void *opaque) |
56 | 57 | #ifndef TARGET_SPARC64 |
57 | 58 | qemu_put_be32s(f, &env->wim); |
58 | 59 | /* MMU */ |
59 | - for(i = 0; i < 16; i++) | |
60 | + for (i = 0; i < 32; i++) | |
60 | 61 | qemu_put_be32s(f, &env->mmuregs[i]); |
62 | +#else | |
63 | + qemu_put_be64s(f, &env->lsu); | |
64 | + for (i = 0; i < 16; i++) { | |
65 | + qemu_put_be64s(f, &env->immuregs[i]); | |
66 | + qemu_put_be64s(f, &env->dmmuregs[i]); | |
67 | + } | |
68 | + for (i = 0; i < 64; i++) { | |
69 | + qemu_put_be64s(f, &env->itlb_tag[i]); | |
70 | + qemu_put_be64s(f, &env->itlb_tte[i]); | |
71 | + qemu_put_be64s(f, &env->dtlb_tag[i]); | |
72 | + qemu_put_be64s(f, &env->dtlb_tte[i]); | |
73 | + } | |
74 | + qemu_put_be32s(f, &env->mmu_version); | |
75 | + for (i = 0; i < MAXTL; i++) { | |
76 | + qemu_put_be64s(f, &env->ts[i].tpc); | |
77 | + qemu_put_be64s(f, &env->ts[i].tnpc); | |
78 | + qemu_put_be64s(f, &env->ts[i].tstate); | |
79 | + qemu_put_be32s(f, &env->ts[i].tt); | |
80 | + } | |
81 | + qemu_put_be32s(f, &env->xcc); | |
82 | + qemu_put_be32s(f, &env->asi); | |
83 | + qemu_put_be32s(f, &env->pstate); | |
84 | + qemu_put_be32s(f, &env->tl); | |
85 | + qemu_put_be32s(f, &env->cansave); | |
86 | + qemu_put_be32s(f, &env->canrestore); | |
87 | + qemu_put_be32s(f, &env->otherwin); | |
88 | + qemu_put_be32s(f, &env->wstate); | |
89 | + qemu_put_be32s(f, &env->cleanwin); | |
90 | + for (i = 0; i < 8; i++) | |
91 | + qemu_put_be64s(f, &env->agregs[i]); | |
92 | + for (i = 0; i < 8; i++) | |
93 | + qemu_put_be64s(f, &env->bgregs[i]); | |
94 | + for (i = 0; i < 8; i++) | |
95 | + qemu_put_be64s(f, &env->igregs[i]); | |
96 | + for (i = 0; i < 8; i++) | |
97 | + qemu_put_be64s(f, &env->mgregs[i]); | |
98 | + qemu_put_be64s(f, &env->fprs); | |
99 | + qemu_put_be64s(f, &env->tick_cmpr); | |
100 | + qemu_put_be64s(f, &env->stick_cmpr); | |
101 | + qemu_put_ptimer(f, env->tick); | |
102 | + qemu_put_ptimer(f, env->stick); | |
103 | + qemu_put_be64s(f, &env->gsr); | |
104 | + qemu_put_be32s(f, &env->gl); | |
105 | + qemu_put_be64s(f, &env->hpstate); | |
106 | + for (i = 0; i < MAXTL; i++) | |
107 | + qemu_put_be64s(f, &env->htstate[i]); | |
108 | + qemu_put_be64s(f, &env->hintp); | |
109 | + qemu_put_be64s(f, &env->htba); | |
110 | + qemu_put_be64s(f, &env->hver); | |
111 | + qemu_put_be64s(f, &env->hstick_cmpr); | |
112 | + qemu_put_be64s(f, &env->ssr); | |
113 | + qemu_get_ptimer(f, env->hstick); | |
61 | 114 | #endif |
62 | 115 | } |
63 | 116 | |
... | ... | @@ -67,7 +120,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) |
67 | 120 | int i; |
68 | 121 | uint32_t tmp; |
69 | 122 | |
70 | - if (version_id != 4) | |
123 | + if (version_id != 5) | |
71 | 124 | return -EINVAL; |
72 | 125 | for(i = 0; i < 8; i++) |
73 | 126 | qemu_get_betls(f, &env->gregs[i]); |
... | ... | @@ -97,8 +150,61 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) |
97 | 150 | #ifndef TARGET_SPARC64 |
98 | 151 | qemu_get_be32s(f, &env->wim); |
99 | 152 | /* MMU */ |
100 | - for(i = 0; i < 16; i++) | |
153 | + for (i = 0; i < 32; i++) | |
101 | 154 | qemu_get_be32s(f, &env->mmuregs[i]); |
155 | +#else | |
156 | + qemu_get_be64s(f, &env->lsu); | |
157 | + for (i = 0; i < 16; i++) { | |
158 | + qemu_get_be64s(f, &env->immuregs[i]); | |
159 | + qemu_get_be64s(f, &env->dmmuregs[i]); | |
160 | + } | |
161 | + for (i = 0; i < 64; i++) { | |
162 | + qemu_get_be64s(f, &env->itlb_tag[i]); | |
163 | + qemu_get_be64s(f, &env->itlb_tte[i]); | |
164 | + qemu_get_be64s(f, &env->dtlb_tag[i]); | |
165 | + qemu_get_be64s(f, &env->dtlb_tte[i]); | |
166 | + } | |
167 | + qemu_get_be32s(f, &env->mmu_version); | |
168 | + for (i = 0; i < MAXTL; i++) { | |
169 | + qemu_get_be64s(f, &env->ts[i].tpc); | |
170 | + qemu_get_be64s(f, &env->ts[i].tnpc); | |
171 | + qemu_get_be64s(f, &env->ts[i].tstate); | |
172 | + qemu_get_be32s(f, &env->ts[i].tt); | |
173 | + } | |
174 | + qemu_get_be32s(f, &env->xcc); | |
175 | + qemu_get_be32s(f, &env->asi); | |
176 | + qemu_get_be32s(f, &env->pstate); | |
177 | + qemu_get_be32s(f, &env->tl); | |
178 | + env->tsptr = &env->ts[env->tl]; | |
179 | + qemu_get_be32s(f, &env->cansave); | |
180 | + qemu_get_be32s(f, &env->canrestore); | |
181 | + qemu_get_be32s(f, &env->otherwin); | |
182 | + qemu_get_be32s(f, &env->wstate); | |
183 | + qemu_get_be32s(f, &env->cleanwin); | |
184 | + for (i = 0; i < 8; i++) | |
185 | + qemu_get_be64s(f, &env->agregs[i]); | |
186 | + for (i = 0; i < 8; i++) | |
187 | + qemu_get_be64s(f, &env->bgregs[i]); | |
188 | + for (i = 0; i < 8; i++) | |
189 | + qemu_get_be64s(f, &env->igregs[i]); | |
190 | + for (i = 0; i < 8; i++) | |
191 | + qemu_get_be64s(f, &env->mgregs[i]); | |
192 | + qemu_get_be64s(f, &env->fprs); | |
193 | + qemu_get_be64s(f, &env->tick_cmpr); | |
194 | + qemu_get_be64s(f, &env->stick_cmpr); | |
195 | + qemu_get_ptimer(f, env->tick); | |
196 | + qemu_get_ptimer(f, env->stick); | |
197 | + qemu_get_be64s(f, &env->gsr); | |
198 | + qemu_get_be32s(f, &env->gl); | |
199 | + qemu_get_be64s(f, &env->hpstate); | |
200 | + for (i = 0; i < MAXTL; i++) | |
201 | + qemu_get_be64s(f, &env->htstate[i]); | |
202 | + qemu_get_be64s(f, &env->hintp); | |
203 | + qemu_get_be64s(f, &env->htba); | |
204 | + qemu_get_be64s(f, &env->hver); | |
205 | + qemu_get_be64s(f, &env->hstick_cmpr); | |
206 | + qemu_get_be64s(f, &env->ssr); | |
207 | + qemu_get_ptimer(f, env->hstick); | |
102 | 208 | #endif |
103 | 209 | tlb_flush(env, 1); |
104 | 210 | return 0; | ... | ... |