Commit a750fc0b9184a520d00d9e949160a0c6d3232ecd
1 parent
08fa4bab
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c * add new flags to define instructions sets more precisely * various changes in MMU models definitions * add definitions for PowerPC 440/460 support (insns and SPRs). * add definitions for PowerPC 401/403 and 620 input pins model * Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0 * Preliminary support for PowerPC 74xx (aka G4) without altivec. * Code provision for other PowerPC support (7x5, 970, ...). * New SPR and PVR defined, from PowerPC 2.04 specification and other sources * Misc code bugs, error messages and styles fixes. * Update status files for PowerPC cores support. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
10 changed files
with
1017 additions
and
1010 deletions
Too many changes to show.
To preserve performance only 10 of 11 files are displayed.
hw/ppc.c
... | ... | @@ -376,11 +376,11 @@ static void ppc405_set_irq (void *opaque, int pin, int level) |
376 | 376 | /* Level sensitive - active high */ |
377 | 377 | #if defined(PPC_DEBUG_IRQ) |
378 | 378 | if (loglevel & CPU_LOG_INT) { |
379 | - fprintf(logfile, "%s: set the external IRQ state to %d\n", | |
379 | + fprintf(logfile, "%s: set the debug pin state to %d\n", | |
380 | 380 | __func__, level); |
381 | 381 | } |
382 | 382 | #endif |
383 | - ppc_set_irq(env, EXCP_40x_DEBUG, level); | |
383 | + ppc_set_irq(env, PPC_INTERRUPT_DEBUG, level); | |
384 | 384 | break; |
385 | 385 | default: |
386 | 386 | /* Unknown pin - do nothing */ |
... | ... | @@ -904,6 +904,9 @@ struct ppc_dcrn_t { |
904 | 904 | void *opaque; |
905 | 905 | }; |
906 | 906 | |
907 | +/* XXX: on 460, DCR addresses are 32 bits wide, | |
908 | + * using DCRIPR to get the 22 upper bits of the DCR address | |
909 | + */ | |
907 | 910 | #define DCRN_NB 1024 |
908 | 911 | struct ppc_dcr_t { |
909 | 912 | ppc_dcrn_t dcrn[DCRN_NB]; | ... | ... |
linux-user/main.c
... | ... | @@ -712,6 +712,17 @@ uint32_t cpu_ppc601_load_rtcl (CPUState *env) |
712 | 712 | return cpu_ppc_load_tbl(env) & 0x3FFFFF80; |
713 | 713 | } |
714 | 714 | |
715 | +/* XXX: to be fixed */ | |
716 | +int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, target_ulong *valp) | |
717 | +{ | |
718 | + return -1; | |
719 | +} | |
720 | + | |
721 | +int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val) | |
722 | +{ | |
723 | + return -1; | |
724 | +} | |
725 | + | |
715 | 726 | void cpu_loop(CPUPPCState *env) |
716 | 727 | { |
717 | 728 | target_siginfo_t info; |
... | ... | @@ -761,7 +772,7 @@ void cpu_loop(CPUPPCState *env) |
761 | 772 | case EXCP_MACHINE_CHECK: |
762 | 773 | fprintf(stderr, "Machine check exeption... Stop emulation\n"); |
763 | 774 | if (loglevel) |
764 | - fprintf(logfile, "RESET asked... Stop emulation\n"); | |
775 | + fprintf(logfile, "Machine check exception. Stop emulation\n"); | |
765 | 776 | info.si_signo = TARGET_SIGBUS; |
766 | 777 | info.si_errno = 0; |
767 | 778 | info.si_code = TARGET_BUS_OBJERR; |
... | ... | @@ -914,7 +925,7 @@ void cpu_loop(CPUPPCState *env) |
914 | 925 | info.si_code = TARGET_ILL_ILLOPC; |
915 | 926 | break; |
916 | 927 | case EXCP_INVAL_LSWX: |
917 | - info.si_code = TARGET_ILL_ILLOPN; | |
928 | + info.si_code = TARGET_ILL_ILLOPN; | |
918 | 929 | break; |
919 | 930 | case EXCP_INVAL_SPR: |
920 | 931 | info.si_code = TARGET_ILL_PRVREG; |
... | ... | @@ -1003,7 +1014,7 @@ void cpu_loop(CPUPPCState *env) |
1003 | 1014 | if (loglevel) |
1004 | 1015 | fprintf(logfile, "Tried to go into supervisor mode !\n"); |
1005 | 1016 | abort(); |
1006 | - } | |
1017 | + } | |
1007 | 1018 | break; |
1008 | 1019 | case EXCP_BRANCH: |
1009 | 1020 | /* We stopped because of a jump... */ | ... | ... |
target-ppc/STATUS
... | ... | @@ -4,267 +4,462 @@ The goal of this file is to provide a reference status to avoid regressions. |
4 | 4 | =============================================================================== |
5 | 5 | PowerPC core emulation status |
6 | 6 | |
7 | -32 bits PowerPC | |
8 | -PowerPC 601: | |
9 | -INSN | |
10 | -SPR | |
11 | -MMU | |
12 | -EXCP | |
13 | - | |
14 | -PowerPC 602: | |
15 | -INSN | |
16 | -SPR | |
17 | -MMU | |
18 | -EXCP | |
19 | - | |
20 | -PowerPC 603: | |
21 | -INSN OK | |
22 | -SPR OK | |
23 | -MMU OK | |
24 | -EXCP OK | |
25 | - | |
26 | -PowerPC 604: | |
27 | -INSN OK | |
28 | -SPR OK | |
29 | -MMU OK | |
30 | -EXCP OK | |
31 | - | |
32 | -PowerPC 740: | |
33 | -INSN OK | |
34 | -SPR OK | |
35 | -MMU OK | |
36 | -EXCP OK | |
37 | - | |
38 | -PowerPC 745: | |
39 | -INSN | |
40 | -SPR | |
41 | -MMU | |
42 | -EXCP | |
43 | - | |
44 | -PowerPC 750: | |
45 | -INSN OK | |
46 | -SPR OK | |
47 | -MMU OK | |
48 | -EXCP OK | |
49 | - | |
50 | -PowerPC 755: | |
51 | -INSN | |
52 | -SPR | |
53 | -MMU | |
54 | -EXCP | |
7 | +INSN: instruction set. | |
8 | + OK => all instructions are emulated | |
9 | + KO => some insns are missing or some should be removed | |
10 | + ? => unchecked | |
11 | +SPR: special purpose registers set | |
12 | + OK => all SPR registered (but some may be fake) | |
13 | + KO => some SPR are missing or should be removed | |
14 | + ? => uncheked | |
15 | +MSR: MSR bits definitions | |
16 | + OK => all MSR bits properly defined | |
17 | + KO => MSR definition is incorrect | |
18 | + ? => unchecked | |
19 | +IRQ: input signals definitions (mostly interrupts) | |
20 | + OK => input signals are properly defined | |
21 | + KO => input signals are not implemented (system emulation does not work) | |
22 | + ? => input signals definitions may be incorrect | |
23 | +MMU: MMU model implementation | |
24 | + OK => MMU model is implemented and Linux is able to boot | |
25 | + KO => MMU model not implemented or bugged | |
26 | + ? => MMU model not tested | |
27 | +EXCP: exceptions model implementation | |
28 | + OK => exception model is implemented and Linux is able to boot | |
29 | + KO => exception model not implemented or known to be buggy | |
30 | + ? => exception model may be incorrect or is untested | |
55 | 31 | |
56 | -PowerPC 7400: | |
57 | -INSN KO | |
58 | -SPR KO | |
59 | -MMU OK | |
60 | -EXCP OK | |
32 | +Embedded PowerPC cores | |
33 | +*** | |
34 | +PowerPC 401: | |
35 | +INSN OK | |
36 | +SPR OK 401A1 | |
37 | +MSR OK | |
38 | +IRQ KO partially implemented | |
39 | +MMU OK | |
40 | +EXCP ? | |
61 | 41 | |
62 | -PowerPC 7410: | |
63 | -INSN KO | |
64 | -SPR KO | |
65 | -MMU OK | |
66 | -EXCP OK | |
67 | - | |
68 | -PowerPC 7450: | |
69 | -INSN KO | |
70 | -SPR KO | |
71 | -MMU OK | |
72 | -EXCP OK | |
73 | - | |
74 | -PowerPC 7455: | |
75 | -INSN KO | |
76 | -SPR KO | |
77 | -MMU OK | |
78 | -EXCP OK | |
79 | - | |
80 | -PowerPC 7457: | |
81 | -INSN KO | |
82 | -SPR KO | |
83 | -MMU OK | |
84 | -EXCP OK | |
85 | - | |
86 | -PowerPC 7457A: | |
87 | -INSN KO | |
88 | -SPR KO | |
89 | -MMU OK | |
90 | -EXCP OK | |
42 | +PowerPC 401x2: | |
43 | +INSN OK | |
44 | +SPR OK 401B2 401C2 401D2 401E2 401F2 | |
45 | +MSR OK | |
46 | +IRQ KO partially implemented | |
47 | +MMU OK | |
48 | +EXCP ? | |
91 | 49 | |
92 | -64 bits PowerPC | |
93 | -PowerPC 970: | |
94 | -INSN KO | |
95 | -SPR KO | |
96 | -MMU KO | |
97 | -EXCP KO | |
98 | - | |
99 | -PowerPC 620: (lack of precise informations) | |
100 | -INSN KO | |
101 | -SPR KO | |
102 | -MMU KO | |
103 | -EXCP KO | |
104 | - | |
105 | -PowerPC 630: (lack of precise informations) | |
106 | -INSN KO | |
107 | -SPR KO | |
108 | -MMU KO | |
109 | -EXCP KO | |
110 | - | |
111 | -PowerPC 631: (lack of precise informations) | |
112 | -INSN KO | |
113 | -SPR KO | |
114 | -MMU KO | |
115 | -EXCP KO | |
116 | - | |
117 | -POWER4: (lack of precise informations) | |
118 | -INSN KO | |
119 | -SPR KO | |
120 | -MMU KO | |
121 | -EXCP KO | |
122 | - | |
123 | -POWER4+: (lack of precise informations) | |
124 | -INSN KO | |
125 | -SPR KO | |
126 | -MMU KO | |
127 | -EXCP KO | |
128 | - | |
129 | -POWER5: (lack of precise informations) | |
130 | -INSN KO | |
131 | -SPR KO | |
132 | -MMU KO | |
133 | -EXCP KO | |
134 | - | |
135 | -POWER5+: (lack of precise informations) | |
136 | -INSN KO | |
137 | -SPR KO | |
138 | -MMU KO | |
139 | -EXCP KO | |
140 | - | |
141 | -POWER6: (lack of precise informations) | |
142 | -INSN KO | |
143 | -SPR KO | |
144 | -MMU KO | |
145 | -EXCP KO | |
146 | - | |
147 | -RS64: (lack of precise informations) | |
148 | -INSN KO | |
149 | -SPR KO | |
150 | -MMU KO | |
151 | -EXCP KO | |
152 | - | |
153 | -RS64-II: (lack of precise informations) | |
154 | -INSN KO | |
155 | -SPR KO | |
156 | -MMU KO | |
157 | -EXCP KO | |
158 | - | |
159 | -RS64-III: (lack of precise informations) | |
160 | -INSN KO | |
161 | -SPR KO | |
162 | -MMU KO | |
163 | -EXCP KO | |
164 | - | |
165 | -RS64-IV: (lack of precise informations) | |
166 | -INSN KO | |
167 | -SPR KO | |
168 | -MMU KO | |
169 | -EXCP KO | |
50 | +PowerPC IOP480: | |
51 | +INSN OK | |
52 | +SPR OK IOP480 | |
53 | +MSR OK | |
54 | +IRQ KO partially implemented | |
55 | +MMU OK | |
56 | +EXCP ? | |
170 | 57 | |
171 | -Embedded PowerPC cores | |
172 | -PowerPC 401: | |
173 | -INSN OK | |
174 | -SPR OK | |
175 | -MMU OK | |
176 | -EXCP ? | |
58 | +To be checked: 401G2 401B3 Cobra | |
177 | 59 | |
60 | +*** | |
178 | 61 | PowerPC 403: |
179 | -INSN OK | |
180 | -SPR OK | |
181 | -MMU OK | |
182 | -EXCP ? | |
62 | +INSN OK | |
63 | +SPR OK 403GA 403GB | |
64 | +MMU OK | |
65 | +MSR OK | |
66 | +IRQ KO not implemented | |
67 | +EXCP ? | |
183 | 68 | |
69 | +PowerPC 403GCX: | |
70 | +INSN OK | |
71 | +SPR OK 403GCX | |
72 | +MMU OK | |
73 | +MSR OK | |
74 | +IRQ KO not implemented | |
75 | +EXCP ? | |
76 | + | |
77 | +To be checked: 403GC | |
78 | + | |
79 | +*** | |
184 | 80 | PowerPC 405: |
185 | -INSN OK | |
186 | -SPR OK | |
187 | -MMU OK | |
188 | -EXCP OK | |
81 | +Checked: 405CRa 405CRb 405CRc 405EP 405GPa 405GPb 405GPc 405GPd 405GPe 405GPR | |
82 | + Npe405H Npe405H2 Npe405L | |
83 | +INSN OK | |
84 | +SPR OK | |
85 | +MSR OK | |
86 | +IRQ OK | |
87 | +MMU OK | |
88 | +EXCP OK | |
89 | +=> Linux 2.4 boots (at least 1 proprietary firmware). | |
90 | + | |
91 | +To be checked: 405D2 405D4 405EZ 405LP Npe4GS3 STB03 STB04 STB25 | |
92 | + x2vp4 x2vp7 x2vp20 x2vp50 | |
93 | + | |
94 | +XXX: find what is IBM e407b4 | |
189 | 95 | |
96 | +*** | |
190 | 97 | PowerPC 440: |
98 | +Checked: 440EPa 440EPb 440GXa 440GXb 440GXc 440GXf 440SP 440SP2 | |
99 | +INSN OK | |
100 | +SPR OK | |
101 | +MSR OK | |
102 | +IRQ KO not implemented | |
103 | +MMU ? | |
104 | +EXCP ? | |
105 | + | |
106 | +PowerPC 440GP: | |
107 | +Checked: 440GPb 440GPc | |
108 | +INSN OK | |
109 | +SPR OK | |
110 | +MSR OK | |
111 | +IRQ KO not implemented | |
112 | +MMU ? | |
113 | +EXCP ? | |
114 | + | |
115 | +PowerPC 440x4: | |
116 | +Checked: 440A4 440B4 440G4 440H4 | |
191 | 117 | INSN OK |
192 | 118 | SPR OK |
119 | +MSR OK | |
120 | +IRQ KO not implemented | |
193 | 121 | MMU ? |
194 | 122 | EXCP ? |
195 | 123 | |
196 | -PowerPC 460: (lack of precise informations) | |
124 | +PowerPC 440x5: | |
125 | +Checked: 440A5 440F5 440G5 440H6 440GRa | |
126 | +INSN OK | |
127 | +SPR OK | |
128 | +MSR OK | |
129 | +IRQ KO not implemented | |
130 | +MMU ? | |
131 | +EXCP ? | |
132 | + | |
133 | +To be checked: 440EPx 440GRx 440SPE | |
134 | + | |
135 | +*** | |
136 | +PowerPC 460: (disabled: lack of detailed specifications) | |
137 | +INSN KO | |
138 | +SPR KO | |
139 | +MSR KO | |
140 | +IRQ KO | |
141 | +MMU KO | |
142 | +EXCP KO | |
143 | + | |
144 | +PowerPC 460F: (disabled: lack of detailed specifications) | |
197 | 145 | INSN KO |
198 | 146 | SPR KO |
147 | +MSR KO | |
148 | +IRQ KO | |
199 | 149 | MMU KO |
200 | 150 | EXCP KO |
201 | 151 | |
202 | -Freescale (to be completed) ... | |
152 | +*** | |
153 | +PowerPC e200: (not implemented) | |
154 | +INSN KO | |
155 | +SPR KO | |
156 | +MSR KO | |
157 | +IRQ KO | |
158 | +MMU KO | |
159 | +EXCP KO | |
203 | 160 | |
204 | -Original POWER | |
205 | -POWER: (lack of precise informations) | |
161 | +*** | |
162 | +PowerPC e300: (not implemented) | |
206 | 163 | INSN KO |
207 | 164 | SPR KO |
165 | +MSR KO | |
166 | +IRQ KO | |
208 | 167 | MMU KO |
209 | 168 | EXCP KO |
210 | 169 | |
211 | -POWER2: (lack of precise informations) | |
170 | +*** | |
171 | +PowerPC e500: (not implemented) | |
212 | 172 | INSN KO |
213 | 173 | SPR KO |
174 | +MSR KO | |
175 | +IRQ KO | |
214 | 176 | MMU KO |
215 | 177 | EXCP KO |
216 | 178 | |
217 | -PowerPC CPU known to work (ie booting at least Linux 2.4): | |
218 | -* main stream PowerPC cores | |
219 | -- PowerPC 603 & derivatives | |
220 | -- PowerPC 604 & derivatives | |
221 | -- PowerPC 740 & derivatives | |
222 | -- PowerPC 750 & derivatives | |
223 | -- PowerPC 405 | |
224 | - | |
225 | -PowerPC that should work but are not supported by standard Linux kernel | |
226 | -(then remain mostly untested) | |
227 | -- PowerPC 745 | |
228 | -- PowerPC 755 | |
229 | - | |
230 | -Work in progress: | |
231 | -* embedded PowerPC cores | |
232 | -- BookE PowerPC | |
233 | -- e500 core (Freescale PowerQUICC) | |
234 | -* main stream PowerPC cores | |
235 | -- PowerPC 601 | |
236 | -- PowerPC 602 | |
179 | +*** | |
180 | +PowerPC e600: (not implemented) | |
181 | +INSN KO | |
182 | +SPR KO | |
183 | +MSR KO | |
184 | +IRQ KO | |
185 | +MMU KO | |
186 | +EXCP KO | |
237 | 187 | |
238 | -TODO: | |
239 | -* embedded PowerPC cores | |
240 | -- PowerPC 401 | |
241 | -- PowerPC 403 | |
242 | -- PowerPC 440 | |
243 | -- PowerPC 460 | |
244 | -* main stream PowerPC cores | |
245 | -- PowerPC 7400 (aka G4) | |
246 | -- PowerPC 7410 | |
247 | -- PowerPC 7450 | |
248 | -- PowerPC 7455 | |
249 | -- PowerPC 7457 | |
250 | -- PowerPC 7457A | |
251 | -* original POWER | |
252 | -- POWER | |
253 | -- POWER2 | |
254 | -* 64 bits PowerPC cores | |
255 | -- PowerPC 620 | |
256 | -- PowerPC 630 (aka POWER3) | |
257 | -- PowerPC 631 (aka POWER3+) | |
258 | -- POWER4 | |
259 | -- POWER4+ | |
260 | -- POWER5 | |
261 | -- POWER5+ | |
262 | -- PowerPC 970 | |
263 | -* RS64 series | |
264 | -- RS64 | |
265 | -- RS64-II | |
266 | -- RS64-III | |
267 | -- RS64-IV | |
188 | +*** | |
189 | +32 bits PowerPC | |
190 | +PowerPC 601: (601 601v2) | |
191 | +INSN OK | |
192 | +SPR OK is HID15 only on 601v2 ? | |
193 | +MSR OK | |
194 | +IRQ KO not implemented | |
195 | +MMU ? | |
196 | +EXCP ? | |
197 | +Remarks: some instructions should have a specific behavior (not implemented) | |
198 | + | |
199 | +PowerPC 602: 602 | |
200 | +INSN OK | |
201 | +SPR OK | |
202 | +MSR OK | |
203 | +IRQ OK | |
204 | +MMU ? | |
205 | +EXCP ? at least timer and external interrupt are OK | |
206 | +Remarks: Linux crashes when entering user-mode. But it seems it does not | |
207 | + know about this CPU. As this CPU is close to 603e, it should be OK. | |
208 | + | |
209 | +PowerPC 603: (603) | |
210 | +INSN OK | |
211 | +SPR OK | |
212 | +MSR OK | |
213 | +IRQ OK | |
214 | +MMU OK | |
215 | +EXCP OK | |
216 | +Remarks: Linux 2.4 boots and properly recognizes the CPU | |
217 | + | |
218 | +PowerPC 603e: (603e11) | |
219 | +INSN OK | |
220 | +SPR OK | |
221 | +MSR OK | |
222 | +IRQ OK | |
223 | +MMU OK | |
224 | +EXCP OK | |
225 | +Remarks: Linux 2.4 boots and properly recognizes the CPU | |
226 | + | |
227 | +PowerPC G2: | |
228 | +INSN OK | |
229 | +SPR OK | |
230 | +MSR OK | |
231 | +IRQ OK | |
232 | +MMU OK | |
233 | +EXCP OK | |
234 | +Remarks: Linux 2.4 boots, recognizes the CPU as a 82xx. | |
235 | + | |
236 | +PowerPC G2le: | |
237 | +INSN OK | |
238 | +SPR OK | |
239 | +MSR OK | |
240 | +IRQ OK | |
241 | +MMU OK | |
242 | +EXCP OK | |
243 | +Remarks: Linux 2.4 does not boots. Same symptoms as 602. | |
244 | + | |
245 | +PowerPC 604: | |
246 | +INSN OK | |
247 | +SPR OK | |
248 | +MSR OK | |
249 | +IRQ OK | |
250 | +MMU OK | |
251 | +EXCP OK | |
252 | +Remarks: Linux 2.4 boots and properly recognizes the CPU. | |
253 | + | |
254 | +PowerPC 7x0: | |
255 | +INSN OK | |
256 | +SPR OK | |
257 | +MSR OK | |
258 | +IRQ OK | |
259 | +MMU OK | |
260 | +EXCP OK | |
261 | +Remarks: Linux 2.4 boots and properly recognizes the CPU. | |
262 | + | |
263 | +PowerPC 750fx: | |
264 | +INSN OK | |
265 | +SPR OK | |
266 | +MSR OK | |
267 | +IRQ OK | |
268 | +MMU OK | |
269 | +EXCP OK | |
270 | +Remarks: Linux 2.4 boots but does not properly recognizes the CPU. | |
271 | + | |
272 | +PowerPC 7x5: | |
273 | +INSN ? | |
274 | +SPR ? | |
275 | +MSR ? | |
276 | +IRQ OK | |
277 | +MMU ? | |
278 | +EXCP OK | |
279 | +=> Linux 2.4 does not boot. | |
280 | + | |
281 | +PowerPC 7400: | |
282 | +INSN KO Altivec missing | |
283 | +SPR OK | |
284 | +MSR OK | |
285 | +IRQ OK | |
286 | +MMU OK | |
287 | +EXCP ? Altivec, ... | |
288 | +=> Linux 2.4 boots and properly recognize the CPU. | |
289 | + | |
290 | +PowerPC 7410: | |
291 | +INSN KO Altivec missing | |
292 | +SPR OK | |
293 | +MSR OK | |
294 | +IRQ OK | |
295 | +MMU OK | |
296 | +EXCP ? Altivec, ... | |
297 | +=> Linux 2.4 boots and properly recognize the CPU. | |
298 | + Note that UM says tlbld & tlbli are implemented bus this may be a mistake | |
299 | + as TLB load are managed by the hardware and it does not implement the | |
300 | + needed registers. | |
301 | + | |
302 | +PowerPC 7441: | |
303 | +INSN KO Altivec missing + TLB load insns missing | |
304 | +SPR OK | |
305 | +MSR OK | |
306 | +IRQ OK | |
307 | +MMU KO not implemented | |
308 | +EXCP ? Altivec, ... | |
309 | + | |
310 | +PowerPC 7450/7451: | |
311 | +INSN KO Altivec missing + TLB load insns missing | |
312 | +SPR OK | |
313 | +MSR OK | |
314 | +IRQ OK | |
315 | +MMU KO not implemented | |
316 | +EXCP ? Altivec, ... | |
317 | + | |
318 | +PowerPC 7445/7447: | |
319 | +INSN KO Altivec missing + TLB load insns missing | |
320 | +SPR OK | |
321 | +MSR OK | |
322 | +IRQ OK | |
323 | +MMU KO not implemented | |
324 | +EXCP ? Altivec, ... | |
325 | + | |
326 | +PowerPC 7455/7457: | |
327 | +INSN KO Altivec missing + TLB load insns missing | |
328 | +SPR OK | |
329 | +MSR OK | |
330 | +IRQ OK | |
331 | +MMU KO not implemented | |
332 | +EXCP ? Altivec, ... | |
333 | + | |
334 | +64 bits PowerPC | |
335 | +PowerPC 620: (disabled) | |
336 | +INSN KO | |
337 | +SPR KO | |
338 | +MSR ? | |
339 | +IRQ KO | |
340 | +MMU KO | |
341 | +EXCP KO | |
342 | + | |
343 | +PowerPC 970: (disabled) | |
344 | +INSN KO Altivec missing and more | |
345 | +SPR KO | |
346 | +MSR ? | |
347 | +IRQ OK | |
348 | +MMU KO partially implemented | |
349 | +EXCP KO | |
350 | + | |
351 | +PowerPC 970FX: (disabled) | |
352 | +INSN KO Altivec missing and more | |
353 | +SPR KO | |
354 | +MSR ? | |
355 | +IRQ OK | |
356 | +MMU KO partially implemented | |
357 | +EXCP KO | |
358 | + | |
359 | +PowerPC 630: (disabled: lack of detailed specifications) | |
360 | +INSN KO | |
361 | +SPR KO | |
362 | +MSR KO | |
363 | +IRQ KO | |
364 | +MMU KO | |
365 | +EXCP KO | |
366 | + | |
367 | +PowerPC 631: (disabled: lack of detailed specifications) | |
368 | +INSN KO | |
369 | +SPR KO | |
370 | +MSR KO | |
371 | +IRQ KO | |
372 | +MMU KO | |
373 | +EXCP KO | |
374 | + | |
375 | +POWER4: (disabled: lack of detailed specifications) | |
376 | +INSN KO | |
377 | +SPR KO | |
378 | +MSR KO | |
379 | +IRQ KO | |
380 | +MMU KO | |
381 | +EXCP KO | |
382 | + | |
383 | +POWER4+: (disabled: lack of detailed specifications) | |
384 | +INSN KO | |
385 | +SPR KO | |
386 | +MSR KO | |
387 | +IRQ KO | |
388 | +MMU KO | |
389 | +EXCP KO | |
390 | + | |
391 | +POWER5: (disabled: lack of detailed specifications) | |
392 | +INSN KO | |
393 | +SPR KO | |
394 | +MSR KO | |
395 | +IRQ KO | |
396 | +MMU KO | |
397 | +EXCP KO | |
398 | + | |
399 | +POWER5+: (disabled: lack of detailed specifications) | |
400 | +INSN KO | |
401 | +SPR KO | |
402 | +MSR KO | |
403 | +IRQ KO | |
404 | +MMU KO | |
405 | +EXCP KO | |
406 | + | |
407 | +POWER6: (disabled: lack of detailed specifications) | |
408 | +INSN KO | |
409 | +SPR KO | |
410 | +MSR KO | |
411 | +IRQ KO | |
412 | +MMU KO | |
413 | +EXCP KO | |
414 | + | |
415 | +RS64: (disabled: lack of detailed specifications) | |
416 | +INSN KO | |
417 | +SPR KO | |
418 | +MSR KO | |
419 | +IRQ KO | |
420 | +MMU KO | |
421 | +EXCP KO | |
422 | + | |
423 | +RS64-II: (disabled: lack of detailed specifications) | |
424 | +INSN KO | |
425 | +SPR KO | |
426 | +MSR KO | |
427 | +IRQ KO | |
428 | +MMU KO | |
429 | +EXCP KO | |
430 | + | |
431 | +RS64-III: (disabled: lack of detailed specifications) | |
432 | +INSN KO | |
433 | +SPR KO | |
434 | +MSR KO | |
435 | +IRQ KO | |
436 | +MMU KO | |
437 | +EXCP KO | |
438 | + | |
439 | +RS64-IV: (disabled: lack of detailed specifications) | |
440 | +INSN KO | |
441 | +SPR KO | |
442 | +MSR KO | |
443 | +IRQ KO | |
444 | +MMU KO | |
445 | +EXCP KO | |
446 | + | |
447 | +Original POWER | |
448 | +POWER: (disabled: lack of detailed specifications) | |
449 | +INSN KO | |
450 | +SPR KO | |
451 | +MSR KO | |
452 | +IRQ KO | |
453 | +MMU KO | |
454 | +EXCP KO | |
455 | + | |
456 | +POWER2: (disabled: lack of detailed specifications) | |
457 | +INSN KO | |
458 | +SPR KO | |
459 | +MSR KO | |
460 | +IRQ KO | |
461 | +MMU KO | |
462 | +EXCP KO | |
268 | 463 | |
269 | 464 | =============================================================================== |
270 | 465 | PowerPC microcontrollers emulation status | ... | ... |
target-ppc/cpu.h
... | ... | @@ -89,528 +89,89 @@ typedef uint32_t ppc_gpr_t; |
89 | 89 | #define DCACHE_LINE_SIZE 32 |
90 | 90 | |
91 | 91 | /*****************************************************************************/ |
92 | -/* PVR definitions for most known PowerPC */ | |
92 | +/* MMU model */ | |
93 | 93 | enum { |
94 | - /* PowerPC 401 cores */ | |
95 | - CPU_PPC_401A1 = 0x00210000, | |
96 | - CPU_PPC_401B2 = 0x00220000, | |
97 | -#if 0 | |
98 | - CPU_PPC_401B3 = xxx, | |
99 | -#endif | |
100 | - CPU_PPC_401C2 = 0x00230000, | |
101 | - CPU_PPC_401D2 = 0x00240000, | |
102 | - CPU_PPC_401E2 = 0x00250000, | |
103 | - CPU_PPC_401F2 = 0x00260000, | |
104 | - CPU_PPC_401G2 = 0x00270000, | |
105 | -#if 0 | |
106 | - CPU_PPC_401GF = xxx, | |
107 | -#endif | |
108 | -#define CPU_PPC_401 CPU_PPC_401G2 | |
109 | - CPU_PPC_IOP480 = 0x40100000, /* 401B2 ? */ | |
110 | - CPU_PPC_COBRA = 0x10100000, /* IBM Processor for Network Resources */ | |
111 | - /* PowerPC 403 cores */ | |
112 | - CPU_PPC_403GA = 0x00200011, | |
113 | - CPU_PPC_403GB = 0x00200100, | |
114 | - CPU_PPC_403GC = 0x00200200, | |
115 | - CPU_PPC_403GCX = 0x00201400, | |
116 | -#if 0 | |
117 | - CPU_PPC_403GP = xxx, | |
118 | -#endif | |
119 | -#define CPU_PPC_403 CPU_PPC_403GCX | |
120 | - /* PowerPC 405 cores */ | |
121 | -#if 0 | |
122 | - CPU_PPC_405A3 = xxx, | |
123 | -#endif | |
124 | -#if 0 | |
125 | - CPU_PPC_405A4 = xxx, | |
126 | -#endif | |
127 | -#if 0 | |
128 | - CPU_PPC_405B3 = xxx, | |
129 | -#endif | |
130 | - CPU_PPC_405D2 = 0x20010000, | |
131 | - CPU_PPC_405D4 = 0x41810000, | |
132 | - CPU_PPC_405CR = 0x40110145, | |
133 | -#define CPU_PPC_405GP CPU_PPC_405CR | |
134 | - CPU_PPC_405EP = 0x51210950, | |
135 | -#if 0 | |
136 | - CPU_PPC_405EZ = xxx, | |
137 | -#endif | |
138 | - CPU_PPC_405GPR = 0x50910951, | |
139 | -#if 0 | |
140 | - CPU_PPC_405LP = xxx, | |
141 | -#endif | |
142 | -#define CPU_PPC_405 CPU_PPC_405D4 | |
143 | - CPU_PPC_NPE405H = 0x414100C0, | |
144 | - CPU_PPC_NPE405H2 = 0x41410140, | |
145 | - CPU_PPC_NPE405L = 0x416100C0, | |
146 | -#if 0 | |
147 | - CPU_PPC_LC77700 = xxx, | |
148 | -#endif | |
149 | - /* IBM STBxxx (PowerPC 401/403/405 core based microcontrollers) */ | |
150 | -#if 0 | |
151 | - CPU_PPC_STB01000 = xxx, | |
152 | -#endif | |
153 | -#if 0 | |
154 | - CPU_PPC_STB01010 = xxx, | |
155 | -#endif | |
156 | -#if 0 | |
157 | - CPU_PPC_STB0210 = xxx, | |
158 | -#endif | |
159 | - CPU_PPC_STB03 = 0x40310000, | |
160 | -#if 0 | |
161 | - CPU_PPC_STB043 = xxx, | |
162 | -#endif | |
163 | -#if 0 | |
164 | - CPU_PPC_STB045 = xxx, | |
165 | -#endif | |
166 | - CPU_PPC_STB25 = 0x51510950, | |
167 | -#if 0 | |
168 | - CPU_PPC_STB130 = xxx, | |
169 | -#endif | |
170 | - /* Xilinx cores */ | |
171 | - CPU_PPC_X2VP4 = 0x20010820, | |
172 | -#define CPU_PPC_X2VP7 CPU_PPC_X2VP4 | |
173 | - CPU_PPC_X2VP20 = 0x20010860, | |
174 | -#define CPU_PPC_X2VP50 CPU_PPC_X2VP20 | |
175 | - /* PowerPC 440 cores */ | |
176 | - CPU_PPC_440EP = 0x422218D3, | |
177 | -#define CPU_PPC_440GR CPU_PPC_440EP | |
178 | - CPU_PPC_440GP = 0x40120481, | |
179 | -#if 0 | |
180 | - CPU_PPC_440GRX = xxx, | |
181 | -#endif | |
182 | - CPU_PPC_440GX = 0x51B21850, | |
183 | - CPU_PPC_440GXc = 0x51B21892, | |
184 | - CPU_PPC_440GXf = 0x51B21894, | |
185 | - CPU_PPC_440SP = 0x53221850, | |
186 | - CPU_PPC_440SP2 = 0x53221891, | |
187 | - CPU_PPC_440SPE = 0x53421890, | |
188 | - /* PowerPC 460 cores */ | |
189 | -#if 0 | |
190 | - CPU_PPC_464H90 = xxx, | |
191 | -#endif | |
192 | -#if 0 | |
193 | - CPU_PPC_464H90FP = xxx, | |
194 | -#endif | |
195 | - /* PowerPC MPC 5xx cores */ | |
196 | - CPU_PPC_5xx = 0x00020020, | |
197 | - /* PowerPC MPC 8xx cores (aka PowerQUICC) */ | |
198 | - CPU_PPC_8xx = 0x00500000, | |
199 | - /* PowerPC MPC 8xxx cores (aka PowerQUICC-II) */ | |
200 | - CPU_PPC_82xx_HIP3 = 0x00810101, | |
201 | - CPU_PPC_82xx_HIP4 = 0x80811014, | |
202 | - CPU_PPC_827x = 0x80822013, | |
203 | - /* eCores */ | |
204 | - CPU_PPC_e200 = 0x81120000, | |
205 | - CPU_PPC_e500v110 = 0x80200010, | |
206 | - CPU_PPC_e500v120 = 0x80200020, | |
207 | - CPU_PPC_e500v210 = 0x80210010, | |
208 | - CPU_PPC_e500v220 = 0x80210020, | |
209 | -#define CPU_PPC_e500 CPU_PPC_e500v220 | |
210 | - CPU_PPC_e600 = 0x80040010, | |
211 | - /* PowerPC 6xx cores */ | |
212 | - CPU_PPC_601 = 0x00010001, | |
213 | - CPU_PPC_602 = 0x00050100, | |
214 | - CPU_PPC_603 = 0x00030100, | |
215 | - CPU_PPC_603E = 0x00060101, | |
216 | - CPU_PPC_603P = 0x00070000, | |
217 | - CPU_PPC_603E7v = 0x00070100, | |
218 | - CPU_PPC_603E7v2 = 0x00070201, | |
219 | - CPU_PPC_603E7 = 0x00070200, | |
220 | - CPU_PPC_603R = 0x00071201, | |
221 | - CPU_PPC_G2 = 0x00810011, | |
222 | - CPU_PPC_G2H4 = 0x80811010, | |
223 | - CPU_PPC_G2gp = 0x80821010, | |
224 | - CPU_PPC_G2ls = 0x90810010, | |
225 | - CPU_PPC_G2LE = 0x80820010, | |
226 | - CPU_PPC_G2LEgp = 0x80822010, | |
227 | - CPU_PPC_G2LEls = 0xA0822010, | |
228 | - CPU_PPC_604 = 0x00040000, | |
229 | - CPU_PPC_604E = 0x00090100, /* Also 2110 & 2120 */ | |
230 | - CPU_PPC_604R = 0x000a0101, | |
231 | - /* PowerPC 74x/75x cores (aka G3) */ | |
232 | - CPU_PPC_74x = 0x00080000, | |
233 | - CPU_PPC_740E = 0x00080100, | |
234 | - CPU_PPC_74xP = 0x10080000, | |
235 | - CPU_PPC_750E = 0x00080200, | |
236 | - CPU_PPC_750CXE21 = 0x00082201, | |
237 | - CPU_PPC_750CXE22 = 0x00082212, | |
238 | - CPU_PPC_750CXE23 = 0x00082203, | |
239 | - CPU_PPC_750CXE24 = 0x00082214, | |
240 | - CPU_PPC_750CXE24b = 0x00083214, | |
241 | - CPU_PPC_750CXE31 = 0x00083211, | |
242 | - CPU_PPC_750CXE31b = 0x00083311, | |
243 | -#define CPU_PPC_750CXE CPU_PPC_750CXE31b | |
244 | - CPU_PPC_750CXR = 0x00083410, | |
245 | - CPU_PPC_750FX10 = 0x70000100, | |
246 | - CPU_PPC_750FX20 = 0x70000200, | |
247 | - CPU_PPC_750FX21 = 0x70000201, | |
248 | - CPU_PPC_750FX22 = 0x70000202, | |
249 | - CPU_PPC_750FX23 = 0x70000203, | |
250 | -#define CPU_PPC_750FX CPU_PPC_750FX23 | |
251 | - CPU_PPC_750FL = 0x700A0203, | |
252 | - CPU_PPC_750GX10 = 0x70020100, | |
253 | - CPU_PPC_750GX11 = 0x70020101, | |
254 | - CPU_PPC_750GX12 = 0x70020102, | |
255 | -#define CPU_PPC_750GX CPU_PPC_750GX12 | |
256 | - CPU_PPC_750GL = 0x70020102, | |
257 | - CPU_PPC_750L30 = 0x00088300, | |
258 | - CPU_PPC_750L32 = 0x00088302, | |
259 | -#define CPU_PPC_750L CPU_PPC_750L32 | |
260 | - CPU_PPC_750CL = 0x00087200, | |
261 | - CPU_PPC_755_10 = 0x00083100, | |
262 | - CPU_PPC_755_11 = 0x00083101, | |
263 | - CPU_PPC_755_20 = 0x00083200, | |
264 | - CPU_PPC_755D = 0x00083202, | |
265 | - CPU_PPC_755E = 0x00083203, | |
266 | -#define CPU_PPC_755 CPU_PPC_755E | |
267 | - /* PowerPC 74xx cores (aka G4) */ | |
268 | - CPU_PPC_7400 = 0x000C0100, | |
269 | - CPU_PPC_7410C = 0x800C1102, | |
270 | - CPU_PPC_7410D = 0x800C1103, | |
271 | - CPU_PPC_7410E = 0x800C1104, | |
272 | -#define CPU_PPC_7410 CPU_PPC_7410E | |
273 | - CPU_PPC_7441 = 0x80000210, | |
274 | - CPU_PPC_7445 = 0x80010100, | |
275 | - CPU_PPC_7447 = 0x80020100, | |
276 | - CPU_PPC_7447A = 0x80030101, | |
277 | - CPU_PPC_7448 = 0x80040100, | |
278 | - CPU_PPC_7450 = 0x80000200, | |
279 | - CPU_PPC_7450b = 0x80000201, | |
280 | - CPU_PPC_7451 = 0x80000203, | |
281 | - CPU_PPC_7451G = 0x80000210, | |
282 | - CPU_PPC_7455 = 0x80010201, | |
283 | - CPU_PPC_7455F = 0x80010303, | |
284 | - CPU_PPC_7455G = 0x80010304, | |
285 | - CPU_PPC_7457 = 0x80020101, | |
286 | - CPU_PPC_7457C = 0x80020102, | |
287 | - CPU_PPC_7457A = 0x80030000, | |
288 | - /* 64 bits PowerPC */ | |
289 | - CPU_PPC_620 = 0x00140000, | |
290 | - CPU_PPC_630 = 0x00400000, | |
291 | - CPU_PPC_631 = 0x00410000, | |
292 | - CPU_PPC_POWER4 = 0x00350000, | |
293 | - CPU_PPC_POWER4P = 0x00380000, | |
294 | - CPU_PPC_POWER5 = 0x003A0000, | |
295 | - CPU_PPC_POWER5P = 0x003B0000, | |
296 | -#if 0 | |
297 | - CPU_PPC_POWER6 = xxx, | |
298 | -#endif | |
299 | - CPU_PPC_970 = 0x00390000, | |
300 | - CPU_PPC_970FX10 = 0x00391100, | |
301 | - CPU_PPC_970FX20 = 0x003C0200, | |
302 | - CPU_PPC_970FX21 = 0x003C0201, | |
303 | - CPU_PPC_970FX30 = 0x003C0300, | |
304 | - CPU_PPC_970FX31 = 0x003C0301, | |
305 | -#define CPU_PPC_970FX CPU_PPC_970FX31 | |
306 | - CPU_PPC_970MP10 = 0x00440100, | |
307 | - CPU_PPC_970MP11 = 0x00440101, | |
308 | -#define CPU_PPC_970MP CPU_PPC_970MP11 | |
309 | - CPU_PPC_CELL10 = 0x00700100, | |
310 | - CPU_PPC_CELL20 = 0x00700400, | |
311 | - CPU_PPC_CELL30 = 0x00700500, | |
312 | - CPU_PPC_CELL31 = 0x00700501, | |
313 | -#define CPU_PPC_CELL32 CPU_PPC_CELL31 | |
314 | -#define CPU_PPC_CELL CPU_PPC_CELL32 | |
315 | - CPU_PPC_RS64 = 0x00330000, | |
316 | - CPU_PPC_RS64II = 0x00340000, | |
317 | - CPU_PPC_RS64III = 0x00360000, | |
318 | - CPU_PPC_RS64IV = 0x00370000, | |
319 | - /* Original POWER */ | |
320 | - /* XXX: should be POWER (RIOS), RSC3308, RSC4608, | |
321 | - * POWER2 (RIOS2) & RSC2 (P2SC) here | |
322 | - */ | |
323 | -#if 0 | |
324 | - CPU_POWER = xxx, | |
325 | -#endif | |
326 | -#if 0 | |
327 | - CPU_POWER2 = xxx, | |
328 | -#endif | |
329 | -}; | |
330 | - | |
331 | -/* System version register (used on MPC 8xxx) */ | |
332 | -enum { | |
333 | - PPC_SVR_8540 = 0x80300000, | |
334 | - PPC_SVR_8541E = 0x807A0010, | |
335 | - PPC_SVR_8543v10 = 0x80320010, | |
336 | - PPC_SVR_8543v11 = 0x80320011, | |
337 | - PPC_SVR_8543v20 = 0x80320020, | |
338 | - PPC_SVR_8543Ev10 = 0x803A0010, | |
339 | - PPC_SVR_8543Ev11 = 0x803A0011, | |
340 | - PPC_SVR_8543Ev20 = 0x803A0020, | |
341 | - PPC_SVR_8545 = 0x80310220, | |
342 | - PPC_SVR_8545E = 0x80390220, | |
343 | - PPC_SVR_8547E = 0x80390120, | |
344 | - PPC_SCR_8548v10 = 0x80310010, | |
345 | - PPC_SCR_8548v11 = 0x80310011, | |
346 | - PPC_SCR_8548v20 = 0x80310020, | |
347 | - PPC_SVR_8548Ev10 = 0x80390010, | |
348 | - PPC_SVR_8548Ev11 = 0x80390011, | |
349 | - PPC_SVR_8548Ev20 = 0x80390020, | |
350 | - PPC_SVR_8555E = 0x80790010, | |
351 | - PPC_SVR_8560v10 = 0x80700010, | |
352 | - PPC_SVR_8560v20 = 0x80700020, | |
94 | + POWERPC_MMU_UNKNOWN = 0, | |
95 | + /* Standard 32 bits PowerPC MMU */ | |
96 | + POWERPC_MMU_32B, | |
97 | + /* Standard 64 bits PowerPC MMU */ | |
98 | + POWERPC_MMU_64B, | |
99 | + /* PowerPC 601 MMU */ | |
100 | + POWERPC_MMU_601, | |
101 | + /* PowerPC 6xx MMU with software TLB */ | |
102 | + POWERPC_MMU_SOFT_6xx, | |
103 | + /* PowerPC 74xx MMU with software TLB */ | |
104 | + POWERPC_MMU_SOFT_74xx, | |
105 | + /* PowerPC 4xx MMU with software TLB */ | |
106 | + POWERPC_MMU_SOFT_4xx, | |
107 | + /* PowerPC 4xx MMU with software TLB and zones protections */ | |
108 | + POWERPC_MMU_SOFT_4xx_Z, | |
109 | + /* PowerPC 4xx MMU in real mode only */ | |
110 | + POWERPC_MMU_REAL_4xx, | |
111 | + /* BookE MMU model */ | |
112 | + POWERPC_MMU_BOOKE, | |
113 | + /* BookE FSL MMU model */ | |
114 | + POWERPC_MMU_BOOKE_FSL, | |
115 | + /* 64 bits "bridge" PowerPC MMU */ | |
116 | + POWERPC_MMU_64BRIDGE, | |
353 | 117 | }; |
354 | 118 | |
355 | 119 | /*****************************************************************************/ |
356 | -/* Instruction types */ | |
357 | -enum { | |
358 | - PPC_NONE = 0x00000000, | |
359 | - /* integer operations instructions */ | |
360 | - /* flow control instructions */ | |
361 | - /* virtual memory instructions */ | |
362 | - /* ld/st with reservation instructions */ | |
363 | - /* cache control instructions */ | |
364 | - /* spr/msr access instructions */ | |
365 | - PPC_INSNS_BASE = 0x0000000000000001ULL, | |
366 | -#define PPC_INTEGER PPC_INSNS_BASE | |
367 | -#define PPC_FLOW PPC_INSNS_BASE | |
368 | -#define PPC_MEM PPC_INSNS_BASE | |
369 | -#define PPC_RES PPC_INSNS_BASE | |
370 | -#define PPC_CACHE PPC_INSNS_BASE | |
371 | -#define PPC_MISC PPC_INSNS_BASE | |
372 | - /* floating point operations instructions */ | |
373 | - PPC_FLOAT = 0x0000000000000002ULL, | |
374 | - /* more floating point operations instructions */ | |
375 | - PPC_FLOAT_EXT = 0x0000000000000004ULL, | |
376 | - /* external control instructions */ | |
377 | - PPC_EXTERN = 0x0000000000000008ULL, | |
378 | - /* segment register access instructions */ | |
379 | - PPC_SEGMENT = 0x0000000000000010ULL, | |
380 | - /* Optional cache control instructions */ | |
381 | - PPC_CACHE_OPT = 0x0000000000000020ULL, | |
382 | - /* Optional floating point op instructions */ | |
383 | - PPC_FLOAT_OPT = 0x0000000000000040ULL, | |
384 | - /* Optional memory control instructions */ | |
385 | - PPC_MEM_TLBIA = 0x0000000000000080ULL, | |
386 | - PPC_MEM_TLBIE = 0x0000000000000100ULL, | |
387 | - PPC_MEM_TLBSYNC = 0x0000000000000200ULL, | |
388 | - /* eieio & sync */ | |
389 | - PPC_MEM_SYNC = 0x0000000000000400ULL, | |
390 | - /* PowerPC 6xx TLB management instructions */ | |
391 | - PPC_6xx_TLB = 0x0000000000000800ULL, | |
392 | - /* Altivec support */ | |
393 | - PPC_ALTIVEC = 0x0000000000001000ULL, | |
394 | - /* Time base support */ | |
395 | - PPC_TB = 0x0000000000002000ULL, | |
396 | - /* Embedded PowerPC dedicated instructions */ | |
397 | - PPC_EMB_COMMON = 0x0000000000004000ULL, | |
398 | - /* PowerPC 40x exception model */ | |
399 | - PPC_40x_EXCP = 0x0000000000008000ULL, | |
400 | - /* PowerPC 40x specific instructions */ | |
401 | - PPC_40x_SPEC = 0x0000000000010000ULL, | |
402 | - /* PowerPC 405 Mac instructions */ | |
403 | - PPC_405_MAC = 0x0000000000020000ULL, | |
404 | - /* PowerPC 440 specific instructions */ | |
405 | - PPC_440_SPEC = 0x0000000000040000ULL, | |
406 | - /* Specific extensions */ | |
407 | - /* Power-to-PowerPC bridge (601) */ | |
408 | - PPC_POWER_BR = 0x0000000000080000ULL, | |
409 | - /* PowerPC 602 specific */ | |
410 | - PPC_602_SPEC = 0x0000000000100000ULL, | |
411 | - /* Deprecated instructions */ | |
412 | - /* Original POWER instruction set */ | |
413 | - PPC_POWER = 0x0000000000200000ULL, | |
414 | - /* POWER2 instruction set extension */ | |
415 | - PPC_POWER2 = 0x0000000000400000ULL, | |
416 | - /* Power RTC support */ | |
417 | - PPC_POWER_RTC = 0x0000000000800000ULL, | |
418 | - /* 64 bits PowerPC instructions */ | |
419 | - /* 64 bits PowerPC instruction set */ | |
420 | - PPC_64B = 0x0000000001000000ULL, | |
421 | - /* 64 bits hypervisor extensions */ | |
422 | - PPC_64H = 0x0000000002000000ULL, | |
423 | - /* 64 bits PowerPC "bridge" features */ | |
424 | - PPC_64_BRIDGE = 0x0000000004000000ULL, | |
425 | - /* BookE (embedded) PowerPC specification */ | |
426 | - PPC_BOOKE = 0x0000000008000000ULL, | |
427 | - /* eieio */ | |
428 | - PPC_MEM_EIEIO = 0x0000000010000000ULL, | |
429 | - /* e500 vector instructions */ | |
430 | - PPC_E500_VECTOR = 0x0000000020000000ULL, | |
431 | - /* PowerPC 4xx dedicated instructions */ | |
432 | - PPC_4xx_COMMON = 0x0000000040000000ULL, | |
433 | - /* PowerPC 2.03 specification extensions */ | |
434 | - PPC_203 = 0x0000000080000000ULL, | |
435 | - /* PowerPC 2.03 SPE extension */ | |
436 | - PPC_SPE = 0x0000000100000000ULL, | |
437 | - /* PowerPC 2.03 SPE floating-point extension */ | |
438 | - PPC_SPEFPU = 0x0000000200000000ULL, | |
439 | - /* SLB management */ | |
440 | - PPC_SLBI = 0x0000000400000000ULL, | |
441 | - /* PowerPC 40x ibct instructions */ | |
442 | - PPC_40x_ICBT = 0x0000000800000000ULL, | |
443 | -}; | |
444 | - | |
445 | -/* CPU run-time flags (MMU and exception model) */ | |
120 | +/* Exception model */ | |
446 | 121 | enum { |
447 | - /* MMU model */ | |
448 | - PPC_FLAGS_MMU_MASK = 0x000000FF, | |
449 | - /* Standard 32 bits PowerPC MMU */ | |
450 | - PPC_FLAGS_MMU_32B = 0x00000000, | |
451 | - /* Standard 64 bits PowerPC MMU */ | |
452 | - PPC_FLAGS_MMU_64B = 0x00000001, | |
453 | - /* PowerPC 601 MMU */ | |
454 | - PPC_FLAGS_MMU_601 = 0x00000002, | |
455 | - /* PowerPC 6xx MMU with software TLB */ | |
456 | - PPC_FLAGS_MMU_SOFT_6xx = 0x00000003, | |
457 | - /* PowerPC 4xx MMU with software TLB */ | |
458 | - PPC_FLAGS_MMU_SOFT_4xx = 0x00000004, | |
459 | - /* PowerPC 403 MMU */ | |
460 | - PPC_FLAGS_MMU_403 = 0x00000005, | |
461 | - /* BookE FSL MMU model */ | |
462 | - PPC_FLAGS_MMU_BOOKE_FSL = 0x00000006, | |
463 | - /* BookE MMU model */ | |
464 | - PPC_FLAGS_MMU_BOOKE = 0x00000007, | |
465 | - /* 64 bits "bridge" PowerPC MMU */ | |
466 | - PPC_FLAGS_MMU_64BRIDGE = 0x00000008, | |
467 | - /* PowerPC 401 MMU (real mode only) */ | |
468 | - PPC_FLAGS_MMU_401 = 0x00000009, | |
469 | - /* Exception model */ | |
470 | - PPC_FLAGS_EXCP_MASK = 0x0000FF00, | |
122 | + POWERPC_EXCP_UNKNOWN = 0, | |
471 | 123 | /* Standard PowerPC exception model */ |
472 | - PPC_FLAGS_EXCP_STD = 0x00000000, | |
124 | + POWERPC_EXCP_STD, | |
473 | 125 | /* PowerPC 40x exception model */ |
474 | - PPC_FLAGS_EXCP_40x = 0x00000100, | |
126 | + POWERPC_EXCP_40x, | |
475 | 127 | /* PowerPC 601 exception model */ |
476 | - PPC_FLAGS_EXCP_601 = 0x00000200, | |
128 | + POWERPC_EXCP_601, | |
477 | 129 | /* PowerPC 602 exception model */ |
478 | - PPC_FLAGS_EXCP_602 = 0x00000300, | |
130 | + POWERPC_EXCP_602, | |
479 | 131 | /* PowerPC 603 exception model */ |
480 | - PPC_FLAGS_EXCP_603 = 0x00000400, | |
132 | + POWERPC_EXCP_603, | |
133 | + /* PowerPC 603e exception model */ | |
134 | + POWERPC_EXCP_603E, | |
135 | + /* PowerPC G2 exception model */ | |
136 | + POWERPC_EXCP_G2, | |
481 | 137 | /* PowerPC 604 exception model */ |
482 | - PPC_FLAGS_EXCP_604 = 0x00000500, | |
138 | + POWERPC_EXCP_604, | |
483 | 139 | /* PowerPC 7x0 exception model */ |
484 | - PPC_FLAGS_EXCP_7x0 = 0x00000600, | |
140 | + POWERPC_EXCP_7x0, | |
485 | 141 | /* PowerPC 7x5 exception model */ |
486 | - PPC_FLAGS_EXCP_7x5 = 0x00000700, | |
142 | + POWERPC_EXCP_7x5, | |
487 | 143 | /* PowerPC 74xx exception model */ |
488 | - PPC_FLAGS_EXCP_74xx = 0x00000800, | |
144 | + POWERPC_EXCP_74xx, | |
489 | 145 | /* PowerPC 970 exception model */ |
490 | - PPC_FLAGS_EXCP_970 = 0x00000900, | |
146 | + POWERPC_EXCP_970, | |
491 | 147 | /* BookE exception model */ |
492 | - PPC_FLAGS_EXCP_BOOKE = 0x00000A00, | |
493 | - /* Input pins model */ | |
494 | - PPC_FLAGS_INPUT_MASK = 0x000F0000, | |
148 | + POWERPC_EXCP_BOOKE, | |
149 | +}; | |
150 | + | |
151 | +/*****************************************************************************/ | |
152 | +/* Input pins model */ | |
153 | +enum { | |
154 | + PPC_FLAGS_INPUT_UNKNOWN = 0, | |
495 | 155 | /* PowerPC 6xx bus */ |
496 | - PPC_FLAGS_INPUT_6xx = 0x00000000, | |
156 | + PPC_FLAGS_INPUT_6xx, | |
497 | 157 | /* BookE bus */ |
498 | - PPC_FLAGS_INPUT_BookE = 0x00010000, | |
499 | - /* PowerPC 4xx bus */ | |
500 | - PPC_FLAGS_INPUT_40x = 0x00020000, | |
158 | + PPC_FLAGS_INPUT_BookE, | |
159 | + /* PowerPC 405 bus */ | |
160 | + PPC_FLAGS_INPUT_405, | |
501 | 161 | /* PowerPC 970 bus */ |
502 | - PPC_FLAGS_INPUT_970 = 0x00030000, | |
162 | + PPC_FLAGS_INPUT_970, | |
163 | + /* PowerPC 401 bus */ | |
164 | + PPC_FLAGS_INPUT_401, | |
503 | 165 | }; |
504 | 166 | |
505 | -#define PPC_MMU(env) (env->flags & PPC_FLAGS_MMU_MASK) | |
506 | -#define PPC_EXCP(env) (env->flags & PPC_FLAGS_EXCP_MASK) | |
507 | -#define PPC_INPUT(env) (env->flags & PPC_FLAGS_INPUT_MASK) | |
167 | +#define PPC_INPUT(env) (env->bus_model) | |
508 | 168 | |
509 | -/*****************************************************************************/ | |
510 | -/* Supported instruction set definitions */ | |
511 | -/* This generates an empty opcode table... */ | |
512 | -#define PPC_INSNS_TODO (PPC_NONE) | |
513 | -#define PPC_FLAGS_TODO (0x00000000) | |
514 | - | |
515 | -/* PowerPC 40x instruction set */ | |
516 | -#define PPC_INSNS_EMB (PPC_INSNS_BASE | PPC_EMB_COMMON) | |
517 | -/* PowerPC 401 */ | |
518 | -#define PPC_INSNS_401 (PPC_INSNS_EMB | PPC_MEM_SYNC | PPC_MEM_EIEIO | \ | |
519 | - PPC_4xx_COMMON | PPC_40x_EXCP | PPC_40x_ICBT) | |
520 | -#define PPC_FLAGS_401 (PPC_FLAGS_MMU_401 | PPC_FLAGS_EXCP_40x | \ | |
521 | - PPC_FLAGS_INPUT_40x) | |
522 | -/* PowerPC 403 */ | |
523 | -#define PPC_INSNS_403 (PPC_INSNS_EMB | PPC_MEM_SYNC | PPC_MEM_EIEIO | \ | |
524 | - PPC_MEM_TLBIA | PPC_MEM_TLBSYNC | PPC_4xx_COMMON | \ | |
525 | - PPC_40x_EXCP | PPC_40x_SPEC | PPC_40x_ICBT) | |
526 | -#define PPC_FLAGS_403 (PPC_FLAGS_MMU_403 | PPC_FLAGS_EXCP_40x | \ | |
527 | - PPC_FLAGS_INPUT_40x) | |
528 | -/* PowerPC 405 */ | |
529 | -#define PPC_INSNS_405 (PPC_INSNS_EMB | PPC_MEM_SYNC | PPC_MEM_EIEIO | \ | |
530 | - PPC_CACHE_OPT | PPC_MEM_TLBIA | PPC_MEM_TLBSYNC | \ | |
531 | - PPC_TB | PPC_4xx_COMMON | PPC_40x_SPEC | \ | |
532 | - PPC_40x_ICBT | PPC_40x_EXCP | PPC_405_MAC) | |
533 | -#define PPC_FLAGS_405 (PPC_FLAGS_MMU_SOFT_4xx | PPC_FLAGS_EXCP_40x | \ | |
534 | - PPC_FLAGS_INPUT_40x) | |
535 | -/* PowerPC 440 */ | |
536 | -#define PPC_INSNS_440 (PPC_INSNS_EMB | PPC_CACHE_OPT | PPC_BOOKE | \ | |
537 | - PPC_MEM_TLBSYNC | PPC_4xx_COMMON | PPC_405_MAC | \ | |
538 | - PPC_440_SPEC) | |
539 | -#define PPC_FLAGS_440 (PPC_FLAGS_MMU_BOOKE | PPC_FLAGS_EXCP_BOOKE | \ | |
540 | - PPC_FLAGS_INPUT_BookE) | |
541 | -/* Generic BookE PowerPC */ | |
542 | -#define PPC_INSNS_BOOKE (PPC_INSNS_EMB | PPC_MEM_TLBSYNC | PPC_BOOKE | \ | |
543 | - PPC_MEM_EIEIO | PPC_FLOAT | PPC_FLOAT_OPT | \ | |
544 | - PPC_CACHE_OPT) | |
545 | -#define PPC_FLAGS_BOOKE (PPC_FLAGS_MMU_BOOKE | PPC_FLAGS_EXCP_BOOKE | \ | |
546 | - PPC_FLAGS_INPUT_BookE) | |
547 | -/* e500 core */ | |
548 | -#define PPC_INSNS_E500 (PPC_INSNS_EMB | PPC_MEM_TLBSYNC | PPC_BOOKE | \ | |
549 | - PPC_MEM_EIEIO | PPC_CACHE_OPT | PPC_E500_VECTOR) | |
550 | -#define PPC_FLAGS_E500 (PPC_FLAGS_MMU_SOFT_4xx | PPC_FLAGS_EXCP_40x | \ | |
551 | - PPC_FLAGS_INPUT_BookE) | |
552 | -/* Non-embedded PowerPC */ | |
553 | -#define PPC_INSNS_COMMON (PPC_INSNS_BASE | PPC_FLOAT | PPC_MEM_SYNC | \ | |
554 | - PPC_MEM_EIEIO | PPC_SEGMENT | PPC_MEM_TLBIE) | |
555 | -/* PowerPC 601 */ | |
556 | -#define PPC_INSNS_601 (PPC_INSNS_COMMON | PPC_EXTERN | PPC_POWER_BR) | |
557 | -#define PPC_FLAGS_601 (PPC_FLAGS_MMU_601 | PPC_FLAGS_EXCP_601 | \ | |
558 | - PPC_FLAGS_INPUT_6xx) | |
559 | -/* PowerPC 602 */ | |
560 | -#define PPC_INSNS_602 (PPC_INSNS_COMMON | PPC_FLOAT_EXT | PPC_6xx_TLB | \ | |
561 | - PPC_MEM_TLBSYNC | PPC_TB | PPC_602_SPEC) | |
562 | -#define PPC_FLAGS_602 (PPC_FLAGS_MMU_SOFT_6xx | PPC_FLAGS_EXCP_602 | \ | |
563 | - PPC_FLAGS_INPUT_6xx) | |
564 | -/* PowerPC 603 */ | |
565 | -#define PPC_INSNS_603 (PPC_INSNS_COMMON | PPC_FLOAT_EXT | PPC_6xx_TLB | \ | |
566 | - PPC_MEM_TLBSYNC | PPC_EXTERN | PPC_TB) | |
567 | -#define PPC_FLAGS_603 (PPC_FLAGS_MMU_SOFT_6xx | PPC_FLAGS_EXCP_603 | \ | |
568 | - PPC_FLAGS_INPUT_6xx) | |
569 | -/* PowerPC G2 */ | |
570 | -#define PPC_INSNS_G2 (PPC_INSNS_COMMON | PPC_FLOAT_EXT | PPC_6xx_TLB | \ | |
571 | - PPC_MEM_TLBSYNC | PPC_EXTERN | PPC_TB) | |
572 | -#define PPC_FLAGS_G2 (PPC_FLAGS_MMU_SOFT_6xx | PPC_FLAGS_EXCP_603 | \ | |
573 | - PPC_FLAGS_INPUT_6xx) | |
574 | -/* PowerPC 604 */ | |
575 | -#define PPC_INSNS_604 (PPC_INSNS_COMMON | PPC_FLOAT_EXT | PPC_EXTERN | \ | |
576 | - PPC_MEM_TLBSYNC | PPC_TB) | |
577 | -#define PPC_FLAGS_604 (PPC_FLAGS_MMU_32B | PPC_FLAGS_EXCP_604 | \ | |
578 | - PPC_FLAGS_INPUT_6xx) | |
579 | -/* PowerPC 740/750 (aka G3) */ | |
580 | -#define PPC_INSNS_7x0 (PPC_INSNS_COMMON | PPC_FLOAT_EXT | PPC_EXTERN | \ | |
581 | - PPC_MEM_TLBSYNC | PPC_TB) | |
582 | -#define PPC_FLAGS_7x0 (PPC_FLAGS_MMU_32B | PPC_FLAGS_EXCP_7x0 | \ | |
583 | - PPC_FLAGS_INPUT_6xx) | |
584 | -/* PowerPC 745/755 */ | |
585 | -#define PPC_INSNS_7x5 (PPC_INSNS_COMMON | PPC_FLOAT_EXT | PPC_EXTERN | \ | |
586 | - PPC_MEM_TLBSYNC | PPC_TB | PPC_6xx_TLB) | |
587 | -#define PPC_FLAGS_7x5 (PPC_FLAGS_MMU_SOFT_6xx | PPC_FLAGS_EXCP_7x5 | \ | |
588 | - PPC_FLAGS_INPUT_6xx) | |
589 | -/* PowerPC 74xx (aka G4) */ | |
590 | -#define PPC_INSNS_74xx (PPC_INSNS_COMMON | PPC_FLOAT_EXT | PPC_ALTIVEC | \ | |
591 | - PPC_MEM_TLBSYNC | PPC_TB) | |
592 | -#define PPC_FLAGS_74xx (PPC_FLAGS_MMU_32B | PPC_FLAGS_EXCP_74xx | \ | |
593 | - PPC_FLAGS_INPUT_6xx) | |
594 | -/* PowerPC 970 (aka G5) */ | |
595 | -#define PPC_INSNS_970 (PPC_INSNS_COMMON | PPC_FLOAT_EXT | PPC_FLOAT_OPT | \ | |
596 | - PPC_ALTIVEC | PPC_MEM_TLBSYNC | PPC_TB | \ | |
597 | - PPC_64B | PPC_64_BRIDGE | PPC_SLBI) | |
598 | -#define PPC_FLAGS_970 (PPC_FLAGS_MMU_64BRIDGE | PPC_FLAGS_EXCP_970 | \ | |
599 | - PPC_FLAGS_INPUT_970) | |
600 | - | |
601 | -/* Default PowerPC will be 604/970 */ | |
602 | -#define PPC_INSNS_PPC32 PPC_INSNS_604 | |
603 | -#define PPC_FLAGS_PPC32 PPC_FLAGS_604 | |
604 | -#define PPC_INSNS_PPC64 PPC_INSNS_970 | |
605 | -#define PPC_FLAGS_PPC64 PPC_FLAGS_970 | |
606 | -#define PPC_INSNS_DEFAULT PPC_INSNS_604 | |
607 | -#define PPC_FLAGS_DEFAULT PPC_FLAGS_604 | |
608 | 169 | typedef struct ppc_def_t ppc_def_t; |
170 | +typedef struct opc_handler_t opc_handler_t; | |
609 | 171 | |
610 | 172 | /*****************************************************************************/ |
611 | 173 | /* Types used to describe some PowerPC registers */ |
612 | 174 | typedef struct CPUPPCState CPUPPCState; |
613 | -typedef struct opc_handler_t opc_handler_t; | |
614 | 175 | typedef struct ppc_tb_t ppc_tb_t; |
615 | 176 | typedef struct ppc_spr_t ppc_spr_t; |
616 | 177 | typedef struct ppc_dcr_t ppc_dcr_t; |
... | ... | @@ -832,7 +393,11 @@ struct CPUPPCState { |
832 | 393 | |
833 | 394 | /* Those resources are used during exception processing */ |
834 | 395 | /* CPU model definition */ |
835 | - uint64_t msr_mask; | |
396 | + target_ulong msr_mask; | |
397 | + uint8_t mmu_model; | |
398 | + uint8_t excp_model; | |
399 | + uint8_t bus_model; | |
400 | + uint8_t pad; | |
836 | 401 | uint32_t flags; |
837 | 402 | |
838 | 403 | int exception_index; |
... | ... | @@ -985,7 +550,7 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val); |
985 | 550 | #define SPR_LR (0x008) |
986 | 551 | #define SPR_CTR (0x009) |
987 | 552 | #define SPR_DSISR (0x012) |
988 | -#define SPR_DAR (0x013) | |
553 | +#define SPR_DAR (0x013) /* DAE for PowerPC 601 */ | |
989 | 554 | #define SPR_601_RTCU (0x014) |
990 | 555 | #define SPR_601_RTCL (0x015) |
991 | 556 | #define SPR_DECR (0x016) |
... | ... | @@ -1203,6 +768,8 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val); |
1203 | 768 | #define SPR_440_ITV1 (0x375) |
1204 | 769 | #define SPR_440_ITV2 (0x376) |
1205 | 770 | #define SPR_440_ITV3 (0x377) |
771 | +#define SPR_440_CCR1 (0x378) | |
772 | +#define SPR_DCRIPR (0x37B) | |
1206 | 773 | #define SPR_PPR (0x380) |
1207 | 774 | #define SPR_440_DNV0 (0x390) |
1208 | 775 | #define SPR_440_DNV1 (0x391) |
... | ... | @@ -1219,38 +786,63 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val); |
1219 | 786 | #define SPR_BOOKE_DCDBTRH (0x39D) |
1220 | 787 | #define SPR_BOOKE_ICDBTRL (0x39E) |
1221 | 788 | #define SPR_BOOKE_ICDBTRH (0x39F) |
789 | +#define SPR_UMMCR2 (0x3A0) | |
790 | +#define SPR_UPMC5 (0x3A1) | |
791 | +#define SPR_UPMC6 (0x3A2) | |
792 | +#define SPR_UBAMR (0x3A7) | |
1222 | 793 | #define SPR_UMMCR0 (0x3A8) |
1223 | 794 | #define SPR_UPMC1 (0x3A9) |
1224 | 795 | #define SPR_UPMC2 (0x3AA) |
1225 | -#define SPR_USIA (0x3AB) | |
796 | +#define SPR_USIAR (0x3AB) | |
1226 | 797 | #define SPR_UMMCR1 (0x3AC) |
1227 | 798 | #define SPR_UPMC3 (0x3AD) |
1228 | 799 | #define SPR_UPMC4 (0x3AE) |
1229 | 800 | #define SPR_USDA (0x3AF) |
1230 | 801 | #define SPR_40x_ZPR (0x3B0) |
1231 | 802 | #define SPR_BOOKE_MAS7 (0x3B0) |
803 | +#define SPR_620_PMR0 (0x3B0) | |
804 | +#define SPR_MMCR2 (0x3B0) | |
805 | +#define SPR_PMC5 (0x3B1) | |
1232 | 806 | #define SPR_40x_PID (0x3B1) |
807 | +#define SPR_620_PMR1 (0x3B1) | |
808 | +#define SPR_PMC6 (0x3B2) | |
1233 | 809 | #define SPR_440_MMUCR (0x3B2) |
810 | +#define SPR_620_PMR2 (0x3B2) | |
1234 | 811 | #define SPR_4xx_CCR0 (0x3B3) |
1235 | 812 | #define SPR_BOOKE_EPLC (0x3B3) |
813 | +#define SPR_620_PMR3 (0x3B3) | |
1236 | 814 | #define SPR_405_IAC3 (0x3B4) |
1237 | 815 | #define SPR_BOOKE_EPSC (0x3B4) |
816 | +#define SPR_620_PMR4 (0x3B4) | |
1238 | 817 | #define SPR_405_IAC4 (0x3B5) |
818 | +#define SPR_620_PMR5 (0x3B5) | |
1239 | 819 | #define SPR_405_DVC1 (0x3B6) |
820 | +#define SPR_620_PMR6 (0x3B6) | |
1240 | 821 | #define SPR_405_DVC2 (0x3B7) |
822 | +#define SPR_620_PMR7 (0x3B7) | |
823 | +#define SPR_BAMR (0x3B7) | |
1241 | 824 | #define SPR_MMCR0 (0x3B8) |
825 | +#define SPR_620_PMR8 (0x3B8) | |
1242 | 826 | #define SPR_PMC1 (0x3B9) |
1243 | 827 | #define SPR_40x_SGR (0x3B9) |
828 | +#define SPR_620_PMR9 (0x3B9) | |
1244 | 829 | #define SPR_PMC2 (0x3BA) |
1245 | 830 | #define SPR_40x_DCWR (0x3BA) |
1246 | -#define SPR_SIA (0x3BB) | |
831 | +#define SPR_620_PMRA (0x3BA) | |
832 | +#define SPR_SIAR (0x3BB) | |
1247 | 833 | #define SPR_405_SLER (0x3BB) |
834 | +#define SPR_620_PMRB (0x3BB) | |
1248 | 835 | #define SPR_MMCR1 (0x3BC) |
1249 | 836 | #define SPR_405_SU0R (0x3BC) |
837 | +#define SPR_620_PMRC (0x3BC) | |
838 | +#define SPR_401_SKR (0x3BC) | |
1250 | 839 | #define SPR_PMC3 (0x3BD) |
1251 | 840 | #define SPR_405_DBCR1 (0x3BD) |
841 | +#define SPR_620_PMRD (0x3BD) | |
1252 | 842 | #define SPR_PMC4 (0x3BE) |
843 | +#define SPR_620_PMRE (0x3BE) | |
1253 | 844 | #define SPR_SDA (0x3BF) |
845 | +#define SPR_620_PMRF (0x3BF) | |
1254 | 846 | #define SPR_403_VTBL (0x3CC) |
1255 | 847 | #define SPR_403_VTBU (0x3CD) |
1256 | 848 | #define SPR_DMISS (0x3D0) |
... | ... | @@ -1258,18 +850,23 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val); |
1258 | 850 | #define SPR_HASH1 (0x3D2) |
1259 | 851 | #define SPR_HASH2 (0x3D3) |
1260 | 852 | #define SPR_BOOKE_ICDBDR (0x3D3) |
853 | +#define SPR_TLBMISS (0x3D4) | |
1261 | 854 | #define SPR_IMISS (0x3D4) |
1262 | 855 | #define SPR_40x_ESR (0x3D4) |
856 | +#define SPR_PTEHI (0x3D5) | |
1263 | 857 | #define SPR_ICMP (0x3D5) |
1264 | 858 | #define SPR_40x_DEAR (0x3D5) |
859 | +#define SPR_PTELO (0x3D6) | |
1265 | 860 | #define SPR_RPA (0x3D6) |
1266 | 861 | #define SPR_40x_EVPR (0x3D6) |
862 | +#define SPR_L3PM (0x3D7) | |
1267 | 863 | #define SPR_403_CDBCR (0x3D7) |
864 | +#define SPR_L3OHCR (0x3D8) | |
1268 | 865 | #define SPR_TCR (0x3D8) |
1269 | 866 | #define SPR_40x_TSR (0x3D8) |
1270 | 867 | #define SPR_IBR (0x3DA) |
1271 | 868 | #define SPR_40x_TCR (0x3DA) |
1272 | -#define SPR_ESASR (0x3DB) | |
869 | +#define SPR_ESASRR (0x3DB) | |
1273 | 870 | #define SPR_40x_PIT (0x3DB) |
1274 | 871 | #define SPR_403_TBL (0x3DC) |
1275 | 872 | #define SPR_403_TBU (0x3DD) |
... | ... | @@ -1277,6 +874,10 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val); |
1277 | 874 | #define SPR_40x_SRR2 (0x3DE) |
1278 | 875 | #define SPR_SER (0x3DF) |
1279 | 876 | #define SPR_40x_SRR3 (0x3DF) |
877 | +#define SPR_L3ITCR0 (0x3E8) | |
878 | +#define SPR_L3ITCR1 (0x3E9) | |
879 | +#define SPR_L3ITCR2 (0x3EA) | |
880 | +#define SPR_L3ITCR3 (0x3EB) | |
1280 | 881 | #define SPR_HID0 (0x3F0) |
1281 | 882 | #define SPR_40x_DBSR (0x3F0) |
1282 | 883 | #define SPR_HID1 (0x3F1) |
... | ... | @@ -1284,9 +885,11 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val); |
1284 | 885 | #define SPR_40x_DBCR0 (0x3F2) |
1285 | 886 | #define SPR_601_HID2 (0x3F2) |
1286 | 887 | #define SPR_E500_L1CSR0 (0x3F2) |
888 | +#define SPR_ICTRL (0x3F3) | |
1287 | 889 | #define SPR_HID2 (0x3F3) |
1288 | 890 | #define SPR_E500_L1CSR1 (0x3F3) |
1289 | 891 | #define SPR_440_DBDR (0x3F3) |
892 | +#define SPR_LDSTDB (0x3F4) | |
1290 | 893 | #define SPR_40x_IAC1 (0x3F4) |
1291 | 894 | #define SPR_BOOKE_MMUCSR0 (0x3F4) |
1292 | 895 | #define SPR_DABR (0x3F5) |
... | ... | @@ -1295,12 +898,18 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val); |
1295 | 898 | #define SPR_40x_IAC2 (0x3F5) |
1296 | 899 | #define SPR_601_HID5 (0x3F5) |
1297 | 900 | #define SPR_40x_DAC1 (0x3F6) |
901 | +#define SPR_MSSCR0 (0x3F6) | |
902 | +#define SPR_MSSSR0 (0x3F7) | |
1298 | 903 | #define SPR_DABRX (0x3F7) |
1299 | 904 | #define SPR_40x_DAC2 (0x3F7) |
1300 | 905 | #define SPR_BOOKE_MMUCFG (0x3F7) |
1301 | -#define SPR_L2PM (0x3F8) | |
906 | +#define SPR_LDSTCR (0x3F8) | |
907 | +#define SPR_L2PMCR (0x3F8) | |
1302 | 908 | #define SPR_750_HID2 (0x3F8) |
909 | +#define SPR_620_HID8 (0x3F8) | |
1303 | 910 | #define SPR_L2CR (0x3F9) |
911 | +#define SPR_620_HID9 (0x3F9) | |
912 | +#define SPR_L3CR (0x3FA) | |
1304 | 913 | #define SPR_IABR2 (0x3FA) |
1305 | 914 | #define SPR_40x_DCCR (0x3FA) |
1306 | 915 | #define SPR_ICTC (0x3FB) |
... | ... | @@ -1310,6 +919,7 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val); |
1310 | 919 | #define SPR_SP (0x3FD) |
1311 | 920 | #define SPR_THRM2 (0x3FD) |
1312 | 921 | #define SPR_403_PBU1 (0x3FD) |
922 | +#define SPR_604_HID13 (0x3FD) | |
1313 | 923 | #define SPR_LT (0x3FE) |
1314 | 924 | #define SPR_THRM3 (0x3FE) |
1315 | 925 | #define SPR_FPECR (0x3FE) |
... | ... | @@ -1317,6 +927,7 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val); |
1317 | 927 | #define SPR_PIR (0x3FF) |
1318 | 928 | #define SPR_403_PBU2 (0x3FF) |
1319 | 929 | #define SPR_601_HID15 (0x3FF) |
930 | +#define SPR_604_HID15 (0x3FF) | |
1320 | 931 | #define SPR_E500_SVR (0x3FF) |
1321 | 932 | |
1322 | 933 | /*****************************************************************************/ |
... | ... | @@ -1367,6 +978,11 @@ enum { |
1367 | 978 | #define EXCP_40x_DEBUG 0x2000 /* Debug exception */ |
1368 | 979 | /* 405 specific exceptions */ |
1369 | 980 | #define EXCP_405_APU 0x0F20 /* APU unavailable exception */ |
981 | +/* 440 specific exceptions */ | |
982 | +#define EXCP_440_CRIT 0x0100 /* Critical interrupt */ | |
983 | +#define EXCP_440_SPEU 0x1600 /* SPE unavailable exception */ | |
984 | +#define EXCP_440_SPED 0x1700 /* SPE floating-point data exception */ | |
985 | +#define EXCP_440_SPER 0x1800 /* SPE floating-point round exception */ | |
1370 | 986 | /* TLB assist exceptions (602/603) */ |
1371 | 987 | #define EXCP_I_TLBMISS 0x1000 /* Instruction TLB miss */ |
1372 | 988 | #define EXCP_DL_TLBMISS 0x1100 /* Data load TLB miss */ |
... | ... | @@ -1377,7 +993,7 @@ enum { |
1377 | 993 | /* Altivec related exceptions */ |
1378 | 994 | #define EXCP_VPU 0x0F20 /* VPU unavailable exception */ |
1379 | 995 | /* 601 specific exceptions */ |
1380 | -#define EXCP_601_IO 0x0600 /* IO error exception */ | |
996 | +#define EXCP_601_IO 0x0A00 /* IO error exception */ | |
1381 | 997 | #define EXCP_601_RUNM 0x2000 /* Run mode exception */ |
1382 | 998 | /* 602 specific exceptions */ |
1383 | 999 | #define EXCP_602_WATCHDOG 0x1500 /* Watchdog exception */ |
... | ... | @@ -1468,6 +1084,15 @@ enum { |
1468 | 1084 | }; |
1469 | 1085 | |
1470 | 1086 | enum { |
1087 | + /* PowerPC 401/403 input pins */ | |
1088 | + PPC401_INPUT_RESET = 0, | |
1089 | + PPC401_INPUT_CINT = 1, | |
1090 | + PPC401_INPUT_INT = 2, | |
1091 | + PPC401_INPUT_BERR = 3, | |
1092 | + PPC401_INPUT_HALT = 4, | |
1093 | +}; | |
1094 | + | |
1095 | +enum { | |
1471 | 1096 | /* PowerPC 405 input pins */ |
1472 | 1097 | PPC405_INPUT_RESET_CORE = 0, |
1473 | 1098 | PPC405_INPUT_RESET_CHIP = 1, |
... | ... | @@ -1479,6 +1104,18 @@ enum { |
1479 | 1104 | }; |
1480 | 1105 | |
1481 | 1106 | enum { |
1107 | + /* PowerPC 620 (and probably others) input pins */ | |
1108 | + PPC620_INPUT_HRESET = 0, | |
1109 | + PPC620_INPUT_SRESET = 1, | |
1110 | + PPC620_INPUT_CKSTP = 2, | |
1111 | + PPC620_INPUT_TBEN = 3, | |
1112 | + PPC620_INPUT_WAKEUP = 4, | |
1113 | + PPC620_INPUT_MCP = 5, | |
1114 | + PPC620_INPUT_SMI = 6, | |
1115 | + PPC620_INPUT_INT = 7, | |
1116 | +}; | |
1117 | + | |
1118 | +enum { | |
1482 | 1119 | /* PowerPC 970 input pins */ |
1483 | 1120 | PPC970_INPUT_HRESET = 0, |
1484 | 1121 | PPC970_INPUT_SRESET = 1, | ... | ... |
target-ppc/exec.h
... | ... | @@ -106,6 +106,8 @@ void ppc6xx_tlb_invalidate_virt (CPUState *env, target_ulong eaddr, |
106 | 106 | void ppc6xx_tlb_store (CPUState *env, target_ulong EPN, int way, int is_code, |
107 | 107 | target_ulong pte0, target_ulong pte1); |
108 | 108 | void ppc4xx_tlb_invalidate_all (CPUState *env); |
109 | +void ppc4xx_tlb_invalidate_virt (CPUState *env, target_ulong eaddr, | |
110 | + uint32_t pid); | |
109 | 111 | |
110 | 112 | static inline void env_to_regs (void) |
111 | 113 | { | ... | ... |
target-ppc/helper.c
... | ... | @@ -586,8 +586,8 @@ static int find_pte64 (mmu_ctx_t *ctx, int h, int rw) |
586 | 586 | static inline int find_pte (CPUState *env, mmu_ctx_t *ctx, int h, int rw) |
587 | 587 | { |
588 | 588 | #if defined(TARGET_PPC64) |
589 | - if (PPC_MMU(env) == PPC_FLAGS_MMU_64B || | |
590 | - PPC_MMU(env) == PPC_FLAGS_MMU_64BRIDGE) | |
589 | + if (env->mmu_model == POWERPC_MMU_64B || | |
590 | + env->mmu_model == POWERPC_MMU_64BRIDGE) | |
591 | 591 | return find_pte64(ctx, h, rw); |
592 | 592 | #endif |
593 | 593 | |
... | ... | @@ -669,7 +669,7 @@ static int get_segment (CPUState *env, mmu_ctx_t *ctx, |
669 | 669 | int ret, ret2; |
670 | 670 | |
671 | 671 | #if defined(TARGET_PPC64) |
672 | - if (PPC_MMU(env) == PPC_FLAGS_MMU_64B) { | |
672 | + if (env->mmu_model == POWERPC_MMU_64B) { | |
673 | 673 | ret = slb_lookup(env, eaddr, &vsid, &page_mask, &attr); |
674 | 674 | if (ret < 0) |
675 | 675 | return ret; |
... | ... | @@ -724,8 +724,8 @@ static int get_segment (CPUState *env, mmu_ctx_t *ctx, |
724 | 724 | hash = (~hash) & vsid_mask; |
725 | 725 | ctx->pg_addr[1] = get_pgaddr(sdr, sdr_sh, hash, mask); |
726 | 726 | #if defined(TARGET_PPC64) |
727 | - if (PPC_MMU(env) == PPC_FLAGS_MMU_64B || | |
728 | - PPC_MMU(env) == PPC_FLAGS_MMU_64BRIDGE) { | |
727 | + if (env->mmu_model == POWERPC_MMU_64B || | |
728 | + env->mmu_model == POWERPC_MMU_64BRIDGE) { | |
729 | 729 | /* Only 5 bits of the page index are used in the AVPN */ |
730 | 730 | ctx->ptem = (vsid << 12) | ((pgidx >> 4) & 0x0F80); |
731 | 731 | } else |
... | ... | @@ -735,7 +735,7 @@ static int get_segment (CPUState *env, mmu_ctx_t *ctx, |
735 | 735 | } |
736 | 736 | /* Initialize real address with an invalid value */ |
737 | 737 | ctx->raddr = (target_ulong)-1; |
738 | - if (unlikely(PPC_MMU(env) == PPC_FLAGS_MMU_SOFT_6xx)) { | |
738 | + if (unlikely(env->mmu_model == POWERPC_MMU_SOFT_6xx)) { | |
739 | 739 | /* Software TLB search */ |
740 | 740 | ret = ppc6xx_tlb_check(env, ctx, eaddr, rw, type); |
741 | 741 | } else { |
... | ... | @@ -865,7 +865,7 @@ int ppcemb_tlb_search (CPUPPCState *env, target_ulong address, uint32_t pid) |
865 | 865 | |
866 | 866 | /* Default return value is no match */ |
867 | 867 | ret = -1; |
868 | - for (i = 0; i < 64; i++) { | |
868 | + for (i = 0; i < env->nb_tlb; i++) { | |
869 | 869 | tlb = &env->tlb[i].tlbe; |
870 | 870 | if (ppcemb_tlb_check(env, tlb, &raddr, address, pid, 0, i) == 0) { |
871 | 871 | ret = i; |
... | ... | @@ -876,6 +876,26 @@ int ppcemb_tlb_search (CPUPPCState *env, target_ulong address, uint32_t pid) |
876 | 876 | return ret; |
877 | 877 | } |
878 | 878 | |
879 | +void ppc4xx_tlb_invalidate_virt (CPUState *env, target_ulong eaddr, | |
880 | + uint32_t pid) | |
881 | +{ | |
882 | + ppcemb_tlb_t *tlb; | |
883 | + target_phys_addr_t raddr; | |
884 | + target_ulong page, end; | |
885 | + int i; | |
886 | + | |
887 | + for (i = 0; i < env->nb_tlb; i++) { | |
888 | + tlb = &env->tlb[i].tlbe; | |
889 | + if (ppcemb_tlb_check(env, tlb, &raddr, eaddr, pid, 0, i) == 0) { | |
890 | + end = tlb->EPN + tlb->size; | |
891 | + for (page = tlb->EPN; page < end; page += TARGET_PAGE_SIZE) | |
892 | + tlb_flush_page(env, page); | |
893 | + tlb->prot &= ~PAGE_VALID; | |
894 | + break; | |
895 | + } | |
896 | + } | |
897 | +} | |
898 | + | |
879 | 899 | /* Helpers specific to PowerPC 40x implementations */ |
880 | 900 | void ppc4xx_tlb_invalidate_all (CPUState *env) |
881 | 901 | { |
... | ... | @@ -1069,23 +1089,23 @@ static int check_physical (CPUState *env, mmu_ctx_t *ctx, |
1069 | 1089 | ctx->raddr = eaddr; |
1070 | 1090 | ctx->prot = PAGE_READ; |
1071 | 1091 | ret = 0; |
1072 | - switch (PPC_MMU(env)) { | |
1073 | - case PPC_FLAGS_MMU_32B: | |
1074 | - case PPC_FLAGS_MMU_SOFT_6xx: | |
1075 | - case PPC_FLAGS_MMU_601: | |
1076 | - case PPC_FLAGS_MMU_SOFT_4xx: | |
1077 | - case PPC_FLAGS_MMU_401: | |
1092 | + switch (env->mmu_model) { | |
1093 | + case POWERPC_MMU_32B: | |
1094 | + case POWERPC_MMU_SOFT_6xx: | |
1095 | + case POWERPC_MMU_601: | |
1096 | + case POWERPC_MMU_SOFT_4xx: | |
1097 | + case POWERPC_MMU_REAL_4xx: | |
1078 | 1098 | ctx->prot |= PAGE_WRITE; |
1079 | 1099 | break; |
1080 | 1100 | #if defined(TARGET_PPC64) |
1081 | - case PPC_FLAGS_MMU_64B: | |
1082 | - case PPC_FLAGS_MMU_64BRIDGE: | |
1101 | + case POWERPC_MMU_64B: | |
1102 | + case POWERPC_MMU_64BRIDGE: | |
1083 | 1103 | /* Real address are 60 bits long */ |
1084 | - ctx->raddr &= 0x0FFFFFFFFFFFFFFFUL; | |
1104 | + ctx->raddr &= 0x0FFFFFFFFFFFFFFFULL; | |
1085 | 1105 | ctx->prot |= PAGE_WRITE; |
1086 | 1106 | break; |
1087 | 1107 | #endif |
1088 | - case PPC_FLAGS_MMU_403: | |
1108 | + case POWERPC_MMU_SOFT_4xx_Z: | |
1089 | 1109 | if (unlikely(msr_pe != 0)) { |
1090 | 1110 | /* 403 family add some particular protections, |
1091 | 1111 | * using PBL/PBU registers for accesses with no translation. |
... | ... | @@ -1108,10 +1128,10 @@ static int check_physical (CPUState *env, mmu_ctx_t *ctx, |
1108 | 1128 | ctx->prot |= PAGE_WRITE; |
1109 | 1129 | } |
1110 | 1130 | } |
1111 | - case PPC_FLAGS_MMU_BOOKE: | |
1131 | + case POWERPC_MMU_BOOKE: | |
1112 | 1132 | ctx->prot |= PAGE_WRITE; |
1113 | 1133 | break; |
1114 | - case PPC_FLAGS_MMU_BOOKE_FSL: | |
1134 | + case POWERPC_MMU_BOOKE_FSL: | |
1115 | 1135 | /* XXX: TODO */ |
1116 | 1136 | cpu_abort(env, "BookE FSL MMU model not implemented\n"); |
1117 | 1137 | break; |
... | ... | @@ -1138,40 +1158,40 @@ int get_physical_address (CPUState *env, mmu_ctx_t *ctx, target_ulong eaddr, |
1138 | 1158 | ret = check_physical(env, ctx, eaddr, rw); |
1139 | 1159 | } else { |
1140 | 1160 | ret = -1; |
1141 | - switch (PPC_MMU(env)) { | |
1142 | - case PPC_FLAGS_MMU_32B: | |
1143 | - case PPC_FLAGS_MMU_SOFT_6xx: | |
1161 | + switch (env->mmu_model) { | |
1162 | + case POWERPC_MMU_32B: | |
1163 | + case POWERPC_MMU_SOFT_6xx: | |
1144 | 1164 | /* Try to find a BAT */ |
1145 | 1165 | if (check_BATs) |
1146 | 1166 | ret = get_bat(env, ctx, eaddr, rw, access_type); |
1147 | 1167 | /* No break here */ |
1148 | 1168 | #if defined(TARGET_PPC64) |
1149 | - case PPC_FLAGS_MMU_64B: | |
1150 | - case PPC_FLAGS_MMU_64BRIDGE: | |
1169 | + case POWERPC_MMU_64B: | |
1170 | + case POWERPC_MMU_64BRIDGE: | |
1151 | 1171 | #endif |
1152 | 1172 | if (ret < 0) { |
1153 | 1173 | /* We didn't match any BAT entry or don't have BATs */ |
1154 | 1174 | ret = get_segment(env, ctx, eaddr, rw, access_type); |
1155 | 1175 | } |
1156 | 1176 | break; |
1157 | - case PPC_FLAGS_MMU_SOFT_4xx: | |
1158 | - case PPC_FLAGS_MMU_403: | |
1177 | + case POWERPC_MMU_SOFT_4xx: | |
1178 | + case POWERPC_MMU_SOFT_4xx_Z: | |
1159 | 1179 | ret = mmu40x_get_physical_address(env, ctx, eaddr, |
1160 | 1180 | rw, access_type); |
1161 | 1181 | break; |
1162 | - case PPC_FLAGS_MMU_601: | |
1182 | + case POWERPC_MMU_601: | |
1163 | 1183 | /* XXX: TODO */ |
1164 | 1184 | cpu_abort(env, "601 MMU model not implemented\n"); |
1165 | 1185 | return -1; |
1166 | - case PPC_FLAGS_MMU_BOOKE: | |
1186 | + case POWERPC_MMU_BOOKE: | |
1167 | 1187 | ret = mmubooke_get_physical_address(env, ctx, eaddr, |
1168 | 1188 | rw, access_type); |
1169 | 1189 | break; |
1170 | - case PPC_FLAGS_MMU_BOOKE_FSL: | |
1190 | + case POWERPC_MMU_BOOKE_FSL: | |
1171 | 1191 | /* XXX: TODO */ |
1172 | 1192 | cpu_abort(env, "BookE FSL MMU model not implemented\n"); |
1173 | 1193 | return -1; |
1174 | - case PPC_FLAGS_MMU_401: | |
1194 | + case POWERPC_MMU_REAL_4xx: | |
1175 | 1195 | cpu_abort(env, "PowerPC 401 does not do any translation\n"); |
1176 | 1196 | return -1; |
1177 | 1197 | default: |
... | ... | @@ -1234,46 +1254,46 @@ int cpu_ppc_handle_mmu_fault (CPUState *env, target_ulong address, int rw, |
1234 | 1254 | switch (ret) { |
1235 | 1255 | case -1: |
1236 | 1256 | /* No matches in page tables or TLB */ |
1237 | - switch (PPC_MMU(env)) { | |
1238 | - case PPC_FLAGS_MMU_SOFT_6xx: | |
1257 | + switch (env->mmu_model) { | |
1258 | + case POWERPC_MMU_SOFT_6xx: | |
1239 | 1259 | exception = EXCP_I_TLBMISS; |
1240 | 1260 | env->spr[SPR_IMISS] = address; |
1241 | 1261 | env->spr[SPR_ICMP] = 0x80000000 | ctx.ptem; |
1242 | 1262 | error_code = 1 << 18; |
1243 | 1263 | goto tlb_miss; |
1244 | - case PPC_FLAGS_MMU_SOFT_4xx: | |
1245 | - case PPC_FLAGS_MMU_403: | |
1264 | + case POWERPC_MMU_SOFT_4xx: | |
1265 | + case POWERPC_MMU_SOFT_4xx_Z: | |
1246 | 1266 | exception = EXCP_40x_ITLBMISS; |
1247 | 1267 | error_code = 0; |
1248 | 1268 | env->spr[SPR_40x_DEAR] = address; |
1249 | 1269 | env->spr[SPR_40x_ESR] = 0x00000000; |
1250 | 1270 | break; |
1251 | - case PPC_FLAGS_MMU_32B: | |
1271 | + case POWERPC_MMU_32B: | |
1252 | 1272 | error_code = 0x40000000; |
1253 | 1273 | break; |
1254 | 1274 | #if defined(TARGET_PPC64) |
1255 | - case PPC_FLAGS_MMU_64B: | |
1275 | + case POWERPC_MMU_64B: | |
1256 | 1276 | /* XXX: TODO */ |
1257 | 1277 | cpu_abort(env, "MMU model not implemented\n"); |
1258 | 1278 | return -1; |
1259 | - case PPC_FLAGS_MMU_64BRIDGE: | |
1279 | + case POWERPC_MMU_64BRIDGE: | |
1260 | 1280 | /* XXX: TODO */ |
1261 | 1281 | cpu_abort(env, "MMU model not implemented\n"); |
1262 | 1282 | return -1; |
1263 | 1283 | #endif |
1264 | - case PPC_FLAGS_MMU_601: | |
1284 | + case POWERPC_MMU_601: | |
1265 | 1285 | /* XXX: TODO */ |
1266 | 1286 | cpu_abort(env, "MMU model not implemented\n"); |
1267 | 1287 | return -1; |
1268 | - case PPC_FLAGS_MMU_BOOKE: | |
1288 | + case POWERPC_MMU_BOOKE: | |
1269 | 1289 | /* XXX: TODO */ |
1270 | 1290 | cpu_abort(env, "MMU model not implemented\n"); |
1271 | 1291 | return -1; |
1272 | - case PPC_FLAGS_MMU_BOOKE_FSL: | |
1292 | + case POWERPC_MMU_BOOKE_FSL: | |
1273 | 1293 | /* XXX: TODO */ |
1274 | 1294 | cpu_abort(env, "MMU model not implemented\n"); |
1275 | 1295 | return -1; |
1276 | - case PPC_FLAGS_MMU_401: | |
1296 | + case POWERPC_MMU_REAL_4xx: | |
1277 | 1297 | cpu_abort(env, "PowerPC 401 should never raise any MMU " |
1278 | 1298 | "exceptions\n"); |
1279 | 1299 | return -1; |
... | ... | @@ -1306,8 +1326,8 @@ int cpu_ppc_handle_mmu_fault (CPUState *env, target_ulong address, int rw, |
1306 | 1326 | switch (ret) { |
1307 | 1327 | case -1: |
1308 | 1328 | /* No matches in page tables or TLB */ |
1309 | - switch (PPC_MMU(env)) { | |
1310 | - case PPC_FLAGS_MMU_SOFT_6xx: | |
1329 | + switch (env->mmu_model) { | |
1330 | + case POWERPC_MMU_SOFT_6xx: | |
1311 | 1331 | if (rw == 1) { |
1312 | 1332 | exception = EXCP_DS_TLBMISS; |
1313 | 1333 | error_code = 1 << 16; |
... | ... | @@ -1323,8 +1343,8 @@ int cpu_ppc_handle_mmu_fault (CPUState *env, target_ulong address, int rw, |
1323 | 1343 | env->spr[SPR_HASH2] = ctx.pg_addr[1]; |
1324 | 1344 | /* Do not alter DAR nor DSISR */ |
1325 | 1345 | goto out; |
1326 | - case PPC_FLAGS_MMU_SOFT_4xx: | |
1327 | - case PPC_FLAGS_MMU_403: | |
1346 | + case POWERPC_MMU_SOFT_4xx: | |
1347 | + case POWERPC_MMU_SOFT_4xx_Z: | |
1328 | 1348 | exception = EXCP_40x_DTLBMISS; |
1329 | 1349 | error_code = 0; |
1330 | 1350 | env->spr[SPR_40x_DEAR] = address; |
... | ... | @@ -1333,32 +1353,32 @@ int cpu_ppc_handle_mmu_fault (CPUState *env, target_ulong address, int rw, |
1333 | 1353 | else |
1334 | 1354 | env->spr[SPR_40x_ESR] = 0x00000000; |
1335 | 1355 | break; |
1336 | - case PPC_FLAGS_MMU_32B: | |
1356 | + case POWERPC_MMU_32B: | |
1337 | 1357 | error_code = 0x40000000; |
1338 | 1358 | break; |
1339 | 1359 | #if defined(TARGET_PPC64) |
1340 | - case PPC_FLAGS_MMU_64B: | |
1360 | + case POWERPC_MMU_64B: | |
1341 | 1361 | /* XXX: TODO */ |
1342 | 1362 | cpu_abort(env, "MMU model not implemented\n"); |
1343 | 1363 | return -1; |
1344 | - case PPC_FLAGS_MMU_64BRIDGE: | |
1364 | + case POWERPC_MMU_64BRIDGE: | |
1345 | 1365 | /* XXX: TODO */ |
1346 | 1366 | cpu_abort(env, "MMU model not implemented\n"); |
1347 | 1367 | return -1; |
1348 | 1368 | #endif |
1349 | - case PPC_FLAGS_MMU_601: | |
1369 | + case POWERPC_MMU_601: | |
1350 | 1370 | /* XXX: TODO */ |
1351 | 1371 | cpu_abort(env, "MMU model not implemented\n"); |
1352 | 1372 | return -1; |
1353 | - case PPC_FLAGS_MMU_BOOKE: | |
1373 | + case POWERPC_MMU_BOOKE: | |
1354 | 1374 | /* XXX: TODO */ |
1355 | 1375 | cpu_abort(env, "MMU model not implemented\n"); |
1356 | 1376 | return -1; |
1357 | - case PPC_FLAGS_MMU_BOOKE_FSL: | |
1377 | + case POWERPC_MMU_BOOKE_FSL: | |
1358 | 1378 | /* XXX: TODO */ |
1359 | 1379 | cpu_abort(env, "MMU model not implemented\n"); |
1360 | 1380 | return -1; |
1361 | - case PPC_FLAGS_MMU_401: | |
1381 | + case POWERPC_MMU_REAL_4xx: | |
1362 | 1382 | cpu_abort(env, "PowerPC 401 should never raise any MMU " |
1363 | 1383 | "exceptions\n"); |
1364 | 1384 | return -1; |
... | ... | @@ -1544,9 +1564,9 @@ void do_store_dbatl (CPUPPCState *env, int nr, target_ulong value) |
1544 | 1564 | /* TLB management */ |
1545 | 1565 | void ppc_tlb_invalidate_all (CPUPPCState *env) |
1546 | 1566 | { |
1547 | - if (unlikely(PPC_MMU(env) == PPC_FLAGS_MMU_SOFT_6xx)) { | |
1567 | + if (unlikely(env->mmu_model == POWERPC_MMU_SOFT_6xx)) { | |
1548 | 1568 | ppc6xx_tlb_invalidate_all(env); |
1549 | - } else if (unlikely(PPC_MMU(env) == PPC_FLAGS_MMU_SOFT_4xx)) { | |
1569 | + } else if (unlikely(env->mmu_model == POWERPC_MMU_SOFT_4xx)) { | |
1550 | 1570 | ppc4xx_tlb_invalidate_all(env); |
1551 | 1571 | } else { |
1552 | 1572 | tlb_flush(env, 1); |
... | ... | @@ -1707,9 +1727,11 @@ void do_store_msr (CPUPPCState *env, target_ulong value) |
1707 | 1727 | fprintf(logfile, "%s: T0 %08lx\n", __func__, value); |
1708 | 1728 | } |
1709 | 1729 | #endif |
1710 | - switch (PPC_EXCP(env)) { | |
1711 | - case PPC_FLAGS_EXCP_602: | |
1712 | - case PPC_FLAGS_EXCP_603: | |
1730 | + switch (env->excp_model) { | |
1731 | + case POWERPC_EXCP_602: | |
1732 | + case POWERPC_EXCP_603: | |
1733 | + case POWERPC_EXCP_603E: | |
1734 | + case POWERPC_EXCP_G2: | |
1713 | 1735 | if (((value >> MSR_TGPR) & 1) != msr_tgpr) { |
1714 | 1736 | /* Swap temporary saved registers with GPRs */ |
1715 | 1737 | swap_gpr_tgpr(env); |
... | ... | @@ -1750,19 +1772,21 @@ void do_store_msr (CPUPPCState *env, target_ulong value) |
1750 | 1772 | do_compute_hflags(env); |
1751 | 1773 | |
1752 | 1774 | enter_pm = 0; |
1753 | - switch (PPC_EXCP(env)) { | |
1754 | - case PPC_FLAGS_EXCP_603: | |
1775 | + switch (env->excp_model) { | |
1776 | + case POWERPC_EXCP_603: | |
1777 | + case POWERPC_EXCP_603E: | |
1778 | + case POWERPC_EXCP_G2: | |
1755 | 1779 | /* Don't handle SLEEP mode: we should disable all clocks... |
1756 | 1780 | * No dynamic power-management. |
1757 | 1781 | */ |
1758 | 1782 | if (msr_pow == 1 && (env->spr[SPR_HID0] & 0x00C00000) != 0) |
1759 | 1783 | enter_pm = 1; |
1760 | 1784 | break; |
1761 | - case PPC_FLAGS_EXCP_604: | |
1785 | + case POWERPC_EXCP_604: | |
1762 | 1786 | if (msr_pow == 1) |
1763 | 1787 | enter_pm = 1; |
1764 | 1788 | break; |
1765 | - case PPC_FLAGS_EXCP_7x0: | |
1789 | + case POWERPC_EXCP_7x0: | |
1766 | 1790 | if (msr_pow == 1 && (env->spr[SPR_HID0] & 0x00E00000) != 0) |
1767 | 1791 | enter_pm = 1; |
1768 | 1792 | break; |
... | ... | @@ -1854,12 +1878,12 @@ void do_interrupt (CPUState *env) |
1854 | 1878 | switch (excp) { |
1855 | 1879 | /* Generic PowerPC exceptions */ |
1856 | 1880 | case EXCP_RESET: /* 0x0100 */ |
1857 | - switch (PPC_EXCP(env)) { | |
1858 | - case PPC_FLAGS_EXCP_40x: | |
1881 | + switch (env->excp_model) { | |
1882 | + case POWERPC_EXCP_40x: | |
1859 | 1883 | srr_0 = &env->spr[SPR_40x_SRR2]; |
1860 | 1884 | srr_1 = &env->spr[SPR_40x_SRR3]; |
1861 | 1885 | break; |
1862 | - case PPC_FLAGS_EXCP_BOOKE: | |
1886 | + case POWERPC_EXCP_BOOKE: | |
1863 | 1887 | idx = 0; |
1864 | 1888 | srr_0 = &env->spr[SPR_BOOKE_CSRR0]; |
1865 | 1889 | srr_1 = &env->spr[SPR_BOOKE_CSRR1]; |
... | ... | @@ -1872,12 +1896,12 @@ void do_interrupt (CPUState *env) |
1872 | 1896 | } |
1873 | 1897 | goto store_next; |
1874 | 1898 | case EXCP_MACHINE_CHECK: /* 0x0200 */ |
1875 | - switch (PPC_EXCP(env)) { | |
1876 | - case PPC_FLAGS_EXCP_40x: | |
1899 | + switch (env->excp_model) { | |
1900 | + case POWERPC_EXCP_40x: | |
1877 | 1901 | srr_0 = &env->spr[SPR_40x_SRR2]; |
1878 | 1902 | srr_1 = &env->spr[SPR_40x_SRR3]; |
1879 | 1903 | break; |
1880 | - case PPC_FLAGS_EXCP_BOOKE: | |
1904 | + case POWERPC_EXCP_BOOKE: | |
1881 | 1905 | idx = 1; |
1882 | 1906 | srr_0 = &env->spr[SPR_BOOKE_MCSRR0]; |
1883 | 1907 | srr_1 = &env->spr[SPR_BOOKE_MCSRR1]; |
... | ... | @@ -1920,7 +1944,7 @@ void do_interrupt (CPUState *env) |
1920 | 1944 | idx = 4; |
1921 | 1945 | goto store_next; |
1922 | 1946 | case EXCP_ALIGN: /* 0x0600 */ |
1923 | - if (likely(PPC_EXCP(env) != PPC_FLAGS_EXCP_601)) { | |
1947 | + if (likely(env->excp_model != POWERPC_EXCP_601)) { | |
1924 | 1948 | /* Store exception cause */ |
1925 | 1949 | idx = 5; |
1926 | 1950 | /* Get rS/rD and rA from faulting opcode */ |
... | ... | @@ -2028,26 +2052,27 @@ void do_interrupt (CPUState *env) |
2028 | 2052 | goto store_next; |
2029 | 2053 | /* Implementation specific exceptions */ |
2030 | 2054 | case 0x0A00: |
2031 | - if (likely(env->spr[SPR_PVR] == CPU_PPC_G2 || | |
2032 | - env->spr[SPR_PVR] == CPU_PPC_G2LE)) { | |
2055 | + switch (env->excp_model) { | |
2056 | + case POWERPC_EXCP_G2: | |
2033 | 2057 | /* Critical interrupt on G2 */ |
2034 | 2058 | /* XXX: TODO */ |
2035 | 2059 | cpu_abort(env, "G2 critical interrupt is not implemented yet !\n"); |
2036 | 2060 | goto store_next; |
2037 | - } else { | |
2061 | + default: | |
2038 | 2062 | cpu_abort(env, "Invalid exception 0x0A00 !\n"); |
2063 | + break; | |
2039 | 2064 | } |
2040 | 2065 | return; |
2041 | 2066 | case 0x0F20: |
2042 | 2067 | idx = 9; |
2043 | - switch (PPC_EXCP(env)) { | |
2044 | - case PPC_FLAGS_EXCP_40x: | |
2068 | + switch (env->excp_model) { | |
2069 | + case POWERPC_EXCP_40x: | |
2045 | 2070 | /* APU unavailable on 405 */ |
2046 | 2071 | /* XXX: TODO */ |
2047 | 2072 | cpu_abort(env, |
2048 | 2073 | "APU unavailable exception is not implemented yet !\n"); |
2049 | 2074 | goto store_next; |
2050 | - case PPC_FLAGS_EXCP_74xx: | |
2075 | + case POWERPC_EXCP_74xx: | |
2051 | 2076 | /* Altivec unavailable */ |
2052 | 2077 | /* XXX: TODO */ |
2053 | 2078 | cpu_abort(env, "Altivec unavailable exception " |
... | ... | @@ -2060,8 +2085,8 @@ void do_interrupt (CPUState *env) |
2060 | 2085 | return; |
2061 | 2086 | case 0x1000: |
2062 | 2087 | idx = 10; |
2063 | - switch (PPC_EXCP(env)) { | |
2064 | - case PPC_FLAGS_EXCP_40x: | |
2088 | + switch (env->excp_model) { | |
2089 | + case POWERPC_EXCP_40x: | |
2065 | 2090 | /* PIT on 4xx */ |
2066 | 2091 | msr &= ~0xFFFF0000; |
2067 | 2092 | #if defined (DEBUG_EXCEPTIONS) |
... | ... | @@ -2069,11 +2094,13 @@ void do_interrupt (CPUState *env) |
2069 | 2094 | fprintf(logfile, "PIT exception\n"); |
2070 | 2095 | #endif |
2071 | 2096 | goto store_next; |
2072 | - case PPC_FLAGS_EXCP_602: | |
2073 | - case PPC_FLAGS_EXCP_603: | |
2097 | + case POWERPC_EXCP_602: | |
2098 | + case POWERPC_EXCP_603: | |
2099 | + case POWERPC_EXCP_603E: | |
2100 | + case POWERPC_EXCP_G2: | |
2074 | 2101 | /* ITLBMISS on 602/603 */ |
2075 | 2102 | goto store_gprs; |
2076 | - case PPC_FLAGS_EXCP_7x5: | |
2103 | + case POWERPC_EXCP_7x5: | |
2077 | 2104 | /* ITLBMISS on 745/755 */ |
2078 | 2105 | goto tlb_miss; |
2079 | 2106 | default: |
... | ... | @@ -2083,8 +2110,8 @@ void do_interrupt (CPUState *env) |
2083 | 2110 | return; |
2084 | 2111 | case 0x1010: |
2085 | 2112 | idx = 11; |
2086 | - switch (PPC_EXCP(env)) { | |
2087 | - case PPC_FLAGS_EXCP_40x: | |
2113 | + switch (env->excp_model) { | |
2114 | + case POWERPC_EXCP_40x: | |
2088 | 2115 | /* FIT on 4xx */ |
2089 | 2116 | msr &= ~0xFFFF0000; |
2090 | 2117 | #if defined (DEBUG_EXCEPTIONS) |
... | ... | @@ -2099,8 +2126,8 @@ void do_interrupt (CPUState *env) |
2099 | 2126 | return; |
2100 | 2127 | case 0x1020: |
2101 | 2128 | idx = 12; |
2102 | - switch (PPC_EXCP(env)) { | |
2103 | - case PPC_FLAGS_EXCP_40x: | |
2129 | + switch (env->excp_model) { | |
2130 | + case POWERPC_EXCP_40x: | |
2104 | 2131 | /* Watchdog on 4xx */ |
2105 | 2132 | msr &= ~0xFFFF0000; |
2106 | 2133 | #if defined (DEBUG_EXCEPTIONS) |
... | ... | @@ -2108,7 +2135,7 @@ void do_interrupt (CPUState *env) |
2108 | 2135 | fprintf(logfile, "WDT exception\n"); |
2109 | 2136 | #endif |
2110 | 2137 | goto store_next; |
2111 | - case PPC_FLAGS_EXCP_BOOKE: | |
2138 | + case POWERPC_EXCP_BOOKE: | |
2112 | 2139 | srr_0 = &env->spr[SPR_BOOKE_CSRR0]; |
2113 | 2140 | srr_1 = &env->spr[SPR_BOOKE_CSRR1]; |
2114 | 2141 | break; |
... | ... | @@ -2119,16 +2146,18 @@ void do_interrupt (CPUState *env) |
2119 | 2146 | return; |
2120 | 2147 | case 0x1100: |
2121 | 2148 | idx = 13; |
2122 | - switch (PPC_EXCP(env)) { | |
2123 | - case PPC_FLAGS_EXCP_40x: | |
2149 | + switch (env->excp_model) { | |
2150 | + case POWERPC_EXCP_40x: | |
2124 | 2151 | /* DTLBMISS on 4xx */ |
2125 | 2152 | msr &= ~0xFFFF0000; |
2126 | 2153 | goto store_next; |
2127 | - case PPC_FLAGS_EXCP_602: | |
2128 | - case PPC_FLAGS_EXCP_603: | |
2154 | + case POWERPC_EXCP_602: | |
2155 | + case POWERPC_EXCP_603: | |
2156 | + case POWERPC_EXCP_603E: | |
2157 | + case POWERPC_EXCP_G2: | |
2129 | 2158 | /* DLTLBMISS on 602/603 */ |
2130 | 2159 | goto store_gprs; |
2131 | - case PPC_FLAGS_EXCP_7x5: | |
2160 | + case POWERPC_EXCP_7x5: | |
2132 | 2161 | /* DLTLBMISS on 745/755 */ |
2133 | 2162 | goto tlb_miss; |
2134 | 2163 | default: |
... | ... | @@ -2138,13 +2167,15 @@ void do_interrupt (CPUState *env) |
2138 | 2167 | return; |
2139 | 2168 | case 0x1200: |
2140 | 2169 | idx = 14; |
2141 | - switch (PPC_EXCP(env)) { | |
2142 | - case PPC_FLAGS_EXCP_40x: | |
2170 | + switch (env->excp_model) { | |
2171 | + case POWERPC_EXCP_40x: | |
2143 | 2172 | /* ITLBMISS on 4xx */ |
2144 | 2173 | msr &= ~0xFFFF0000; |
2145 | 2174 | goto store_next; |
2146 | - case PPC_FLAGS_EXCP_602: | |
2147 | - case PPC_FLAGS_EXCP_603: | |
2175 | + case POWERPC_EXCP_602: | |
2176 | + case POWERPC_EXCP_603: | |
2177 | + case POWERPC_EXCP_603E: | |
2178 | + case POWERPC_EXCP_G2: | |
2148 | 2179 | /* DSTLBMISS on 602/603 */ |
2149 | 2180 | store_gprs: |
2150 | 2181 | /* Swap temporary saved registers with GPRs */ |
... | ... | @@ -2177,7 +2208,7 @@ void do_interrupt (CPUState *env) |
2177 | 2208 | } |
2178 | 2209 | #endif |
2179 | 2210 | goto tlb_miss; |
2180 | - case PPC_FLAGS_EXCP_7x5: | |
2211 | + case POWERPC_EXCP_7x5: | |
2181 | 2212 | /* DSTLBMISS on 745/755 */ |
2182 | 2213 | tlb_miss: |
2183 | 2214 | msr &= ~0xF83F0000; |
... | ... | @@ -2192,13 +2223,15 @@ void do_interrupt (CPUState *env) |
2192 | 2223 | } |
2193 | 2224 | return; |
2194 | 2225 | case 0x1300: |
2195 | - switch (PPC_EXCP(env)) { | |
2196 | - case PPC_FLAGS_EXCP_601: | |
2197 | - case PPC_FLAGS_EXCP_602: | |
2198 | - case PPC_FLAGS_EXCP_603: | |
2199 | - case PPC_FLAGS_EXCP_604: | |
2200 | - case PPC_FLAGS_EXCP_7x0: | |
2201 | - case PPC_FLAGS_EXCP_7x5: | |
2226 | + switch (env->excp_model) { | |
2227 | + case POWERPC_EXCP_601: | |
2228 | + case POWERPC_EXCP_602: | |
2229 | + case POWERPC_EXCP_603: | |
2230 | + case POWERPC_EXCP_603E: | |
2231 | + case POWERPC_EXCP_G2: | |
2232 | + case POWERPC_EXCP_604: | |
2233 | + case POWERPC_EXCP_7x0: | |
2234 | + case POWERPC_EXCP_7x5: | |
2202 | 2235 | /* IABR on 6xx/7xx */ |
2203 | 2236 | /* XXX: TODO */ |
2204 | 2237 | cpu_abort(env, "IABR exception is not implemented yet !\n"); |
... | ... | @@ -2209,13 +2242,15 @@ void do_interrupt (CPUState *env) |
2209 | 2242 | } |
2210 | 2243 | return; |
2211 | 2244 | case 0x1400: |
2212 | - switch (PPC_EXCP(env)) { | |
2213 | - case PPC_FLAGS_EXCP_601: | |
2214 | - case PPC_FLAGS_EXCP_602: | |
2215 | - case PPC_FLAGS_EXCP_603: | |
2216 | - case PPC_FLAGS_EXCP_604: | |
2217 | - case PPC_FLAGS_EXCP_7x0: | |
2218 | - case PPC_FLAGS_EXCP_7x5: | |
2245 | + switch (env->excp_model) { | |
2246 | + case POWERPC_EXCP_601: | |
2247 | + case POWERPC_EXCP_602: | |
2248 | + case POWERPC_EXCP_603: | |
2249 | + case POWERPC_EXCP_603E: | |
2250 | + case POWERPC_EXCP_G2: | |
2251 | + case POWERPC_EXCP_604: | |
2252 | + case POWERPC_EXCP_7x0: | |
2253 | + case POWERPC_EXCP_7x5: | |
2219 | 2254 | /* SMI on 6xx/7xx */ |
2220 | 2255 | /* XXX: TODO */ |
2221 | 2256 | cpu_abort(env, "SMI exception is not implemented yet !\n"); |
... | ... | @@ -2226,20 +2261,20 @@ void do_interrupt (CPUState *env) |
2226 | 2261 | } |
2227 | 2262 | return; |
2228 | 2263 | case 0x1500: |
2229 | - switch (PPC_EXCP(env)) { | |
2230 | - case PPC_FLAGS_EXCP_602: | |
2264 | + switch (env->excp_model) { | |
2265 | + case POWERPC_EXCP_602: | |
2231 | 2266 | /* Watchdog on 602 */ |
2232 | 2267 | /* XXX: TODO */ |
2233 | 2268 | cpu_abort(env, |
2234 | 2269 | "602 watchdog exception is not implemented yet !\n"); |
2235 | 2270 | goto store_next; |
2236 | - case PPC_FLAGS_EXCP_970: | |
2271 | + case POWERPC_EXCP_970: | |
2237 | 2272 | /* Soft patch exception on 970 */ |
2238 | 2273 | /* XXX: TODO */ |
2239 | 2274 | cpu_abort(env, |
2240 | 2275 | "970 soft-patch exception is not implemented yet !\n"); |
2241 | 2276 | goto store_next; |
2242 | - case PPC_FLAGS_EXCP_74xx: | |
2277 | + case POWERPC_EXCP_74xx: | |
2243 | 2278 | /* VPU assist on 74xx */ |
2244 | 2279 | /* XXX: TODO */ |
2245 | 2280 | cpu_abort(env, "VPU assist exception is not implemented yet !\n"); |
... | ... | @@ -2250,14 +2285,14 @@ void do_interrupt (CPUState *env) |
2250 | 2285 | } |
2251 | 2286 | return; |
2252 | 2287 | case 0x1600: |
2253 | - switch (PPC_EXCP(env)) { | |
2254 | - case PPC_FLAGS_EXCP_602: | |
2288 | + switch (env->excp_model) { | |
2289 | + case POWERPC_EXCP_602: | |
2255 | 2290 | /* Emulation trap on 602 */ |
2256 | 2291 | /* XXX: TODO */ |
2257 | 2292 | cpu_abort(env, "602 emulation trap exception " |
2258 | 2293 | "is not implemented yet !\n"); |
2259 | 2294 | goto store_next; |
2260 | - case PPC_FLAGS_EXCP_970: | |
2295 | + case POWERPC_EXCP_970: | |
2261 | 2296 | /* Maintenance exception on 970 */ |
2262 | 2297 | /* XXX: TODO */ |
2263 | 2298 | cpu_abort(env, |
... | ... | @@ -2269,15 +2304,15 @@ void do_interrupt (CPUState *env) |
2269 | 2304 | } |
2270 | 2305 | return; |
2271 | 2306 | case 0x1700: |
2272 | - switch (PPC_EXCP(env)) { | |
2273 | - case PPC_FLAGS_EXCP_7x0: | |
2274 | - case PPC_FLAGS_EXCP_7x5: | |
2307 | + switch (env->excp_model) { | |
2308 | + case POWERPC_EXCP_7x0: | |
2309 | + case POWERPC_EXCP_7x5: | |
2275 | 2310 | /* Thermal management interrupt on G3 */ |
2276 | 2311 | /* XXX: TODO */ |
2277 | 2312 | cpu_abort(env, "G3 thermal management exception " |
2278 | 2313 | "is not implemented yet !\n"); |
2279 | 2314 | goto store_next; |
2280 | - case PPC_FLAGS_EXCP_970: | |
2315 | + case POWERPC_EXCP_970: | |
2281 | 2316 | /* VPU assist on 970 */ |
2282 | 2317 | /* XXX: TODO */ |
2283 | 2318 | cpu_abort(env, |
... | ... | @@ -2289,8 +2324,8 @@ void do_interrupt (CPUState *env) |
2289 | 2324 | } |
2290 | 2325 | return; |
2291 | 2326 | case 0x1800: |
2292 | - switch (PPC_EXCP(env)) { | |
2293 | - case PPC_FLAGS_EXCP_970: | |
2327 | + switch (env->excp_model) { | |
2328 | + case POWERPC_EXCP_970: | |
2294 | 2329 | /* Thermal exception on 970 */ |
2295 | 2330 | /* XXX: TODO */ |
2296 | 2331 | cpu_abort(env, "970 thermal management exception " |
... | ... | @@ -2302,19 +2337,19 @@ void do_interrupt (CPUState *env) |
2302 | 2337 | } |
2303 | 2338 | return; |
2304 | 2339 | case 0x2000: |
2305 | - switch (PPC_EXCP(env)) { | |
2306 | - case PPC_FLAGS_EXCP_40x: | |
2340 | + switch (env->excp_model) { | |
2341 | + case POWERPC_EXCP_40x: | |
2307 | 2342 | /* DEBUG on 4xx */ |
2308 | 2343 | /* XXX: TODO */ |
2309 | 2344 | cpu_abort(env, "40x debug exception is not implemented yet !\n"); |
2310 | 2345 | goto store_next; |
2311 | - case PPC_FLAGS_EXCP_601: | |
2346 | + case POWERPC_EXCP_601: | |
2312 | 2347 | /* Run mode exception on 601 */ |
2313 | 2348 | /* XXX: TODO */ |
2314 | 2349 | cpu_abort(env, |
2315 | 2350 | "601 run mode exception is not implemented yet !\n"); |
2316 | 2351 | goto store_next; |
2317 | - case PPC_FLAGS_EXCP_BOOKE: | |
2352 | + case POWERPC_EXCP_BOOKE: | |
2318 | 2353 | srr_0 = &env->spr[SPR_BOOKE_CSRR0]; |
2319 | 2354 | srr_1 = &env->spr[SPR_BOOKE_CSRR1]; |
2320 | 2355 | break; |
... | ... | @@ -2361,7 +2396,7 @@ void do_interrupt (CPUState *env) |
2361 | 2396 | msr_dr = 0; |
2362 | 2397 | msr_ri = 0; |
2363 | 2398 | msr_le = msr_ile; |
2364 | - if (PPC_EXCP(env) == PPC_FLAGS_EXCP_BOOKE) { | |
2399 | + if (env->excp_model == POWERPC_EXCP_BOOKE) { | |
2365 | 2400 | msr_cm = msr_icm; |
2366 | 2401 | if (idx == -1 || (idx >= 16 && idx < 32)) { |
2367 | 2402 | cpu_abort(env, "Invalid exception index for excp %d %08x idx %d\n", | ... | ... |
target-ppc/op.c
... | ... | @@ -2319,7 +2319,6 @@ void OPPROTO op_405_check_satu (void) |
2319 | 2319 | RETURN(); |
2320 | 2320 | } |
2321 | 2321 | |
2322 | -#if !defined(CONFIG_USER_ONLY) | |
2323 | 2322 | void OPPROTO op_load_dcr (void) |
2324 | 2323 | { |
2325 | 2324 | do_load_dcr(); |
... | ... | @@ -2332,6 +2331,7 @@ void OPPROTO op_store_dcr (void) |
2332 | 2331 | RETURN(); |
2333 | 2332 | } |
2334 | 2333 | |
2334 | +#if !defined(CONFIG_USER_ONLY) | |
2335 | 2335 | /* Return from critical interrupt : |
2336 | 2336 | * same as rfi, except nip & MSR are loaded from SRR2/3 instead of SRR0/1 |
2337 | 2337 | */ | ... | ... |
target-ppc/op_helper.c
... | ... | @@ -1206,6 +1206,41 @@ void do_405_check_sat (void) |
1206 | 1206 | } |
1207 | 1207 | } |
1208 | 1208 | |
1209 | +/* XXX: to be improved to check access rights when in user-mode */ | |
1210 | +void do_load_dcr (void) | |
1211 | +{ | |
1212 | + target_ulong val; | |
1213 | + | |
1214 | + if (unlikely(env->dcr_env == NULL)) { | |
1215 | + if (loglevel != 0) { | |
1216 | + fprintf(logfile, "No DCR environment\n"); | |
1217 | + } | |
1218 | + do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_INVAL); | |
1219 | + } else if (unlikely(ppc_dcr_read(env->dcr_env, T0, &val) != 0)) { | |
1220 | + if (loglevel != 0) { | |
1221 | + fprintf(logfile, "DCR read error %d %03x\n", (int)T0, (int)T0); | |
1222 | + } | |
1223 | + do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_PRIV_REG); | |
1224 | + } else { | |
1225 | + T0 = val; | |
1226 | + } | |
1227 | +} | |
1228 | + | |
1229 | +void do_store_dcr (void) | |
1230 | +{ | |
1231 | + if (unlikely(env->dcr_env == NULL)) { | |
1232 | + if (loglevel != 0) { | |
1233 | + fprintf(logfile, "No DCR environment\n"); | |
1234 | + } | |
1235 | + do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_INVAL); | |
1236 | + } else if (unlikely(ppc_dcr_write(env->dcr_env, T0, T1) != 0)) { | |
1237 | + if (loglevel != 0) { | |
1238 | + fprintf(logfile, "DCR write error %d %03x\n", (int)T0, (int)T0); | |
1239 | + } | |
1240 | + do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_PRIV_REG); | |
1241 | + } | |
1242 | +} | |
1243 | + | |
1209 | 1244 | #if !defined(CONFIG_USER_ONLY) |
1210 | 1245 | void do_40x_rfci (void) |
1211 | 1246 | { |
... | ... | @@ -1268,40 +1303,6 @@ void do_rfmci (void) |
1268 | 1303 | env->interrupt_request = CPU_INTERRUPT_EXITTB; |
1269 | 1304 | } |
1270 | 1305 | |
1271 | -void do_load_dcr (void) | |
1272 | -{ | |
1273 | - target_ulong val; | |
1274 | - | |
1275 | - if (unlikely(env->dcr_env == NULL)) { | |
1276 | - if (loglevel != 0) { | |
1277 | - fprintf(logfile, "No DCR environment\n"); | |
1278 | - } | |
1279 | - do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_INVAL); | |
1280 | - } else if (unlikely(ppc_dcr_read(env->dcr_env, T0, &val) != 0)) { | |
1281 | - if (loglevel != 0) { | |
1282 | - fprintf(logfile, "DCR read error %d %03x\n", (int)T0, (int)T0); | |
1283 | - } | |
1284 | - do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_PRIV_REG); | |
1285 | - } else { | |
1286 | - T0 = val; | |
1287 | - } | |
1288 | -} | |
1289 | - | |
1290 | -void do_store_dcr (void) | |
1291 | -{ | |
1292 | - if (unlikely(env->dcr_env == NULL)) { | |
1293 | - if (loglevel != 0) { | |
1294 | - fprintf(logfile, "No DCR environment\n"); | |
1295 | - } | |
1296 | - do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_INVAL); | |
1297 | - } else if (unlikely(ppc_dcr_write(env->dcr_env, T0, T1) != 0)) { | |
1298 | - if (loglevel != 0) { | |
1299 | - fprintf(logfile, "DCR write error %d %03x\n", (int)T0, (int)T0); | |
1300 | - } | |
1301 | - do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_PRIV_REG); | |
1302 | - } | |
1303 | -} | |
1304 | - | |
1305 | 1306 | void do_load_403_pb (int num) |
1306 | 1307 | { |
1307 | 1308 | T0 = env->pb[num]; |
... | ... | @@ -2238,7 +2239,7 @@ void tlb_fill (target_ulong addr, int is_write, int is_user, void *retaddr) |
2238 | 2239 | if (unlikely(ret != 0)) { |
2239 | 2240 | if (likely(retaddr)) { |
2240 | 2241 | /* now we have a real cpu fault */ |
2241 | - pc = (target_phys_addr_t)retaddr; | |
2242 | + pc = (target_phys_addr_t)(unsigned long)retaddr; | |
2242 | 2243 | tb = tb_find_pc(pc); |
2243 | 2244 | if (likely(tb)) { |
2244 | 2245 | /* the PC is inside the translated code. It means that we have |
... | ... | @@ -2261,16 +2262,14 @@ void do_tlbie (void) |
2261 | 2262 | { |
2262 | 2263 | T0 = (uint32_t)T0; |
2263 | 2264 | #if !defined(FLUSH_ALL_TLBS) |
2264 | - if (unlikely(PPC_MMU(env) == PPC_FLAGS_MMU_SOFT_6xx)) { | |
2265 | + /* XXX: Remove thoses tests */ | |
2266 | + if (unlikely(env->mmu_model == POWERPC_MMU_SOFT_6xx)) { | |
2265 | 2267 | ppc6xx_tlb_invalidate_virt(env, T0 & TARGET_PAGE_MASK, 0); |
2266 | 2268 | if (env->id_tlbs == 1) |
2267 | 2269 | ppc6xx_tlb_invalidate_virt(env, T0 & TARGET_PAGE_MASK, 1); |
2268 | - } else if (unlikely(PPC_MMU(env) == PPC_FLAGS_MMU_SOFT_4xx)) { | |
2269 | - /* XXX: TODO */ | |
2270 | -#if 0 | |
2271 | - ppcbooke_tlb_invalidate_virt(env, T0 & TARGET_PAGE_MASK, | |
2272 | - env->spr[SPR_BOOKE_PID]); | |
2273 | -#endif | |
2270 | + } else if (unlikely(env->mmu_model == POWERPC_MMU_SOFT_4xx)) { | |
2271 | + ppc4xx_tlb_invalidate_virt(env, T0 & TARGET_PAGE_MASK, | |
2272 | + env->spr[SPR_40x_PID]); | |
2274 | 2273 | } else { |
2275 | 2274 | /* tlbie invalidate TLBs for all segments */ |
2276 | 2275 | T0 &= TARGET_PAGE_MASK; |
... | ... | @@ -2305,11 +2304,11 @@ void do_tlbie_64 (void) |
2305 | 2304 | { |
2306 | 2305 | T0 = (uint64_t)T0; |
2307 | 2306 | #if !defined(FLUSH_ALL_TLBS) |
2308 | - if (unlikely(PPC_MMU(env) == PPC_FLAGS_MMU_SOFT_6xx)) { | |
2307 | + if (unlikely(env->mmu_model == POWERPC_MMU_SOFT_6xx)) { | |
2309 | 2308 | ppc6xx_tlb_invalidate_virt(env, T0 & TARGET_PAGE_MASK, 0); |
2310 | 2309 | if (env->id_tlbs == 1) |
2311 | 2310 | ppc6xx_tlb_invalidate_virt(env, T0 & TARGET_PAGE_MASK, 1); |
2312 | - } else if (unlikely(PPC_MMU(env) == PPC_FLAGS_MMU_SOFT_4xx)) { | |
2311 | + } else if (unlikely(env->mmu_model == POWERPC_MMU_SOFT_4xx)) { | |
2313 | 2312 | /* XXX: TODO */ |
2314 | 2313 | #if 0 |
2315 | 2314 | ppcbooke_tlb_invalidate_virt(env, T0 & TARGET_PAGE_MASK, |
... | ... | @@ -2541,7 +2540,7 @@ void do_4xx_tlbwe_hi (void) |
2541 | 2540 | "are not supported (%d)\n", |
2542 | 2541 | tlb->size, TARGET_PAGE_SIZE, (int)((T1 >> 7) & 0x7)); |
2543 | 2542 | } |
2544 | - tlb->EPN = (T1 & 0xFFFFFC00) & ~(tlb->size - 1); | |
2543 | + tlb->EPN = T1 & ~(tlb->size - 1); | |
2545 | 2544 | if (T1 & 0x40) |
2546 | 2545 | tlb->prot |= PAGE_VALID; |
2547 | 2546 | else |
... | ... | @@ -2676,14 +2675,14 @@ void do_440_tlbwe (int word) |
2676 | 2675 | |
2677 | 2676 | void do_440_tlbsx (void) |
2678 | 2677 | { |
2679 | - T0 = ppcemb_tlb_search(env, T0, env->spr[SPR_440_MMUCR]); | |
2678 | + T0 = ppcemb_tlb_search(env, T0, env->spr[SPR_440_MMUCR] & 0xFF); | |
2680 | 2679 | } |
2681 | 2680 | |
2682 | 2681 | void do_440_tlbsx_ (void) |
2683 | 2682 | { |
2684 | 2683 | int tmp = xer_so; |
2685 | 2684 | |
2686 | - T0 = ppcemb_tlb_search(env, T0, env->spr[SPR_440_MMUCR]); | |
2685 | + T0 = ppcemb_tlb_search(env, T0, env->spr[SPR_440_MMUCR] & 0xFF); | |
2687 | 2686 | if (T0 != -1) |
2688 | 2687 | tmp |= 0x02; |
2689 | 2688 | env->crf[0] = tmp; | ... | ... |
target-ppc/op_helper.h
... | ... | @@ -167,9 +167,9 @@ void do_440_tlbwe (int word); |
167 | 167 | /* PowerPC 4xx specific helpers */ |
168 | 168 | void do_405_check_ov (void); |
169 | 169 | void do_405_check_sat (void); |
170 | -#if !defined(CONFIG_USER_ONLY) | |
171 | 170 | void do_load_dcr (void); |
172 | 171 | void do_store_dcr (void); |
172 | +#if !defined(CONFIG_USER_ONLY) | |
173 | 173 | void do_40x_rfci (void); |
174 | 174 | void do_rfci (void); |
175 | 175 | void do_rfdi (void); | ... | ... |
target-ppc/translate.c
... | ... | @@ -27,11 +27,14 @@ |
27 | 27 | #include "exec-all.h" |
28 | 28 | #include "disas.h" |
29 | 29 | |
30 | +/* Include definitions for instructions classes and implementations flags */ | |
30 | 31 | //#define DO_SINGLE_STEP |
31 | 32 | //#define PPC_DEBUG_DISAS |
32 | 33 | //#define DEBUG_MEMORY_ACCESSES |
33 | 34 | //#define DO_PPC_STATISTICS |
34 | 35 | |
36 | +/*****************************************************************************/ | |
37 | +/* Code translation helpers */ | |
35 | 38 | #if defined(USE_DIRECT_JUMP) |
36 | 39 | #define TBPARAM(x) |
37 | 40 | #else |
... | ... | @@ -175,8 +178,10 @@ struct opc_handler_t { |
175 | 178 | uint64_t type; |
176 | 179 | /* handler */ |
177 | 180 | void (*handler)(DisasContext *ctx); |
178 | -#if defined(DO_PPC_STATISTICS) | |
181 | +#if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU) | |
179 | 182 | const unsigned char *oname; |
183 | +#endif | |
184 | +#if defined(DO_PPC_STATISTICS) | |
180 | 185 | uint64_t count; |
181 | 186 | #endif |
182 | 187 | }; |
... | ... | @@ -249,6 +254,7 @@ typedef struct opcode_t { |
249 | 254 | const unsigned char *oname; |
250 | 255 | } opcode_t; |
251 | 256 | |
257 | +/*****************************************************************************/ | |
252 | 258 | /*** Instruction decoding ***/ |
253 | 259 | #define EXTRACT_HELPER(name, shift, nb) \ |
254 | 260 | static inline uint32_t name (uint32_t opcode) \ |
... | ... | @@ -365,6 +371,106 @@ static inline target_ulong MASK (uint32_t start, uint32_t end) |
365 | 371 | return ret; |
366 | 372 | } |
367 | 373 | |
374 | +/*****************************************************************************/ | |
375 | +/* PowerPC Instructions types definitions */ | |
376 | +enum { | |
377 | + PPC_NONE = 0x0000000000000000ULL, | |
378 | + /* integer operations instructions */ | |
379 | + /* flow control instructions */ | |
380 | + /* virtual memory instructions */ | |
381 | + /* ld/st with reservation instructions */ | |
382 | + /* cache control instructions */ | |
383 | + /* spr/msr access instructions */ | |
384 | + PPC_INSNS_BASE = 0x0000000000000001ULL, | |
385 | +#define PPC_INTEGER PPC_INSNS_BASE | |
386 | +#define PPC_FLOW PPC_INSNS_BASE | |
387 | +#define PPC_MEM PPC_INSNS_BASE | |
388 | +#define PPC_RES PPC_INSNS_BASE | |
389 | +#define PPC_CACHE PPC_INSNS_BASE | |
390 | +#define PPC_MISC PPC_INSNS_BASE | |
391 | + /* Optional floating point instructions */ | |
392 | + PPC_FLOAT = 0x0000000000000002ULL, | |
393 | + PPC_FLOAT_FSQRT = 0x0000000000000004ULL, | |
394 | + PPC_FLOAT_FRES = 0x0000000000000008ULL, | |
395 | + PPC_FLOAT_FRSQRTE = 0x0000000000000010ULL, | |
396 | + PPC_FLOAT_FSEL = 0x0000000000000020ULL, | |
397 | + PPC_FLOAT_STFIWX = 0x0000000000000040ULL, | |
398 | + /* external control instructions */ | |
399 | + PPC_EXTERN = 0x0000000000000080ULL, | |
400 | + /* segment register access instructions */ | |
401 | + PPC_SEGMENT = 0x0000000000000100ULL, | |
402 | + /* Optional cache control instruction */ | |
403 | + PPC_CACHE_DCBA = 0x0000000000000200ULL, | |
404 | + /* Optional memory control instructions */ | |
405 | + PPC_MEM_TLBIA = 0x0000000000000400ULL, | |
406 | + PPC_MEM_TLBIE = 0x0000000000000800ULL, | |
407 | + PPC_MEM_TLBSYNC = 0x0000000000001000ULL, | |
408 | + /* eieio & sync */ | |
409 | + PPC_MEM_SYNC = 0x0000000000002000ULL, | |
410 | + /* PowerPC 6xx TLB management instructions */ | |
411 | + PPC_6xx_TLB = 0x0000000000004000ULL, | |
412 | + /* Altivec support */ | |
413 | + PPC_ALTIVEC = 0x0000000000008000ULL, | |
414 | + /* Time base mftb instruction */ | |
415 | + PPC_MFTB = 0x0000000000010000ULL, | |
416 | + /* Embedded PowerPC dedicated instructions */ | |
417 | + PPC_EMB_COMMON = 0x0000000000020000ULL, | |
418 | + /* PowerPC 40x exception model */ | |
419 | + PPC_40x_EXCP = 0x0000000000040000ULL, | |
420 | + /* PowerPC 40x TLB management instructions */ | |
421 | + PPC_40x_TLB = 0x0000000000080000ULL, | |
422 | + /* PowerPC 405 Mac instructions */ | |
423 | + PPC_405_MAC = 0x0000000000100000ULL, | |
424 | + /* PowerPC 440 specific instructions */ | |
425 | + PPC_440_SPEC = 0x0000000000200000ULL, | |
426 | + /* Power-to-PowerPC bridge (601) */ | |
427 | + PPC_POWER_BR = 0x0000000000400000ULL, | |
428 | + /* PowerPC 602 specific */ | |
429 | + PPC_602_SPEC = 0x0000000000800000ULL, | |
430 | + /* Deprecated instructions */ | |
431 | + /* Original POWER instruction set */ | |
432 | + PPC_POWER = 0x0000000001000000ULL, | |
433 | + /* POWER2 instruction set extension */ | |
434 | + PPC_POWER2 = 0x0000000002000000ULL, | |
435 | + /* Power RTC support */ | |
436 | + PPC_POWER_RTC = 0x0000000004000000ULL, | |
437 | + /* 64 bits PowerPC instructions */ | |
438 | + /* 64 bits PowerPC instruction set */ | |
439 | + PPC_64B = 0x0000000008000000ULL, | |
440 | + /* 64 bits hypervisor extensions */ | |
441 | + PPC_64H = 0x0000000010000000ULL, | |
442 | + /* 64 bits PowerPC "bridge" features */ | |
443 | + PPC_64_BRIDGE = 0x0000000020000000ULL, | |
444 | + /* BookE (embedded) PowerPC specification */ | |
445 | + PPC_BOOKE = 0x0000000040000000ULL, | |
446 | + /* eieio */ | |
447 | + PPC_MEM_EIEIO = 0x0000000080000000ULL, | |
448 | + /* e500 vector instructions */ | |
449 | + PPC_E500_VECTOR = 0x0000000100000000ULL, | |
450 | + /* PowerPC 4xx dedicated instructions */ | |
451 | + PPC_4xx_COMMON = 0x0000000200000000ULL, | |
452 | + /* PowerPC 2.03 specification extensions */ | |
453 | + PPC_203 = 0x0000000400000000ULL, | |
454 | + /* PowerPC 2.03 SPE extension */ | |
455 | + PPC_SPE = 0x0000000800000000ULL, | |
456 | + /* PowerPC 2.03 SPE floating-point extension */ | |
457 | + PPC_SPEFPU = 0x0000001000000000ULL, | |
458 | + /* SLB management */ | |
459 | + PPC_SLBI = 0x0000002000000000ULL, | |
460 | + /* PowerPC 40x ibct instructions */ | |
461 | + PPC_40x_ICBT = 0x0000004000000000ULL, | |
462 | + /* PowerPC 74xx TLB management instructions */ | |
463 | + PPC_74xx_TLB = 0x0000008000000000ULL, | |
464 | + /* More BookE (embedded) instructions... */ | |
465 | + PPC_BOOKE_EXT = 0x0000010000000000ULL, | |
466 | + /* rfmci is not implemented in all BookE PowerPC */ | |
467 | + PPC_RFMCI = 0x0000020000000000ULL, | |
468 | + /* user-mode DCR access, implemented in PowerPC 460 */ | |
469 | + PPC_DCRUX = 0x0000040000000000ULL, | |
470 | +}; | |
471 | + | |
472 | +/*****************************************************************************/ | |
473 | +/* PowerPC instructions table */ | |
368 | 474 | #if HOST_LONG_BITS == 64 |
369 | 475 | #define OPC_ALIGN 8 |
370 | 476 | #else |
... | ... | @@ -845,15 +951,15 @@ GEN_HANDLER(subfic, 0x08, 0xFF, 0xFF, 0x00000000, PPC_INTEGER) |
845 | 951 | |
846 | 952 | #if defined(TARGET_PPC64) |
847 | 953 | /* mulhd mulhd. */ |
848 | -GEN_INT_ARITHN (mulhd, 0x1F, 0x09, 0x02, PPC_INTEGER); | |
954 | +GEN_INT_ARITHN (mulhd, 0x1F, 0x09, 0x02, PPC_64B); | |
849 | 955 | /* mulhdu mulhdu. */ |
850 | -GEN_INT_ARITHN (mulhdu, 0x1F, 0x09, 0x00, PPC_INTEGER); | |
956 | +GEN_INT_ARITHN (mulhdu, 0x1F, 0x09, 0x00, PPC_64B); | |
851 | 957 | /* mulld mulld. mulldo mulldo. */ |
852 | -GEN_INT_ARITH2 (mulld, 0x1F, 0x09, 0x07, PPC_INTEGER); | |
958 | +GEN_INT_ARITH2 (mulld, 0x1F, 0x09, 0x07, PPC_64B); | |
853 | 959 | /* divd divd. divdo divdo. */ |
854 | -GEN_INT_ARITH2 (divd, 0x1F, 0x09, 0x0F, PPC_INTEGER); | |
960 | +GEN_INT_ARITH2 (divd, 0x1F, 0x09, 0x0F, PPC_64B); | |
855 | 961 | /* divdu divdu. divduo divduo. */ |
856 | -GEN_INT_ARITH2 (divdu, 0x1F, 0x09, 0x0E, PPC_INTEGER); | |
962 | +GEN_INT_ARITH2 (divdu, 0x1F, 0x09, 0x0E, PPC_64B); | |
857 | 963 | #endif |
858 | 964 | |
859 | 965 | /*** Integer comparison ***/ |
... | ... | @@ -1424,8 +1530,8 @@ __GEN_LOGICAL2(srd, 0x1B, 0x10, PPC_64B); |
1424 | 1530 | #endif |
1425 | 1531 | |
1426 | 1532 | /*** Floating-Point arithmetic ***/ |
1427 | -#define _GEN_FLOAT_ACB(name, op, op1, op2, isfloat) \ | |
1428 | -GEN_HANDLER(f##name, op1, op2, 0xFF, 0x00000000, PPC_FLOAT) \ | |
1533 | +#define _GEN_FLOAT_ACB(name, op, op1, op2, isfloat, type) \ | |
1534 | +GEN_HANDLER(f##name, op1, op2, 0xFF, 0x00000000, type) \ | |
1429 | 1535 | { \ |
1430 | 1536 | if (unlikely(!ctx->fpu_enabled)) { \ |
1431 | 1537 | RET_EXCP(ctx, EXCP_NO_FP, 0); \ |
... | ... | @@ -1444,9 +1550,9 @@ GEN_HANDLER(f##name, op1, op2, 0xFF, 0x00000000, PPC_FLOAT) \ |
1444 | 1550 | gen_op_set_Rc1(); \ |
1445 | 1551 | } |
1446 | 1552 | |
1447 | -#define GEN_FLOAT_ACB(name, op2) \ | |
1448 | -_GEN_FLOAT_ACB(name, name, 0x3F, op2, 0); \ | |
1449 | -_GEN_FLOAT_ACB(name##s, name, 0x3B, op2, 1); | |
1553 | +#define GEN_FLOAT_ACB(name, op2, type) \ | |
1554 | +_GEN_FLOAT_ACB(name, name, 0x3F, op2, 0, type); \ | |
1555 | +_GEN_FLOAT_ACB(name##s, name, 0x3B, op2, 1, type); | |
1450 | 1556 | |
1451 | 1557 | #define _GEN_FLOAT_AB(name, op, op1, op2, inval, isfloat) \ |
1452 | 1558 | GEN_HANDLER(f##name, op1, op2, 0xFF, inval, PPC_FLOAT) \ |
... | ... | @@ -1492,8 +1598,8 @@ GEN_HANDLER(f##name, op1, op2, 0xFF, inval, PPC_FLOAT) \ |
1492 | 1598 | _GEN_FLOAT_AC(name, name, 0x3F, op2, inval, 0); \ |
1493 | 1599 | _GEN_FLOAT_AC(name##s, name, 0x3B, op2, inval, 1); |
1494 | 1600 | |
1495 | -#define GEN_FLOAT_B(name, op2, op3) \ | |
1496 | -GEN_HANDLER(f##name, 0x3F, op2, op3, 0x001F0000, PPC_FLOAT) \ | |
1601 | +#define GEN_FLOAT_B(name, op2, op3, type) \ | |
1602 | +GEN_HANDLER(f##name, 0x3F, op2, op3, 0x001F0000, type) \ | |
1497 | 1603 | { \ |
1498 | 1604 | if (unlikely(!ctx->fpu_enabled)) { \ |
1499 | 1605 | RET_EXCP(ctx, EXCP_NO_FP, 0); \ |
... | ... | @@ -1507,8 +1613,8 @@ GEN_HANDLER(f##name, 0x3F, op2, op3, 0x001F0000, PPC_FLOAT) \ |
1507 | 1613 | gen_op_set_Rc1(); \ |
1508 | 1614 | } |
1509 | 1615 | |
1510 | -#define GEN_FLOAT_BS(name, op1, op2) \ | |
1511 | -GEN_HANDLER(f##name, op1, op2, 0xFF, 0x001F07C0, PPC_FLOAT) \ | |
1616 | +#define GEN_FLOAT_BS(name, op1, op2, type) \ | |
1617 | +GEN_HANDLER(f##name, op1, op2, 0xFF, 0x001F07C0, type) \ | |
1512 | 1618 | { \ |
1513 | 1619 | if (unlikely(!ctx->fpu_enabled)) { \ |
1514 | 1620 | RET_EXCP(ctx, EXCP_NO_FP, 0); \ |
... | ... | @@ -1529,19 +1635,19 @@ GEN_FLOAT_AB(div, 0x12, 0x000007C0); |
1529 | 1635 | /* fmul - fmuls */ |
1530 | 1636 | GEN_FLOAT_AC(mul, 0x19, 0x0000F800); |
1531 | 1637 | |
1532 | -/* fres */ /* XXX: not in 601 */ | |
1533 | -GEN_FLOAT_BS(res, 0x3B, 0x18); | |
1638 | +/* fres */ | |
1639 | +GEN_FLOAT_BS(res, 0x3B, 0x18, PPC_FLOAT_FRES); | |
1534 | 1640 | |
1535 | -/* frsqrte */ /* XXX: not in 601 */ | |
1536 | -GEN_FLOAT_BS(rsqrte, 0x3F, 0x1A); | |
1641 | +/* frsqrte */ | |
1642 | +GEN_FLOAT_BS(rsqrte, 0x3F, 0x1A, PPC_FLOAT_FRSQRTE); | |
1537 | 1643 | |
1538 | -/* fsel */ /* XXX: not in 601 */ | |
1539 | -_GEN_FLOAT_ACB(sel, sel, 0x3F, 0x17, 0); | |
1644 | +/* fsel */ | |
1645 | +_GEN_FLOAT_ACB(sel, sel, 0x3F, 0x17, 0, PPC_FLOAT_FSEL); | |
1540 | 1646 | /* fsub - fsubs */ |
1541 | 1647 | GEN_FLOAT_AB(sub, 0x14, 0x000007C0); |
1542 | 1648 | /* Optional: */ |
1543 | 1649 | /* fsqrt */ |
1544 | -GEN_HANDLER(fsqrt, 0x3F, 0x16, 0xFF, 0x001F07C0, PPC_FLOAT_OPT) | |
1650 | +GEN_HANDLER(fsqrt, 0x3F, 0x16, 0xFF, 0x001F07C0, PPC_FLOAT_FSQRT) | |
1545 | 1651 | { |
1546 | 1652 | if (unlikely(!ctx->fpu_enabled)) { |
1547 | 1653 | RET_EXCP(ctx, EXCP_NO_FP, 0); |
... | ... | @@ -1555,7 +1661,7 @@ GEN_HANDLER(fsqrt, 0x3F, 0x16, 0xFF, 0x001F07C0, PPC_FLOAT_OPT) |
1555 | 1661 | gen_op_set_Rc1(); |
1556 | 1662 | } |
1557 | 1663 | |
1558 | -GEN_HANDLER(fsqrts, 0x3B, 0x16, 0xFF, 0x001F07C0, PPC_FLOAT_OPT) | |
1664 | +GEN_HANDLER(fsqrts, 0x3B, 0x16, 0xFF, 0x001F07C0, PPC_FLOAT_FSQRT) | |
1559 | 1665 | { |
1560 | 1666 | if (unlikely(!ctx->fpu_enabled)) { |
1561 | 1667 | RET_EXCP(ctx, EXCP_NO_FP, 0); |
... | ... | @@ -1572,28 +1678,28 @@ GEN_HANDLER(fsqrts, 0x3B, 0x16, 0xFF, 0x001F07C0, PPC_FLOAT_OPT) |
1572 | 1678 | |
1573 | 1679 | /*** Floating-Point multiply-and-add ***/ |
1574 | 1680 | /* fmadd - fmadds */ |
1575 | -GEN_FLOAT_ACB(madd, 0x1D); | |
1681 | +GEN_FLOAT_ACB(madd, 0x1D, PPC_FLOAT); | |
1576 | 1682 | /* fmsub - fmsubs */ |
1577 | -GEN_FLOAT_ACB(msub, 0x1C); | |
1683 | +GEN_FLOAT_ACB(msub, 0x1C, PPC_FLOAT); | |
1578 | 1684 | /* fnmadd - fnmadds */ |
1579 | -GEN_FLOAT_ACB(nmadd, 0x1F); | |
1685 | +GEN_FLOAT_ACB(nmadd, 0x1F, PPC_FLOAT); | |
1580 | 1686 | /* fnmsub - fnmsubs */ |
1581 | -GEN_FLOAT_ACB(nmsub, 0x1E); | |
1687 | +GEN_FLOAT_ACB(nmsub, 0x1E, PPC_FLOAT); | |
1582 | 1688 | |
1583 | 1689 | /*** Floating-Point round & convert ***/ |
1584 | 1690 | /* fctiw */ |
1585 | -GEN_FLOAT_B(ctiw, 0x0E, 0x00); | |
1691 | +GEN_FLOAT_B(ctiw, 0x0E, 0x00, PPC_FLOAT); | |
1586 | 1692 | /* fctiwz */ |
1587 | -GEN_FLOAT_B(ctiwz, 0x0F, 0x00); | |
1693 | +GEN_FLOAT_B(ctiwz, 0x0F, 0x00, PPC_FLOAT); | |
1588 | 1694 | /* frsp */ |
1589 | -GEN_FLOAT_B(rsp, 0x0C, 0x00); | |
1695 | +GEN_FLOAT_B(rsp, 0x0C, 0x00, PPC_FLOAT); | |
1590 | 1696 | #if defined(TARGET_PPC64) |
1591 | 1697 | /* fcfid */ |
1592 | -GEN_FLOAT_B(cfid, 0x0E, 0x1A); | |
1698 | +GEN_FLOAT_B(cfid, 0x0E, 0x1A, PPC_64B); | |
1593 | 1699 | /* fctid */ |
1594 | -GEN_FLOAT_B(ctid, 0x0E, 0x19); | |
1700 | +GEN_FLOAT_B(ctid, 0x0E, 0x19, PPC_64B); | |
1595 | 1701 | /* fctidz */ |
1596 | -GEN_FLOAT_B(ctidz, 0x0F, 0x19); | |
1702 | +GEN_FLOAT_B(ctidz, 0x0F, 0x19, PPC_64B); | |
1597 | 1703 | #endif |
1598 | 1704 | |
1599 | 1705 | /*** Floating-Point compare ***/ |
... | ... | @@ -1627,7 +1733,7 @@ GEN_HANDLER(fcmpu, 0x3F, 0x00, 0x00, 0x00600001, PPC_FLOAT) |
1627 | 1733 | |
1628 | 1734 | /*** Floating-point move ***/ |
1629 | 1735 | /* fabs */ |
1630 | -GEN_FLOAT_B(abs, 0x08, 0x08); | |
1736 | +GEN_FLOAT_B(abs, 0x08, 0x08, PPC_FLOAT); | |
1631 | 1737 | |
1632 | 1738 | /* fmr - fmr. */ |
1633 | 1739 | GEN_HANDLER(fmr, 0x3F, 0x08, 0x02, 0x001F0000, PPC_FLOAT) |
... | ... | @@ -1644,9 +1750,9 @@ GEN_HANDLER(fmr, 0x3F, 0x08, 0x02, 0x001F0000, PPC_FLOAT) |
1644 | 1750 | } |
1645 | 1751 | |
1646 | 1752 | /* fnabs */ |
1647 | -GEN_FLOAT_B(nabs, 0x08, 0x04); | |
1753 | +GEN_FLOAT_B(nabs, 0x08, 0x04, PPC_FLOAT); | |
1648 | 1754 | /* fneg */ |
1649 | -GEN_FLOAT_B(neg, 0x08, 0x01); | |
1755 | +GEN_FLOAT_B(neg, 0x08, 0x01, PPC_FLOAT); | |
1650 | 1756 | |
1651 | 1757 | /*** Floating-Point status & ctrl register ***/ |
1652 | 1758 | /* mcrfs */ |
... | ... | @@ -2426,7 +2532,7 @@ static GenOpFunc *gen_op_stdcx[] = { |
2426 | 2532 | #endif |
2427 | 2533 | |
2428 | 2534 | /* ldarx */ |
2429 | -GEN_HANDLER(ldarx, 0x1F, 0x14, 0x02, 0x00000001, PPC_RES) | |
2535 | +GEN_HANDLER(ldarx, 0x1F, 0x14, 0x02, 0x00000001, PPC_64B) | |
2430 | 2536 | { |
2431 | 2537 | gen_addr_reg_index(ctx); |
2432 | 2538 | op_ldarx(); |
... | ... | @@ -2434,7 +2540,7 @@ GEN_HANDLER(ldarx, 0x1F, 0x14, 0x02, 0x00000001, PPC_RES) |
2434 | 2540 | } |
2435 | 2541 | |
2436 | 2542 | /* stdcx. */ |
2437 | -GEN_HANDLER(stdcx_, 0x1F, 0x16, 0x06, 0x00000000, PPC_RES) | |
2543 | +GEN_HANDLER(stdcx_, 0x1F, 0x16, 0x06, 0x00000000, PPC_64B) | |
2438 | 2544 | { |
2439 | 2545 | gen_addr_reg_index(ctx); |
2440 | 2546 | gen_op_load_gpr_T1(rS(ctx->opcode)); |
... | ... | @@ -2591,7 +2697,7 @@ GEN_STFS(fs, 0x14); |
2591 | 2697 | |
2592 | 2698 | /* Optional: */ |
2593 | 2699 | /* stfiwx */ |
2594 | -GEN_HANDLER(stfiwx, 0x1F, 0x17, 0x1E, 0x00000001, PPC_FLOAT) | |
2700 | +GEN_HANDLER(stfiwx, 0x1F, 0x17, 0x1E, 0x00000001, PPC_FLOAT_STFIWX) | |
2595 | 2701 | { |
2596 | 2702 | if (unlikely(!ctx->fpu_enabled)) { |
2597 | 2703 | RET_EXCP(ctx, EXCP_NO_FP, 0); |
... | ... | @@ -2886,7 +2992,7 @@ GEN_HANDLER(rfi, 0x13, 0x12, 0x01, 0x03FF8001, PPC_FLOW) |
2886 | 2992 | } |
2887 | 2993 | |
2888 | 2994 | #if defined(TARGET_PPC64) |
2889 | -GEN_HANDLER(rfid, 0x13, 0x12, 0x00, 0x03FF8001, PPC_FLOW) | |
2995 | +GEN_HANDLER(rfid, 0x13, 0x12, 0x00, 0x03FF8001, PPC_64B) | |
2890 | 2996 | { |
2891 | 2997 | #if defined(CONFIG_USER_ONLY) |
2892 | 2998 | RET_PRIVOPC(ctx); |
... | ... | @@ -3050,7 +3156,7 @@ GEN_HANDLER(mfspr, 0x1F, 0x13, 0x0A, 0x00000001, PPC_MISC) |
3050 | 3156 | } |
3051 | 3157 | |
3052 | 3158 | /* mftb */ |
3053 | -GEN_HANDLER(mftb, 0x1F, 0x13, 0x0B, 0x00000001, PPC_TB) | |
3159 | +GEN_HANDLER(mftb, 0x1F, 0x13, 0x0B, 0x00000001, PPC_MFTB) | |
3054 | 3160 | { |
3055 | 3161 | gen_op_mfspr(ctx); |
3056 | 3162 | } |
... | ... | @@ -3074,7 +3180,7 @@ GEN_HANDLER(mtcrf, 0x1F, 0x10, 0x04, 0x00000801, PPC_MISC) |
3074 | 3180 | |
3075 | 3181 | /* mtmsr */ |
3076 | 3182 | #if defined(TARGET_PPC64) |
3077 | -GEN_HANDLER(mtmsrd, 0x1F, 0x12, 0x05, 0x001FF801, PPC_MISC) | |
3183 | +GEN_HANDLER(mtmsrd, 0x1F, 0x12, 0x05, 0x001FF801, PPC_64B) | |
3078 | 3184 | { |
3079 | 3185 | #if defined(CONFIG_USER_ONLY) |
3080 | 3186 | RET_PRIVREG(ctx); |
... | ... | @@ -3296,7 +3402,7 @@ GEN_HANDLER(icbi, 0x1F, 0x16, 0x1E, 0x03E00001, PPC_CACHE) |
3296 | 3402 | |
3297 | 3403 | /* Optional: */ |
3298 | 3404 | /* dcba */ |
3299 | -GEN_HANDLER(dcba, 0x1F, 0x16, 0x17, 0x03E00001, PPC_CACHE_OPT) | |
3405 | +GEN_HANDLER(dcba, 0x1F, 0x16, 0x17, 0x03E00001, PPC_CACHE_DCBA) | |
3300 | 3406 | { |
3301 | 3407 | } |
3302 | 3408 | |
... | ... | @@ -3568,7 +3674,7 @@ GEN_HANDLER(abso, 0x1F, 0x08, 0x1B, 0x0000F800, PPC_POWER_BR) |
3568 | 3674 | } |
3569 | 3675 | |
3570 | 3676 | /* clcs */ |
3571 | -GEN_HANDLER(clcs, 0x1F, 0x10, 0x13, 0x0000F800, PPC_POWER_BR) /* 601 ? */ | |
3677 | +GEN_HANDLER(clcs, 0x1F, 0x10, 0x13, 0x0000F800, PPC_POWER_BR) | |
3572 | 3678 | { |
3573 | 3679 | gen_op_load_gpr_T0(rA(ctx->opcode)); |
3574 | 3680 | gen_op_POWER_clcs(); |
... | ... | @@ -4222,14 +4328,14 @@ GEN_HANDLER(stfqx, 0x1F, 0x17, 0x1C, 0x00000001, PPC_POWER2) |
4222 | 4328 | |
4223 | 4329 | /* BookE specific instructions */ |
4224 | 4330 | /* XXX: not implemented on 440 ? */ |
4225 | -GEN_HANDLER(mfapidi, 0x1F, 0x13, 0x08, 0x0000F801, PPC_BOOKE) | |
4331 | +GEN_HANDLER(mfapidi, 0x1F, 0x13, 0x08, 0x0000F801, PPC_BOOKE_EXT) | |
4226 | 4332 | { |
4227 | 4333 | /* XXX: TODO */ |
4228 | 4334 | RET_INVAL(ctx); |
4229 | 4335 | } |
4230 | 4336 | |
4231 | 4337 | /* XXX: not implemented on 440 ? */ |
4232 | -GEN_HANDLER(tlbiva, 0x1F, 0x12, 0x18, 0x03FFF801, PPC_BOOKE) | |
4338 | +GEN_HANDLER(tlbiva, 0x1F, 0x12, 0x18, 0x03FFF801, PPC_BOOKE_EXT) | |
4233 | 4339 | { |
4234 | 4340 | #if defined(CONFIG_USER_ONLY) |
4235 | 4341 | RET_PRIVOPC(ctx); |
... | ... | @@ -4331,99 +4437,98 @@ static inline void gen_405_mulladd_insn (DisasContext *ctx, int opc2, int opc3, |
4331 | 4437 | } |
4332 | 4438 | } |
4333 | 4439 | |
4334 | -#define GEN_MAC_HANDLER(name, opc2, opc3, is_440) \ | |
4335 | -GEN_HANDLER(name, 0x04, opc2, opc3, 0x00000000, \ | |
4336 | - is_440 ? PPC_440_SPEC : PPC_405_MAC) \ | |
4440 | +#define GEN_MAC_HANDLER(name, opc2, opc3) \ | |
4441 | +GEN_HANDLER(name, 0x04, opc2, opc3, 0x00000000, PPC_405_MAC) \ | |
4337 | 4442 | { \ |
4338 | 4443 | gen_405_mulladd_insn(ctx, opc2, opc3, rA(ctx->opcode), rB(ctx->opcode), \ |
4339 | 4444 | rD(ctx->opcode), Rc(ctx->opcode)); \ |
4340 | 4445 | } |
4341 | 4446 | |
4342 | 4447 | /* macchw - macchw. */ |
4343 | -GEN_MAC_HANDLER(macchw, 0x0C, 0x05, 0); | |
4448 | +GEN_MAC_HANDLER(macchw, 0x0C, 0x05); | |
4344 | 4449 | /* macchwo - macchwo. */ |
4345 | -GEN_MAC_HANDLER(macchwo, 0x0C, 0x15, 0); | |
4450 | +GEN_MAC_HANDLER(macchwo, 0x0C, 0x15); | |
4346 | 4451 | /* macchws - macchws. */ |
4347 | -GEN_MAC_HANDLER(macchws, 0x0C, 0x07, 0); | |
4452 | +GEN_MAC_HANDLER(macchws, 0x0C, 0x07); | |
4348 | 4453 | /* macchwso - macchwso. */ |
4349 | -GEN_MAC_HANDLER(macchwso, 0x0C, 0x17, 0); | |
4454 | +GEN_MAC_HANDLER(macchwso, 0x0C, 0x17); | |
4350 | 4455 | /* macchwsu - macchwsu. */ |
4351 | -GEN_MAC_HANDLER(macchwsu, 0x0C, 0x06, 0); | |
4456 | +GEN_MAC_HANDLER(macchwsu, 0x0C, 0x06); | |
4352 | 4457 | /* macchwsuo - macchwsuo. */ |
4353 | -GEN_MAC_HANDLER(macchwsuo, 0x0C, 0x16, 0); | |
4458 | +GEN_MAC_HANDLER(macchwsuo, 0x0C, 0x16); | |
4354 | 4459 | /* macchwu - macchwu. */ |
4355 | -GEN_MAC_HANDLER(macchwu, 0x0C, 0x04, 0); | |
4460 | +GEN_MAC_HANDLER(macchwu, 0x0C, 0x04); | |
4356 | 4461 | /* macchwuo - macchwuo. */ |
4357 | -GEN_MAC_HANDLER(macchwuo, 0x0C, 0x14, 0); | |
4462 | +GEN_MAC_HANDLER(macchwuo, 0x0C, 0x14); | |
4358 | 4463 | /* machhw - machhw. */ |
4359 | -GEN_MAC_HANDLER(machhw, 0x0C, 0x01, 0); | |
4464 | +GEN_MAC_HANDLER(machhw, 0x0C, 0x01); | |
4360 | 4465 | /* machhwo - machhwo. */ |
4361 | -GEN_MAC_HANDLER(machhwo, 0x0C, 0x11, 0); | |
4466 | +GEN_MAC_HANDLER(machhwo, 0x0C, 0x11); | |
4362 | 4467 | /* machhws - machhws. */ |
4363 | -GEN_MAC_HANDLER(machhws, 0x0C, 0x03, 0); | |
4468 | +GEN_MAC_HANDLER(machhws, 0x0C, 0x03); | |
4364 | 4469 | /* machhwso - machhwso. */ |
4365 | -GEN_MAC_HANDLER(machhwso, 0x0C, 0x13, 0); | |
4470 | +GEN_MAC_HANDLER(machhwso, 0x0C, 0x13); | |
4366 | 4471 | /* machhwsu - machhwsu. */ |
4367 | -GEN_MAC_HANDLER(machhwsu, 0x0C, 0x02, 0); | |
4472 | +GEN_MAC_HANDLER(machhwsu, 0x0C, 0x02); | |
4368 | 4473 | /* machhwsuo - machhwsuo. */ |
4369 | -GEN_MAC_HANDLER(machhwsuo, 0x0C, 0x12, 0); | |
4474 | +GEN_MAC_HANDLER(machhwsuo, 0x0C, 0x12); | |
4370 | 4475 | /* machhwu - machhwu. */ |
4371 | -GEN_MAC_HANDLER(machhwu, 0x0C, 0x00, 0); | |
4476 | +GEN_MAC_HANDLER(machhwu, 0x0C, 0x00); | |
4372 | 4477 | /* machhwuo - machhwuo. */ |
4373 | -GEN_MAC_HANDLER(machhwuo, 0x0C, 0x10, 0); | |
4478 | +GEN_MAC_HANDLER(machhwuo, 0x0C, 0x10); | |
4374 | 4479 | /* maclhw - maclhw. */ |
4375 | -GEN_MAC_HANDLER(maclhw, 0x0C, 0x0D, 0); | |
4480 | +GEN_MAC_HANDLER(maclhw, 0x0C, 0x0D); | |
4376 | 4481 | /* maclhwo - maclhwo. */ |
4377 | -GEN_MAC_HANDLER(maclhwo, 0x0C, 0x1D, 0); | |
4482 | +GEN_MAC_HANDLER(maclhwo, 0x0C, 0x1D); | |
4378 | 4483 | /* maclhws - maclhws. */ |
4379 | -GEN_MAC_HANDLER(maclhws, 0x0C, 0x0F, 0); | |
4484 | +GEN_MAC_HANDLER(maclhws, 0x0C, 0x0F); | |
4380 | 4485 | /* maclhwso - maclhwso. */ |
4381 | -GEN_MAC_HANDLER(maclhwso, 0x0C, 0x1F, 0); | |
4486 | +GEN_MAC_HANDLER(maclhwso, 0x0C, 0x1F); | |
4382 | 4487 | /* maclhwu - maclhwu. */ |
4383 | -GEN_MAC_HANDLER(maclhwu, 0x0C, 0x0C, 0); | |
4488 | +GEN_MAC_HANDLER(maclhwu, 0x0C, 0x0C); | |
4384 | 4489 | /* maclhwuo - maclhwuo. */ |
4385 | -GEN_MAC_HANDLER(maclhwuo, 0x0C, 0x1C, 0); | |
4490 | +GEN_MAC_HANDLER(maclhwuo, 0x0C, 0x1C); | |
4386 | 4491 | /* maclhwsu - maclhwsu. */ |
4387 | -GEN_MAC_HANDLER(maclhwsu, 0x0C, 0x0E, 0); | |
4492 | +GEN_MAC_HANDLER(maclhwsu, 0x0C, 0x0E); | |
4388 | 4493 | /* maclhwsuo - maclhwsuo. */ |
4389 | -GEN_MAC_HANDLER(maclhwsuo, 0x0C, 0x1E, 0); | |
4494 | +GEN_MAC_HANDLER(maclhwsuo, 0x0C, 0x1E); | |
4390 | 4495 | /* nmacchw - nmacchw. */ |
4391 | -GEN_MAC_HANDLER(nmacchw, 0x0E, 0x05, 0); | |
4496 | +GEN_MAC_HANDLER(nmacchw, 0x0E, 0x05); | |
4392 | 4497 | /* nmacchwo - nmacchwo. */ |
4393 | -GEN_MAC_HANDLER(nmacchwo, 0x0E, 0x15, 0); | |
4498 | +GEN_MAC_HANDLER(nmacchwo, 0x0E, 0x15); | |
4394 | 4499 | /* nmacchws - nmacchws. */ |
4395 | -GEN_MAC_HANDLER(nmacchws, 0x0E, 0x07, 0); | |
4500 | +GEN_MAC_HANDLER(nmacchws, 0x0E, 0x07); | |
4396 | 4501 | /* nmacchwso - nmacchwso. */ |
4397 | -GEN_MAC_HANDLER(nmacchwso, 0x0E, 0x17, 0); | |
4502 | +GEN_MAC_HANDLER(nmacchwso, 0x0E, 0x17); | |
4398 | 4503 | /* nmachhw - nmachhw. */ |
4399 | -GEN_MAC_HANDLER(nmachhw, 0x0E, 0x01, 0); | |
4504 | +GEN_MAC_HANDLER(nmachhw, 0x0E, 0x01); | |
4400 | 4505 | /* nmachhwo - nmachhwo. */ |
4401 | -GEN_MAC_HANDLER(nmachhwo, 0x0E, 0x11, 0); | |
4506 | +GEN_MAC_HANDLER(nmachhwo, 0x0E, 0x11); | |
4402 | 4507 | /* nmachhws - nmachhws. */ |
4403 | -GEN_MAC_HANDLER(nmachhws, 0x0E, 0x03, 1); | |
4508 | +GEN_MAC_HANDLER(nmachhws, 0x0E, 0x03); | |
4404 | 4509 | /* nmachhwso - nmachhwso. */ |
4405 | -GEN_MAC_HANDLER(nmachhwso, 0x0E, 0x13, 1); | |
4510 | +GEN_MAC_HANDLER(nmachhwso, 0x0E, 0x13); | |
4406 | 4511 | /* nmaclhw - nmaclhw. */ |
4407 | -GEN_MAC_HANDLER(nmaclhw, 0x0E, 0x0D, 1); | |
4512 | +GEN_MAC_HANDLER(nmaclhw, 0x0E, 0x0D); | |
4408 | 4513 | /* nmaclhwo - nmaclhwo. */ |
4409 | -GEN_MAC_HANDLER(nmaclhwo, 0x0E, 0x1D, 1); | |
4514 | +GEN_MAC_HANDLER(nmaclhwo, 0x0E, 0x1D); | |
4410 | 4515 | /* nmaclhws - nmaclhws. */ |
4411 | -GEN_MAC_HANDLER(nmaclhws, 0x0E, 0x0F, 1); | |
4516 | +GEN_MAC_HANDLER(nmaclhws, 0x0E, 0x0F); | |
4412 | 4517 | /* nmaclhwso - nmaclhwso. */ |
4413 | -GEN_MAC_HANDLER(nmaclhwso, 0x0E, 0x1F, 1); | |
4518 | +GEN_MAC_HANDLER(nmaclhwso, 0x0E, 0x1F); | |
4414 | 4519 | |
4415 | 4520 | /* mulchw - mulchw. */ |
4416 | -GEN_MAC_HANDLER(mulchw, 0x08, 0x05, 0); | |
4521 | +GEN_MAC_HANDLER(mulchw, 0x08, 0x05); | |
4417 | 4522 | /* mulchwu - mulchwu. */ |
4418 | -GEN_MAC_HANDLER(mulchwu, 0x08, 0x04, 0); | |
4523 | +GEN_MAC_HANDLER(mulchwu, 0x08, 0x04); | |
4419 | 4524 | /* mulhhw - mulhhw. */ |
4420 | -GEN_MAC_HANDLER(mulhhw, 0x08, 0x01, 0); | |
4525 | +GEN_MAC_HANDLER(mulhhw, 0x08, 0x01); | |
4421 | 4526 | /* mulhhwu - mulhhwu. */ |
4422 | -GEN_MAC_HANDLER(mulhhwu, 0x08, 0x00, 0); | |
4527 | +GEN_MAC_HANDLER(mulhhwu, 0x08, 0x00); | |
4423 | 4528 | /* mullhw - mullhw. */ |
4424 | -GEN_MAC_HANDLER(mullhw, 0x08, 0x0D, 0); | |
4529 | +GEN_MAC_HANDLER(mullhw, 0x08, 0x0D); | |
4425 | 4530 | /* mullhwu - mullhwu. */ |
4426 | -GEN_MAC_HANDLER(mullhwu, 0x08, 0x0C, 0); | |
4531 | +GEN_MAC_HANDLER(mullhwu, 0x08, 0x0C); | |
4427 | 4532 | |
4428 | 4533 | /* mfdcr */ |
4429 | 4534 | GEN_HANDLER(mfdcr, 0x1F, 0x03, 0x0A, 0x00000001, PPC_EMB_COMMON) |
... | ... | @@ -4463,7 +4568,7 @@ GEN_HANDLER(mtdcr, 0x1F, 0x03, 0x0E, 0x00000001, PPC_EMB_COMMON) |
4463 | 4568 | |
4464 | 4569 | /* mfdcrx */ |
4465 | 4570 | /* XXX: not implemented on 440 ? */ |
4466 | -GEN_HANDLER(mfdcrx, 0x1F, 0x03, 0x08, 0x00000001, PPC_BOOKE) | |
4571 | +GEN_HANDLER(mfdcrx, 0x1F, 0x03, 0x08, 0x00000000, PPC_BOOKE_EXT) | |
4467 | 4572 | { |
4468 | 4573 | #if defined(CONFIG_USER_ONLY) |
4469 | 4574 | RET_PRIVREG(ctx); |
... | ... | @@ -4475,12 +4580,13 @@ GEN_HANDLER(mfdcrx, 0x1F, 0x03, 0x08, 0x00000001, PPC_BOOKE) |
4475 | 4580 | gen_op_load_gpr_T0(rA(ctx->opcode)); |
4476 | 4581 | gen_op_load_dcr(); |
4477 | 4582 | gen_op_store_T0_gpr(rD(ctx->opcode)); |
4583 | + /* Note: Rc update flag set leads to undefined state of Rc0 */ | |
4478 | 4584 | #endif |
4479 | 4585 | } |
4480 | 4586 | |
4481 | 4587 | /* mtdcrx */ |
4482 | 4588 | /* XXX: not implemented on 440 ? */ |
4483 | -GEN_HANDLER(mtdcrx, 0x1F, 0x03, 0x0C, 0x00000001, PPC_BOOKE) | |
4589 | +GEN_HANDLER(mtdcrx, 0x1F, 0x03, 0x0C, 0x00000000, PPC_BOOKE_EXT) | |
4484 | 4590 | { |
4485 | 4591 | #if defined(CONFIG_USER_ONLY) |
4486 | 4592 | RET_PRIVREG(ctx); |
... | ... | @@ -4492,9 +4598,28 @@ GEN_HANDLER(mtdcrx, 0x1F, 0x03, 0x0C, 0x00000001, PPC_BOOKE) |
4492 | 4598 | gen_op_load_gpr_T0(rA(ctx->opcode)); |
4493 | 4599 | gen_op_load_gpr_T1(rS(ctx->opcode)); |
4494 | 4600 | gen_op_store_dcr(); |
4601 | + /* Note: Rc update flag set leads to undefined state of Rc0 */ | |
4495 | 4602 | #endif |
4496 | 4603 | } |
4497 | 4604 | |
4605 | +/* mfdcrux (PPC 460) : user-mode access to DCR */ | |
4606 | +GEN_HANDLER(mfdcrux, 0x1F, 0x03, 0x09, 0x00000000, PPC_DCRUX) | |
4607 | +{ | |
4608 | + gen_op_load_gpr_T0(rA(ctx->opcode)); | |
4609 | + gen_op_load_dcr(); | |
4610 | + gen_op_store_T0_gpr(rD(ctx->opcode)); | |
4611 | + /* Note: Rc update flag set leads to undefined state of Rc0 */ | |
4612 | +} | |
4613 | + | |
4614 | +/* mtdcrux (PPC 460) : user-mode access to DCR */ | |
4615 | +GEN_HANDLER(mtdcrux, 0x1F, 0x03, 0x0D, 0x00000000, PPC_DCRUX) | |
4616 | +{ | |
4617 | + gen_op_load_gpr_T0(rA(ctx->opcode)); | |
4618 | + gen_op_load_gpr_T1(rS(ctx->opcode)); | |
4619 | + gen_op_store_dcr(); | |
4620 | + /* Note: Rc update flag set leads to undefined state of Rc0 */ | |
4621 | +} | |
4622 | + | |
4498 | 4623 | /* dccci */ |
4499 | 4624 | GEN_HANDLER(dccci, 0x1F, 0x06, 0x0E, 0x03E00001, PPC_4xx_COMMON) |
4500 | 4625 | { |
... | ... | @@ -4595,7 +4720,7 @@ GEN_HANDLER(rfci, 0x13, 0x13, 0x01, 0x03FF8001, PPC_BOOKE) |
4595 | 4720 | |
4596 | 4721 | /* BookE specific */ |
4597 | 4722 | /* XXX: not implemented on 440 ? */ |
4598 | -GEN_HANDLER(rfdi, 0x13, 0x07, 0x01, 0x03FF8001, PPC_BOOKE) | |
4723 | +GEN_HANDLER(rfdi, 0x13, 0x07, 0x01, 0x03FF8001, PPC_BOOKE_EXT) | |
4599 | 4724 | { |
4600 | 4725 | #if defined(CONFIG_USER_ONLY) |
4601 | 4726 | RET_PRIVOPC(ctx); |
... | ... | @@ -4611,7 +4736,7 @@ GEN_HANDLER(rfdi, 0x13, 0x07, 0x01, 0x03FF8001, PPC_BOOKE) |
4611 | 4736 | } |
4612 | 4737 | |
4613 | 4738 | /* XXX: not implemented on 440 ? */ |
4614 | -GEN_HANDLER(rfmci, 0x13, 0x06, 0x01, 0x03FF8001, PPC_BOOKE) | |
4739 | +GEN_HANDLER(rfmci, 0x13, 0x06, 0x01, 0x03FF8001, PPC_RFMCI) | |
4615 | 4740 | { |
4616 | 4741 | #if defined(CONFIG_USER_ONLY) |
4617 | 4742 | RET_PRIVOPC(ctx); |
... | ... | @@ -4628,7 +4753,7 @@ GEN_HANDLER(rfmci, 0x13, 0x06, 0x01, 0x03FF8001, PPC_BOOKE) |
4628 | 4753 | |
4629 | 4754 | /* TLB management - PowerPC 405 implementation */ |
4630 | 4755 | /* tlbre */ |
4631 | -GEN_HANDLER(tlbre_40x, 0x1F, 0x12, 0x1D, 0x00000001, PPC_40x_SPEC) | |
4756 | +GEN_HANDLER(tlbre_40x, 0x1F, 0x12, 0x1D, 0x00000001, PPC_40x_TLB) | |
4632 | 4757 | { |
4633 | 4758 | #if defined(CONFIG_USER_ONLY) |
4634 | 4759 | RET_PRIVOPC(ctx); |
... | ... | @@ -4656,7 +4781,7 @@ GEN_HANDLER(tlbre_40x, 0x1F, 0x12, 0x1D, 0x00000001, PPC_40x_SPEC) |
4656 | 4781 | } |
4657 | 4782 | |
4658 | 4783 | /* tlbsx - tlbsx. */ |
4659 | -GEN_HANDLER(tlbsx_40x, 0x1F, 0x12, 0x1C, 0x00000000, PPC_40x_SPEC) | |
4784 | +GEN_HANDLER(tlbsx_40x, 0x1F, 0x12, 0x1C, 0x00000000, PPC_40x_TLB) | |
4660 | 4785 | { |
4661 | 4786 | #if defined(CONFIG_USER_ONLY) |
4662 | 4787 | RET_PRIVOPC(ctx); |
... | ... | @@ -4675,7 +4800,7 @@ GEN_HANDLER(tlbsx_40x, 0x1F, 0x12, 0x1C, 0x00000000, PPC_40x_SPEC) |
4675 | 4800 | } |
4676 | 4801 | |
4677 | 4802 | /* tlbwe */ |
4678 | -GEN_HANDLER(tlbwe_40x, 0x1F, 0x12, 0x1E, 0x00000001, PPC_40x_SPEC) | |
4803 | +GEN_HANDLER(tlbwe_40x, 0x1F, 0x12, 0x1E, 0x00000001, PPC_40x_TLB) | |
4679 | 4804 | { |
4680 | 4805 | #if defined(CONFIG_USER_ONLY) |
4681 | 4806 | RET_PRIVOPC(ctx); |
... | ... | @@ -5701,7 +5826,7 @@ void cpu_dump_state (CPUState *env, FILE *f, |
5701 | 5826 | for (i = 0; i < 32; i++) { |
5702 | 5827 | if ((i & (RGPL - 1)) == 0) |
5703 | 5828 | cpu_fprintf(f, "GPR%02d", i); |
5704 | - cpu_fprintf(f, " " REGX, env->gpr[i]); | |
5829 | + cpu_fprintf(f, " " REGX, (target_ulong)env->gpr[i]); | |
5705 | 5830 | if ((i & (RGPL - 1)) == (RGPL - 1)) |
5706 | 5831 | cpu_fprintf(f, "\n"); |
5707 | 5832 | } | ... | ... |