root / target-ppc / machine.c @ 067d01de
History | View | Annotate | Download (5.7 kB)
1 | 8dd3dca3 | aurel32 | #include "hw/hw.h" |
---|---|---|---|
2 | 8dd3dca3 | aurel32 | #include "hw/boards.h" |
3 | b0a46a33 | Jan Kiszka | #include "kvm.h" |
4 | 8dd3dca3 | aurel32 | |
5 | 8dd3dca3 | aurel32 | void cpu_save(QEMUFile *f, void *opaque) |
6 | 8dd3dca3 | aurel32 | { |
7 | a456d59c | blueswir1 | CPUState *env = (CPUState *)opaque; |
8 | a456d59c | blueswir1 | unsigned int i, j; |
9 | a456d59c | blueswir1 | |
10 | 4c0960c0 | Avi Kivity | cpu_synchronize_state(env); |
11 | b0a46a33 | Jan Kiszka | |
12 | a456d59c | blueswir1 | for (i = 0; i < 32; i++) |
13 | a456d59c | blueswir1 | qemu_put_betls(f, &env->gpr[i]); |
14 | a456d59c | blueswir1 | #if !defined(TARGET_PPC64)
|
15 | a456d59c | blueswir1 | for (i = 0; i < 32; i++) |
16 | a456d59c | blueswir1 | qemu_put_betls(f, &env->gprh[i]); |
17 | a456d59c | blueswir1 | #endif
|
18 | a456d59c | blueswir1 | qemu_put_betls(f, &env->lr); |
19 | a456d59c | blueswir1 | qemu_put_betls(f, &env->ctr); |
20 | a456d59c | blueswir1 | for (i = 0; i < 8; i++) |
21 | a456d59c | blueswir1 | qemu_put_be32s(f, &env->crf[i]); |
22 | a456d59c | blueswir1 | qemu_put_betls(f, &env->xer); |
23 | 18b21a2f | Nathan Froyd | qemu_put_betls(f, &env->reserve_addr); |
24 | a456d59c | blueswir1 | qemu_put_betls(f, &env->msr); |
25 | a456d59c | blueswir1 | for (i = 0; i < 4; i++) |
26 | a456d59c | blueswir1 | qemu_put_betls(f, &env->tgpr[i]); |
27 | a456d59c | blueswir1 | for (i = 0; i < 32; i++) { |
28 | a456d59c | blueswir1 | union {
|
29 | a456d59c | blueswir1 | float64 d; |
30 | a456d59c | blueswir1 | uint64_t l; |
31 | a456d59c | blueswir1 | } u; |
32 | a456d59c | blueswir1 | u.d = env->fpr[i]; |
33 | a456d59c | blueswir1 | qemu_put_be64(f, u.l); |
34 | a456d59c | blueswir1 | } |
35 | a456d59c | blueswir1 | qemu_put_be32s(f, &env->fpscr); |
36 | a456d59c | blueswir1 | qemu_put_sbe32s(f, &env->access_type); |
37 | a456d59c | blueswir1 | #if !defined(CONFIG_USER_ONLY)
|
38 | a456d59c | blueswir1 | #if defined(TARGET_PPC64)
|
39 | a456d59c | blueswir1 | qemu_put_betls(f, &env->asr); |
40 | a456d59c | blueswir1 | qemu_put_sbe32s(f, &env->slb_nr); |
41 | a456d59c | blueswir1 | #endif
|
42 | a456d59c | blueswir1 | qemu_put_betls(f, &env->sdr1); |
43 | a456d59c | blueswir1 | for (i = 0; i < 32; i++) |
44 | a456d59c | blueswir1 | qemu_put_betls(f, &env->sr[i]); |
45 | a456d59c | blueswir1 | for (i = 0; i < 2; i++) |
46 | a456d59c | blueswir1 | for (j = 0; j < 8; j++) |
47 | a456d59c | blueswir1 | qemu_put_betls(f, &env->DBAT[i][j]); |
48 | a456d59c | blueswir1 | for (i = 0; i < 2; i++) |
49 | a456d59c | blueswir1 | for (j = 0; j < 8; j++) |
50 | a456d59c | blueswir1 | qemu_put_betls(f, &env->IBAT[i][j]); |
51 | a456d59c | blueswir1 | qemu_put_sbe32s(f, &env->nb_tlb); |
52 | a456d59c | blueswir1 | qemu_put_sbe32s(f, &env->tlb_per_way); |
53 | a456d59c | blueswir1 | qemu_put_sbe32s(f, &env->nb_ways); |
54 | a456d59c | blueswir1 | qemu_put_sbe32s(f, &env->last_way); |
55 | a456d59c | blueswir1 | qemu_put_sbe32s(f, &env->id_tlbs); |
56 | a456d59c | blueswir1 | qemu_put_sbe32s(f, &env->nb_pids); |
57 | a456d59c | blueswir1 | if (env->tlb) {
|
58 | a456d59c | blueswir1 | // XXX assumes 6xx
|
59 | a456d59c | blueswir1 | for (i = 0; i < env->nb_tlb; i++) { |
60 | a456d59c | blueswir1 | qemu_put_betls(f, &env->tlb[i].tlb6.pte0); |
61 | a456d59c | blueswir1 | qemu_put_betls(f, &env->tlb[i].tlb6.pte1); |
62 | a456d59c | blueswir1 | qemu_put_betls(f, &env->tlb[i].tlb6.EPN); |
63 | a456d59c | blueswir1 | } |
64 | a456d59c | blueswir1 | } |
65 | a456d59c | blueswir1 | for (i = 0; i < 4; i++) |
66 | a456d59c | blueswir1 | qemu_put_betls(f, &env->pb[i]); |
67 | a456d59c | blueswir1 | #endif
|
68 | a456d59c | blueswir1 | for (i = 0; i < 1024; i++) |
69 | a456d59c | blueswir1 | qemu_put_betls(f, &env->spr[i]); |
70 | a456d59c | blueswir1 | qemu_put_be32s(f, &env->vscr); |
71 | a456d59c | blueswir1 | qemu_put_be64s(f, &env->spe_acc); |
72 | a456d59c | blueswir1 | qemu_put_be32s(f, &env->spe_fscr); |
73 | a456d59c | blueswir1 | qemu_put_betls(f, &env->msr_mask); |
74 | a456d59c | blueswir1 | qemu_put_be32s(f, &env->flags); |
75 | a456d59c | blueswir1 | qemu_put_sbe32s(f, &env->error_code); |
76 | a456d59c | blueswir1 | qemu_put_be32s(f, &env->pending_interrupts); |
77 | a456d59c | blueswir1 | #if !defined(CONFIG_USER_ONLY)
|
78 | a456d59c | blueswir1 | qemu_put_be32s(f, &env->irq_input_state); |
79 | a456d59c | blueswir1 | for (i = 0; i < POWERPC_EXCP_NB; i++) |
80 | a456d59c | blueswir1 | qemu_put_betls(f, &env->excp_vectors[i]); |
81 | a456d59c | blueswir1 | qemu_put_betls(f, &env->excp_prefix); |
82 | fc1c67bc | Blue Swirl | qemu_put_betls(f, &env->hreset_excp_prefix); |
83 | a456d59c | blueswir1 | qemu_put_betls(f, &env->ivor_mask); |
84 | a456d59c | blueswir1 | qemu_put_betls(f, &env->ivpr_mask); |
85 | a456d59c | blueswir1 | qemu_put_betls(f, &env->hreset_vector); |
86 | a456d59c | blueswir1 | #endif
|
87 | a456d59c | blueswir1 | qemu_put_betls(f, &env->nip); |
88 | a456d59c | blueswir1 | qemu_put_betls(f, &env->hflags); |
89 | a456d59c | blueswir1 | qemu_put_betls(f, &env->hflags_nmsr); |
90 | a456d59c | blueswir1 | qemu_put_sbe32s(f, &env->mmu_idx); |
91 | a456d59c | blueswir1 | qemu_put_sbe32s(f, &env->power_mode); |
92 | 8dd3dca3 | aurel32 | } |
93 | 8dd3dca3 | aurel32 | |
94 | 8dd3dca3 | aurel32 | int cpu_load(QEMUFile *f, void *opaque, int version_id) |
95 | 8dd3dca3 | aurel32 | { |
96 | a456d59c | blueswir1 | CPUState *env = (CPUState *)opaque; |
97 | a456d59c | blueswir1 | unsigned int i, j; |
98 | a456d59c | blueswir1 | |
99 | 4c0960c0 | Avi Kivity | cpu_synchronize_state(env); |
100 | 4c0960c0 | Avi Kivity | |
101 | a456d59c | blueswir1 | for (i = 0; i < 32; i++) |
102 | a456d59c | blueswir1 | qemu_get_betls(f, &env->gpr[i]); |
103 | a456d59c | blueswir1 | #if !defined(TARGET_PPC64)
|
104 | a456d59c | blueswir1 | for (i = 0; i < 32; i++) |
105 | a456d59c | blueswir1 | qemu_get_betls(f, &env->gprh[i]); |
106 | a456d59c | blueswir1 | #endif
|
107 | a456d59c | blueswir1 | qemu_get_betls(f, &env->lr); |
108 | a456d59c | blueswir1 | qemu_get_betls(f, &env->ctr); |
109 | a456d59c | blueswir1 | for (i = 0; i < 8; i++) |
110 | a456d59c | blueswir1 | qemu_get_be32s(f, &env->crf[i]); |
111 | a456d59c | blueswir1 | qemu_get_betls(f, &env->xer); |
112 | 18b21a2f | Nathan Froyd | qemu_get_betls(f, &env->reserve_addr); |
113 | a456d59c | blueswir1 | qemu_get_betls(f, &env->msr); |
114 | a456d59c | blueswir1 | for (i = 0; i < 4; i++) |
115 | a456d59c | blueswir1 | qemu_get_betls(f, &env->tgpr[i]); |
116 | a456d59c | blueswir1 | for (i = 0; i < 32; i++) { |
117 | a456d59c | blueswir1 | union {
|
118 | a456d59c | blueswir1 | float64 d; |
119 | a456d59c | blueswir1 | uint64_t l; |
120 | a456d59c | blueswir1 | } u; |
121 | a456d59c | blueswir1 | u.l = qemu_get_be64(f); |
122 | a456d59c | blueswir1 | env->fpr[i] = u.d; |
123 | a456d59c | blueswir1 | } |
124 | a456d59c | blueswir1 | qemu_get_be32s(f, &env->fpscr); |
125 | a456d59c | blueswir1 | qemu_get_sbe32s(f, &env->access_type); |
126 | a456d59c | blueswir1 | #if !defined(CONFIG_USER_ONLY)
|
127 | a456d59c | blueswir1 | #if defined(TARGET_PPC64)
|
128 | a456d59c | blueswir1 | qemu_get_betls(f, &env->asr); |
129 | a456d59c | blueswir1 | qemu_get_sbe32s(f, &env->slb_nr); |
130 | a456d59c | blueswir1 | #endif
|
131 | a456d59c | blueswir1 | qemu_get_betls(f, &env->sdr1); |
132 | a456d59c | blueswir1 | for (i = 0; i < 32; i++) |
133 | a456d59c | blueswir1 | qemu_get_betls(f, &env->sr[i]); |
134 | a456d59c | blueswir1 | for (i = 0; i < 2; i++) |
135 | a456d59c | blueswir1 | for (j = 0; j < 8; j++) |
136 | a456d59c | blueswir1 | qemu_get_betls(f, &env->DBAT[i][j]); |
137 | a456d59c | blueswir1 | for (i = 0; i < 2; i++) |
138 | a456d59c | blueswir1 | for (j = 0; j < 8; j++) |
139 | a456d59c | blueswir1 | qemu_get_betls(f, &env->IBAT[i][j]); |
140 | a456d59c | blueswir1 | qemu_get_sbe32s(f, &env->nb_tlb); |
141 | a456d59c | blueswir1 | qemu_get_sbe32s(f, &env->tlb_per_way); |
142 | a456d59c | blueswir1 | qemu_get_sbe32s(f, &env->nb_ways); |
143 | a456d59c | blueswir1 | qemu_get_sbe32s(f, &env->last_way); |
144 | a456d59c | blueswir1 | qemu_get_sbe32s(f, &env->id_tlbs); |
145 | a456d59c | blueswir1 | qemu_get_sbe32s(f, &env->nb_pids); |
146 | a456d59c | blueswir1 | if (env->tlb) {
|
147 | a456d59c | blueswir1 | // XXX assumes 6xx
|
148 | a456d59c | blueswir1 | for (i = 0; i < env->nb_tlb; i++) { |
149 | a456d59c | blueswir1 | qemu_get_betls(f, &env->tlb[i].tlb6.pte0); |
150 | a456d59c | blueswir1 | qemu_get_betls(f, &env->tlb[i].tlb6.pte1); |
151 | a456d59c | blueswir1 | qemu_get_betls(f, &env->tlb[i].tlb6.EPN); |
152 | a456d59c | blueswir1 | } |
153 | a456d59c | blueswir1 | } |
154 | a456d59c | blueswir1 | for (i = 0; i < 4; i++) |
155 | a456d59c | blueswir1 | qemu_get_betls(f, &env->pb[i]); |
156 | a456d59c | blueswir1 | #endif
|
157 | a456d59c | blueswir1 | for (i = 0; i < 1024; i++) |
158 | a456d59c | blueswir1 | qemu_get_betls(f, &env->spr[i]); |
159 | a456d59c | blueswir1 | qemu_get_be32s(f, &env->vscr); |
160 | a456d59c | blueswir1 | qemu_get_be64s(f, &env->spe_acc); |
161 | a456d59c | blueswir1 | qemu_get_be32s(f, &env->spe_fscr); |
162 | a456d59c | blueswir1 | qemu_get_betls(f, &env->msr_mask); |
163 | a456d59c | blueswir1 | qemu_get_be32s(f, &env->flags); |
164 | a456d59c | blueswir1 | qemu_get_sbe32s(f, &env->error_code); |
165 | a456d59c | blueswir1 | qemu_get_be32s(f, &env->pending_interrupts); |
166 | a456d59c | blueswir1 | #if !defined(CONFIG_USER_ONLY)
|
167 | a456d59c | blueswir1 | qemu_get_be32s(f, &env->irq_input_state); |
168 | a456d59c | blueswir1 | for (i = 0; i < POWERPC_EXCP_NB; i++) |
169 | a456d59c | blueswir1 | qemu_get_betls(f, &env->excp_vectors[i]); |
170 | a456d59c | blueswir1 | qemu_get_betls(f, &env->excp_prefix); |
171 | fc1c67bc | Blue Swirl | qemu_get_betls(f, &env->hreset_excp_prefix); |
172 | a456d59c | blueswir1 | qemu_get_betls(f, &env->ivor_mask); |
173 | a456d59c | blueswir1 | qemu_get_betls(f, &env->ivpr_mask); |
174 | a456d59c | blueswir1 | qemu_get_betls(f, &env->hreset_vector); |
175 | a456d59c | blueswir1 | #endif
|
176 | a456d59c | blueswir1 | qemu_get_betls(f, &env->nip); |
177 | a456d59c | blueswir1 | qemu_get_betls(f, &env->hflags); |
178 | a456d59c | blueswir1 | qemu_get_betls(f, &env->hflags_nmsr); |
179 | a456d59c | blueswir1 | qemu_get_sbe32s(f, &env->mmu_idx); |
180 | a456d59c | blueswir1 | qemu_get_sbe32s(f, &env->power_mode); |
181 | a456d59c | blueswir1 | |
182 | 8dd3dca3 | aurel32 | return 0; |
183 | 8dd3dca3 | aurel32 | } |