1 |
/* |
2 |
* PearPC |
3 |
* ppc_dec.cc |
4 |
* |
5 |
* Copyright (C) 2003, 2004 Sebastian Biallas (sb@biallas.net) |
6 |
* Copyright (C) 2004 Daniel Foesch (dfoesch@cs.nmsu.edu) |
7 |
* |
8 |
* This program is free software; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License version 2 as |
10 |
* published by the Free Software Foundation. |
11 |
* |
12 |
* This program is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with this program; if not, write to the Free Software |
19 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 |
*/ |
21 |
|
22 |
|
23 |
#include <cstring> |
24 |
|
25 |
#include "system/types.h" |
26 |
#include "debug/tracers.h" |
27 |
#include "cpu/cpu.h" |
28 |
#include "ppc_alu.h" |
29 |
#include "ppc_cpu.h" |
30 |
#include "ppc_dec.h" |
31 |
#include "ppc_esc.h" |
32 |
#include "ppc_exc.h" |
33 |
#include "ppc_fpu.h" |
34 |
#include "ppc_vec.h" |
35 |
#include "ppc_mmu.h" |
36 |
#include "ppc_opc.h" |
37 |
#include "jitc_asm.h" |
38 |
#include "x86asm.h" |
39 |
|
40 |
#include "io/prom/promosi.h" |
41 |
|
42 |
static void ppc_opc_invalid() |
43 |
{ |
44 |
SINGLESTEP("unknown instruction\n"); |
45 |
} |
46 |
|
47 |
static JITCFlow ppc_opc_gen_invalid() |
48 |
{ |
49 |
// PPC_DEC_WARN("invalid instruction 0x%08x\n", gJITC.current_opc); |
50 |
jitcClobberAll(); |
51 |
asmALURegImm(X86_MOV, ESI, gJITC.pc); |
52 |
asmALURegImm(X86_MOV, EDX, gJITC.current_opc); |
53 |
asmALURegImm(X86_MOV, ECX, PPC_EXC_PROGRAM_ILL); |
54 |
asmJMP((NativeAddress)ppc_program_exception_asm); |
55 |
return flowEndBlockUnreachable; |
56 |
} |
57 |
|
58 |
static void ppc_opc_special() |
59 |
{ |
60 |
if (gCPU.pc == gPromOSIEntry && gCPU.current_opc == PROM_MAGIC_OPCODE) { |
61 |
call_prom_osi(); |
62 |
return; |
63 |
} |
64 |
if (gCPU.current_opc == 0x00333301) { |
65 |
// memset(r3, r4, r5) |
66 |
uint32 dest = gCPU.gpr[3]; |
67 |
uint32 c = gCPU.gpr[4]; |
68 |
uint32 size = gCPU.gpr[5]; |
69 |
if (dest & 0xfff) { |
70 |
byte *dst; |
71 |
ppc_direct_effective_memory_handle(dest, dst); |
72 |
uint32 a = 4096 - (dest & 0xfff); |
73 |
memset(dst, c, a); |
74 |
size -= a; |
75 |
dest += a; |
76 |
} |
77 |
while (size >= 4096) { |
78 |
byte *dst; |
79 |
ppc_direct_effective_memory_handle(dest, dst); |
80 |
memset(dst, c, 4096); |
81 |
dest += 4096; |
82 |
size -= 4096; |
83 |
} |
84 |
if (size) { |
85 |
byte *dst; |
86 |
ppc_direct_effective_memory_handle(dest, dst); |
87 |
memset(dst, c, size); |
88 |
} |
89 |
gCPU.pc = gCPU.npc; |
90 |
return; |
91 |
} |
92 |
if (gCPU.current_opc == 0x00333302) { |
93 |
// memcpy |
94 |
uint32 dest = gCPU.gpr[3]; |
95 |
uint32 src = gCPU.gpr[4]; |
96 |
uint32 size = gCPU.gpr[5]; |
97 |
byte *d, *s; |
98 |
ppc_direct_effective_memory_handle(dest, d); |
99 |
ppc_direct_effective_memory_handle(src, s); |
100 |
while (size--) { |
101 |
if (!(dest & 0xfff)) ppc_direct_effective_memory_handle(dest, d); |
102 |
if (!(src & 0xfff)) ppc_direct_effective_memory_handle(src, s); |
103 |
*d = *s; |
104 |
src++; dest++; d++; s++; |
105 |
} |
106 |
gCPU.pc = gCPU.npc; |
107 |
return; |
108 |
} |
109 |
ppc_opc_invalid(); |
110 |
} |
111 |
|
112 |
static JITCFlow ppc_opc_gen_special() |
113 |
{ |
114 |
if (gJITC.current_opc == PPC_OPC_ESCAPE_VM) { |
115 |
jitcGetClientRegister(PPC_GPR(3), NATIVE_REG | EAX); |
116 |
jitcClobberAll(); |
117 |
asmALURegReg(X86_MOV, EDX, ESP); |
118 |
asmALURegImm(X86_MOV, ECX, gJITC.pc); |
119 |
PPC_ESC_TRACE("pc = %08x\n", gJITC.pc); |
120 |
asmCALL((NativeAddress)&ppc_escape_vm); |
121 |
return flowEndBlock; |
122 |
} |
123 |
if (gJITC.pc == (gPromOSIEntry&0xfff) && gJITC.current_opc == PROM_MAGIC_OPCODE) { |
124 |
jitcClobberAll(); |
125 |
|
126 |
asmMOVRegDMem(EAX, (uint32)&gCPU.current_code_base); |
127 |
asmALURegImm(X86_ADD, EAX, gJITC.pc); |
128 |
asmMOVDMemReg((uint32)&gCPU.pc, EAX); |
129 |
asmCALL((NativeAddress)&call_prom_osi); |
130 |
return flowEndBlock; |
131 |
} |
132 |
return ppc_opc_gen_invalid(); |
133 |
} |
134 |
|
135 |
// main opcode 19 |
136 |
static void ppc_opc_group_1() |
137 |
{ |
138 |
uint32 ext = PPC_OPC_EXT(gCPU.current_opc); |
139 |
if (ext & 1) { |
140 |
// crxxx |
141 |
if (ext <= 225) { |
142 |
switch (ext) { |
143 |
case 33: ppc_opc_crnor(); return; |
144 |
case 129: ppc_opc_crandc(); return; |
145 |
case 193: ppc_opc_crxor(); return; |
146 |
case 225: ppc_opc_crnand(); return; |
147 |
} |
148 |
} else { |
149 |
switch (ext) { |
150 |
case 257: ppc_opc_crand(); return; |
151 |
case 289: ppc_opc_creqv(); return; |
152 |
case 417: ppc_opc_crorc(); return; |
153 |
case 449: ppc_opc_cror(); return; |
154 |
} |
155 |
} |
156 |
} else if (ext & (1<<9)) { |
157 |
// bcctrx |
158 |
if (ext == 528) { |
159 |
ppc_opc_bcctrx(); |
160 |
return; |
161 |
} |
162 |
} else { |
163 |
switch (ext) { |
164 |
case 16: ppc_opc_bclrx(); return; |
165 |
case 0: ppc_opc_mcrf(); return; |
166 |
case 50: ppc_opc_rfi(); return; |
167 |
case 150: ppc_opc_isync(); return; |
168 |
} |
169 |
} |
170 |
return ppc_opc_invalid(); |
171 |
} |
172 |
static JITCFlow ppc_opc_gen_group_1() |
173 |
{ |
174 |
uint32 ext = PPC_OPC_EXT(gJITC.current_opc); |
175 |
if (ext & 1) { |
176 |
// crxxx |
177 |
if (ext <= 225) { |
178 |
switch (ext) { |
179 |
case 33: return ppc_opc_gen_crnor(); |
180 |
case 129: return ppc_opc_gen_crandc(); |
181 |
case 193: return ppc_opc_gen_crxor(); |
182 |
case 225: return ppc_opc_gen_crnand(); |
183 |
} |
184 |
} else { |
185 |
switch (ext) { |
186 |
case 257: return ppc_opc_gen_crand(); |
187 |
case 289: return ppc_opc_gen_creqv(); |
188 |
case 417: return ppc_opc_gen_crorc(); |
189 |
case 449: return ppc_opc_gen_cror(); |
190 |
} |
191 |
} |
192 |
} else if (ext & (1<<9)) { |
193 |
// bcctrx |
194 |
if (ext == 528) { |
195 |
return ppc_opc_gen_bcctrx(); |
196 |
} |
197 |
} else { |
198 |
switch (ext) { |
199 |
case 16: return ppc_opc_gen_bclrx(); |
200 |
case 0: return ppc_opc_gen_mcrf(); |
201 |
case 50: return ppc_opc_gen_rfi(); |
202 |
case 150: return ppc_opc_gen_isync(); |
203 |
} |
204 |
} |
205 |
return ppc_opc_gen_invalid(); |
206 |
} |
207 |
|
208 |
ppc_opc_function ppc_opc_table_group2[1015]; |
209 |
ppc_opc_gen_function ppc_opc_table_gen_group2[1015]; |
210 |
|
211 |
// main opcode 31 |
212 |
static void ppc_opc_init_group2() |
213 |
{ |
214 |
for (uint i=0; i<(sizeof ppc_opc_table_group2 / sizeof ppc_opc_table_group2[0]); i++) { |
215 |
ppc_opc_table_group2[i] = ppc_opc_invalid; |
216 |
ppc_opc_table_gen_group2[i] = ppc_opc_gen_invalid; |
217 |
} |
218 |
ppc_opc_table_group2[0] = ppc_opc_cmp; |
219 |
ppc_opc_table_group2[4] = ppc_opc_tw; |
220 |
ppc_opc_table_group2[8] = ppc_opc_subfcx;//+ |
221 |
ppc_opc_table_group2[10] = ppc_opc_addcx;//+ |
222 |
ppc_opc_table_group2[11] = ppc_opc_mulhwux; |
223 |
ppc_opc_table_group2[19] = ppc_opc_mfcr; |
224 |
ppc_opc_table_group2[20] = ppc_opc_lwarx; |
225 |
ppc_opc_table_group2[23] = ppc_opc_lwzx; |
226 |
ppc_opc_table_group2[24] = ppc_opc_slwx; |
227 |
ppc_opc_table_group2[26] = ppc_opc_cntlzwx; |
228 |
ppc_opc_table_group2[28] = ppc_opc_andx; |
229 |
ppc_opc_table_group2[32] = ppc_opc_cmpl; |
230 |
ppc_opc_table_group2[40] = ppc_opc_subfx; |
231 |
ppc_opc_table_group2[54] = ppc_opc_dcbst; |
232 |
ppc_opc_table_group2[55] = ppc_opc_lwzux; |
233 |
ppc_opc_table_group2[60] = ppc_opc_andcx; |
234 |
ppc_opc_table_group2[75] = ppc_opc_mulhwx; |
235 |
ppc_opc_table_group2[83] = ppc_opc_mfmsr; |
236 |
ppc_opc_table_group2[86] = ppc_opc_dcbf; |
237 |
ppc_opc_table_group2[87] = ppc_opc_lbzx; |
238 |
ppc_opc_table_group2[104] = ppc_opc_negx; |
239 |
ppc_opc_table_group2[119] = ppc_opc_lbzux; |
240 |
ppc_opc_table_group2[124] = ppc_opc_norx; |
241 |
ppc_opc_table_group2[136] = ppc_opc_subfex;//+ |
242 |
ppc_opc_table_group2[138] = ppc_opc_addex;//+ |
243 |
ppc_opc_table_group2[144] = ppc_opc_mtcrf; |
244 |
ppc_opc_table_group2[146] = ppc_opc_mtmsr; |
245 |
ppc_opc_table_group2[150] = ppc_opc_stwcx_; |
246 |
ppc_opc_table_group2[151] = ppc_opc_stwx; |
247 |
ppc_opc_table_group2[183] = ppc_opc_stwux; |
248 |
ppc_opc_table_group2[200] = ppc_opc_subfzex;//+ |
249 |
ppc_opc_table_group2[202] = ppc_opc_addzex;//+ |
250 |
ppc_opc_table_group2[210] = ppc_opc_mtsr; |
251 |
ppc_opc_table_group2[215] = ppc_opc_stbx; |
252 |
ppc_opc_table_group2[232] = ppc_opc_subfmex;//+ |
253 |
ppc_opc_table_group2[234] = ppc_opc_addmex; |
254 |
ppc_opc_table_group2[235] = ppc_opc_mullwx;//+ |
255 |
ppc_opc_table_group2[242] = ppc_opc_mtsrin; |
256 |
ppc_opc_table_group2[246] = ppc_opc_dcbtst; |
257 |
ppc_opc_table_group2[247] = ppc_opc_stbux; |
258 |
ppc_opc_table_group2[266] = ppc_opc_addx;//+ |
259 |
ppc_opc_table_group2[278] = ppc_opc_dcbt; |
260 |
ppc_opc_table_group2[279] = ppc_opc_lhzx; |
261 |
ppc_opc_table_group2[284] = ppc_opc_eqvx; |
262 |
ppc_opc_table_group2[306] = ppc_opc_tlbie; |
263 |
ppc_opc_table_group2[310] = ppc_opc_eciwx; |
264 |
ppc_opc_table_group2[311] = ppc_opc_lhzux; |
265 |
ppc_opc_table_group2[316] = ppc_opc_xorx; |
266 |
ppc_opc_table_group2[339] = ppc_opc_mfspr; |
267 |
ppc_opc_table_group2[343] = ppc_opc_lhax; |
268 |
ppc_opc_table_group2[370] = ppc_opc_tlbia; |
269 |
ppc_opc_table_group2[371] = ppc_opc_mftb; |
270 |
ppc_opc_table_group2[375] = ppc_opc_lhaux; |
271 |
ppc_opc_table_group2[407] = ppc_opc_sthx; |
272 |
ppc_opc_table_group2[412] = ppc_opc_orcx; |
273 |
ppc_opc_table_group2[438] = ppc_opc_ecowx; |
274 |
ppc_opc_table_group2[439] = ppc_opc_sthux; |
275 |
ppc_opc_table_group2[444] = ppc_opc_orx; |
276 |
ppc_opc_table_group2[459] = ppc_opc_divwux;//+ |
277 |
ppc_opc_table_group2[467] = ppc_opc_mtspr; |
278 |
ppc_opc_table_group2[470] = ppc_opc_dcbi; |
279 |
ppc_opc_table_group2[476] = ppc_opc_nandx; |
280 |
ppc_opc_table_group2[491] = ppc_opc_divwx;//+ |
281 |
ppc_opc_table_group2[512] = ppc_opc_mcrxr; |
282 |
ppc_opc_table_group2[533] = ppc_opc_lswx; |
283 |
ppc_opc_table_group2[534] = ppc_opc_lwbrx; |
284 |
ppc_opc_table_group2[535] = ppc_opc_lfsx; |
285 |
ppc_opc_table_group2[536] = ppc_opc_srwx; |
286 |
ppc_opc_table_group2[566] = ppc_opc_tlbsync; |
287 |
ppc_opc_table_group2[567] = ppc_opc_lfsux; |
288 |
ppc_opc_table_group2[595] = ppc_opc_mfsr; |
289 |
ppc_opc_table_group2[597] = ppc_opc_lswi; |
290 |
ppc_opc_table_group2[598] = ppc_opc_sync; |
291 |
ppc_opc_table_group2[599] = ppc_opc_lfdx; |
292 |
ppc_opc_table_group2[631] = ppc_opc_lfdux; |
293 |
ppc_opc_table_group2[659] = ppc_opc_mfsrin; |
294 |
ppc_opc_table_group2[661] = ppc_opc_stswx; |
295 |
ppc_opc_table_group2[662] = ppc_opc_stwbrx; |
296 |
ppc_opc_table_group2[663] = ppc_opc_stfsx; |
297 |
ppc_opc_table_group2[695] = ppc_opc_stfsux; |
298 |
ppc_opc_table_group2[725] = ppc_opc_stswi; |
299 |
ppc_opc_table_group2[727] = ppc_opc_stfdx; |
300 |
ppc_opc_table_group2[758] = ppc_opc_dcba; |
301 |
ppc_opc_table_group2[759] = ppc_opc_stfdux; |
302 |
ppc_opc_table_group2[790] = ppc_opc_lhbrx; |
303 |
ppc_opc_table_group2[792] = ppc_opc_srawx; |
304 |
ppc_opc_table_group2[824] = ppc_opc_srawix; |
305 |
ppc_opc_table_group2[854] = ppc_opc_eieio; |
306 |
ppc_opc_table_group2[918] = ppc_opc_sthbrx; |
307 |
ppc_opc_table_group2[922] = ppc_opc_extshx; |
308 |
ppc_opc_table_group2[954] = ppc_opc_extsbx; |
309 |
ppc_opc_table_group2[982] = ppc_opc_icbi; |
310 |
ppc_opc_table_group2[983] = ppc_opc_stfiwx; |
311 |
ppc_opc_table_group2[1014] = ppc_opc_dcbz; |
312 |
ppc_opc_table_gen_group2[0] = ppc_opc_gen_cmp; |
313 |
ppc_opc_table_gen_group2[4] = ppc_opc_gen_tw; |
314 |
ppc_opc_table_gen_group2[8] = ppc_opc_gen_subfcx;//+ |
315 |
ppc_opc_table_gen_group2[10] = ppc_opc_gen_addcx;//+ |
316 |
ppc_opc_table_gen_group2[11] = ppc_opc_gen_mulhwux; |
317 |
ppc_opc_table_gen_group2[19] = ppc_opc_gen_mfcr; |
318 |
ppc_opc_table_gen_group2[20] = ppc_opc_gen_lwarx; |
319 |
ppc_opc_table_gen_group2[23] = ppc_opc_gen_lwzx; |
320 |
ppc_opc_table_gen_group2[24] = ppc_opc_gen_slwx; |
321 |
ppc_opc_table_gen_group2[26] = ppc_opc_gen_cntlzwx; |
322 |
ppc_opc_table_gen_group2[28] = ppc_opc_gen_andx; |
323 |
ppc_opc_table_gen_group2[32] = ppc_opc_gen_cmpl; |
324 |
ppc_opc_table_gen_group2[40] = ppc_opc_gen_subfx; |
325 |
ppc_opc_table_gen_group2[54] = ppc_opc_gen_dcbst; |
326 |
ppc_opc_table_gen_group2[55] = ppc_opc_gen_lwzux; |
327 |
ppc_opc_table_gen_group2[60] = ppc_opc_gen_andcx; |
328 |
ppc_opc_table_gen_group2[75] = ppc_opc_gen_mulhwx; |
329 |
ppc_opc_table_gen_group2[83] = ppc_opc_gen_mfmsr; |
330 |
ppc_opc_table_gen_group2[86] = ppc_opc_gen_dcbf; |
331 |
ppc_opc_table_gen_group2[87] = ppc_opc_gen_lbzx; |
332 |
ppc_opc_table_gen_group2[104] = ppc_opc_gen_negx; |
333 |
ppc_opc_table_gen_group2[119] = ppc_opc_gen_lbzux; |
334 |
ppc_opc_table_gen_group2[124] = ppc_opc_gen_norx; |
335 |
ppc_opc_table_gen_group2[136] = ppc_opc_gen_subfex;//+ |
336 |
ppc_opc_table_gen_group2[138] = ppc_opc_gen_addex;//+ |
337 |
ppc_opc_table_gen_group2[144] = ppc_opc_gen_mtcrf; |
338 |
ppc_opc_table_gen_group2[146] = ppc_opc_gen_mtmsr; |
339 |
ppc_opc_table_gen_group2[150] = ppc_opc_gen_stwcx_; |
340 |
ppc_opc_table_gen_group2[151] = ppc_opc_gen_stwx; |
341 |
ppc_opc_table_gen_group2[183] = ppc_opc_gen_stwux; |
342 |
ppc_opc_table_gen_group2[200] = ppc_opc_gen_subfzex;//+ |
343 |
ppc_opc_table_gen_group2[202] = ppc_opc_gen_addzex;//+ |
344 |
ppc_opc_table_gen_group2[210] = ppc_opc_gen_mtsr; |
345 |
ppc_opc_table_gen_group2[215] = ppc_opc_gen_stbx; |
346 |
ppc_opc_table_gen_group2[232] = ppc_opc_gen_subfmex;//+ |
347 |
ppc_opc_table_gen_group2[234] = ppc_opc_gen_addmex; |
348 |
ppc_opc_table_gen_group2[235] = ppc_opc_gen_mullwx;//+ |
349 |
ppc_opc_table_gen_group2[242] = ppc_opc_gen_mtsrin; |
350 |
ppc_opc_table_gen_group2[246] = ppc_opc_gen_dcbtst; |
351 |
ppc_opc_table_gen_group2[247] = ppc_opc_gen_stbux; |
352 |
ppc_opc_table_gen_group2[266] = ppc_opc_gen_addx;//+ |
353 |
ppc_opc_table_gen_group2[278] = ppc_opc_gen_dcbt; |
354 |
ppc_opc_table_gen_group2[279] = ppc_opc_gen_lhzx; |
355 |
ppc_opc_table_gen_group2[284] = ppc_opc_gen_eqvx; |
356 |
ppc_opc_table_gen_group2[306] = ppc_opc_gen_tlbie; |
357 |
ppc_opc_table_gen_group2[310] = ppc_opc_gen_eciwx; |
358 |
ppc_opc_table_gen_group2[311] = ppc_opc_gen_lhzux; |
359 |
ppc_opc_table_gen_group2[316] = ppc_opc_gen_xorx; |
360 |
ppc_opc_table_gen_group2[339] = ppc_opc_gen_mfspr; |
361 |
ppc_opc_table_gen_group2[343] = ppc_opc_gen_lhax; |
362 |
ppc_opc_table_gen_group2[370] = ppc_opc_gen_tlbia; |
363 |
ppc_opc_table_gen_group2[371] = ppc_opc_gen_mftb; |
364 |
ppc_opc_table_gen_group2[375] = ppc_opc_gen_lhaux; |
365 |
ppc_opc_table_gen_group2[407] = ppc_opc_gen_sthx; |
366 |
ppc_opc_table_gen_group2[412] = ppc_opc_gen_orcx; |
367 |
ppc_opc_table_gen_group2[438] = ppc_opc_gen_ecowx; |
368 |
ppc_opc_table_gen_group2[439] = ppc_opc_gen_sthux; |
369 |
ppc_opc_table_gen_group2[444] = ppc_opc_gen_orx; |
370 |
ppc_opc_table_gen_group2[459] = ppc_opc_gen_divwux;//+ |
371 |
ppc_opc_table_gen_group2[467] = ppc_opc_gen_mtspr; |
372 |
ppc_opc_table_gen_group2[470] = ppc_opc_gen_dcbi; |
373 |
ppc_opc_table_gen_group2[476] = ppc_opc_gen_nandx; |
374 |
ppc_opc_table_gen_group2[491] = ppc_opc_gen_divwx;//+ |
375 |
ppc_opc_table_gen_group2[512] = ppc_opc_gen_mcrxr; |
376 |
ppc_opc_table_gen_group2[533] = ppc_opc_gen_lswx; |
377 |
ppc_opc_table_gen_group2[534] = ppc_opc_gen_lwbrx; |
378 |
ppc_opc_table_gen_group2[535] = ppc_opc_gen_lfsx; |
379 |
ppc_opc_table_gen_group2[536] = ppc_opc_gen_srwx; |
380 |
ppc_opc_table_gen_group2[566] = ppc_opc_gen_tlbsync; |
381 |
ppc_opc_table_gen_group2[567] = ppc_opc_gen_lfsux; |
382 |
ppc_opc_table_gen_group2[595] = ppc_opc_gen_mfsr; |
383 |
ppc_opc_table_gen_group2[597] = ppc_opc_gen_lswi; |
384 |
ppc_opc_table_gen_group2[598] = ppc_opc_gen_sync; |
385 |
ppc_opc_table_gen_group2[599] = ppc_opc_gen_lfdx; |
386 |
ppc_opc_table_gen_group2[631] = ppc_opc_gen_lfdux; |
387 |
ppc_opc_table_gen_group2[659] = ppc_opc_gen_mfsrin; |
388 |
ppc_opc_table_gen_group2[661] = ppc_opc_gen_stswx; |
389 |
ppc_opc_table_gen_group2[662] = ppc_opc_gen_stwbrx; |
390 |
ppc_opc_table_gen_group2[663] = ppc_opc_gen_stfsx; |
391 |
ppc_opc_table_gen_group2[695] = ppc_opc_gen_stfsux; |
392 |
ppc_opc_table_gen_group2[725] = ppc_opc_gen_stswi; |
393 |
ppc_opc_table_gen_group2[727] = ppc_opc_gen_stfdx; |
394 |
ppc_opc_table_gen_group2[758] = ppc_opc_gen_dcba; |
395 |
ppc_opc_table_gen_group2[759] = ppc_opc_gen_stfdux; |
396 |
ppc_opc_table_gen_group2[790] = ppc_opc_gen_lhbrx; |
397 |
ppc_opc_table_gen_group2[792] = ppc_opc_gen_srawx; |
398 |
ppc_opc_table_gen_group2[824] = ppc_opc_gen_srawix; |
399 |
ppc_opc_table_gen_group2[854] = ppc_opc_gen_eieio; |
400 |
ppc_opc_table_gen_group2[918] = ppc_opc_gen_sthbrx; |
401 |
ppc_opc_table_gen_group2[922] = ppc_opc_gen_extshx; |
402 |
ppc_opc_table_gen_group2[954] = ppc_opc_gen_extsbx; |
403 |
ppc_opc_table_gen_group2[982] = ppc_opc_gen_icbi; |
404 |
ppc_opc_table_gen_group2[983] = ppc_opc_gen_stfiwx; |
405 |
ppc_opc_table_gen_group2[1014] = ppc_opc_gen_dcbz; |
406 |
|
407 |
if ((ppc_cpu_get_pvr(0) & 0xffff0000) == 0x000c0000) { |
408 |
/* Added for Altivec support */ |
409 |
ppc_opc_table_group2[6] = ppc_opc_lvsl; |
410 |
ppc_opc_table_group2[7] = ppc_opc_lvebx; |
411 |
ppc_opc_table_group2[38] = ppc_opc_lvsr; |
412 |
ppc_opc_table_group2[39] = ppc_opc_lvehx; |
413 |
ppc_opc_table_group2[71] = ppc_opc_lvewx; |
414 |
ppc_opc_table_group2[103] = ppc_opc_lvx; |
415 |
ppc_opc_table_group2[135] = ppc_opc_stvebx; |
416 |
ppc_opc_table_group2[167] = ppc_opc_stvehx; |
417 |
ppc_opc_table_group2[199] = ppc_opc_stvewx; |
418 |
ppc_opc_table_group2[231] = ppc_opc_stvx; |
419 |
ppc_opc_table_group2[342] = ppc_opc_dst; |
420 |
ppc_opc_table_group2[359] = ppc_opc_lvxl; |
421 |
ppc_opc_table_group2[374] = ppc_opc_dstst; |
422 |
ppc_opc_table_group2[487] = ppc_opc_stvxl; |
423 |
ppc_opc_table_group2[822] = ppc_opc_dss; |
424 |
|
425 |
ppc_opc_table_gen_group2[6] = ppc_opc_gen_lvsl; |
426 |
ppc_opc_table_gen_group2[7] = ppc_opc_gen_lvebx; |
427 |
ppc_opc_table_gen_group2[38] = ppc_opc_gen_lvsr; |
428 |
ppc_opc_table_gen_group2[39] = ppc_opc_gen_lvehx; |
429 |
ppc_opc_table_gen_group2[71] = ppc_opc_gen_lvewx; |
430 |
ppc_opc_table_gen_group2[103] = ppc_opc_gen_lvx; |
431 |
ppc_opc_table_gen_group2[135] = ppc_opc_gen_stvebx; |
432 |
ppc_opc_table_gen_group2[167] = ppc_opc_gen_stvehx; |
433 |
ppc_opc_table_gen_group2[199] = ppc_opc_gen_stvewx; |
434 |
ppc_opc_table_gen_group2[231] = ppc_opc_gen_stvx; |
435 |
ppc_opc_table_gen_group2[342] = ppc_opc_gen_dst; |
436 |
ppc_opc_table_gen_group2[359] = ppc_opc_gen_lvxl; |
437 |
ppc_opc_table_gen_group2[374] = ppc_opc_gen_dstst; |
438 |
ppc_opc_table_gen_group2[487] = ppc_opc_gen_stvxl; |
439 |
ppc_opc_table_gen_group2[822] = ppc_opc_gen_dss; |
440 |
} |
441 |
} |
442 |
|
443 |
// main opcode 31 |
444 |
static void ppc_opc_group_2() |
445 |
{ |
446 |
uint32 ext = PPC_OPC_EXT(gCPU.current_opc); |
447 |
if (ext >= (sizeof ppc_opc_table_group2 / sizeof ppc_opc_table_group2[0])) { |
448 |
ppc_opc_invalid(); |
449 |
} |
450 |
ppc_opc_table_group2[ext](); |
451 |
} |
452 |
static JITCFlow ppc_opc_gen_group_2() |
453 |
{ |
454 |
uint32 ext = PPC_OPC_EXT(gJITC.current_opc); |
455 |
if (ext >= (sizeof ppc_opc_table_group2 / sizeof ppc_opc_table_group2[0])) { |
456 |
return ppc_opc_gen_invalid(); |
457 |
} |
458 |
return ppc_opc_table_gen_group2[ext](); |
459 |
} |
460 |
|
461 |
// main opcode 59 |
462 |
static void ppc_opc_group_f1() |
463 |
{ |
464 |
if ((gCPU.msr & MSR_FP) == 0) { |
465 |
ppc_exception(PPC_EXC_NO_FPU); |
466 |
return; |
467 |
} |
468 |
uint32 ext = PPC_OPC_EXT(gCPU.current_opc); |
469 |
switch (ext & 0x1f) { |
470 |
case 18: ppc_opc_fdivsx(); return; |
471 |
case 20: ppc_opc_fsubsx(); return; |
472 |
case 21: ppc_opc_faddsx(); return; |
473 |
case 22: ppc_opc_fsqrtsx(); return; |
474 |
case 24: ppc_opc_fresx(); return; |
475 |
case 25: ppc_opc_fmulsx(); return; |
476 |
case 28: ppc_opc_fmsubsx(); return; |
477 |
case 29: ppc_opc_fmaddsx(); return; |
478 |
case 30: ppc_opc_fnmsubsx(); return; |
479 |
case 31: ppc_opc_fnmaddsx(); return; |
480 |
} |
481 |
ppc_opc_invalid(); |
482 |
} |
483 |
static JITCFlow ppc_opc_gen_group_f1() |
484 |
{ |
485 |
ppc_opc_gen_check_fpu(); |
486 |
uint32 ext = PPC_OPC_EXT(gJITC.current_opc); |
487 |
switch (ext & 0x1f) { |
488 |
case 18: return ppc_opc_gen_fdivsx(); |
489 |
case 20: return ppc_opc_gen_fsubsx(); |
490 |
case 21: return ppc_opc_gen_faddsx(); |
491 |
case 22: return ppc_opc_gen_fsqrtsx(); |
492 |
case 24: return ppc_opc_gen_fresx(); |
493 |
case 25: return ppc_opc_gen_fmulsx(); |
494 |
case 28: return ppc_opc_gen_fmsubsx(); |
495 |
case 29: return ppc_opc_gen_fmaddsx(); |
496 |
case 30: return ppc_opc_gen_fnmsubsx(); |
497 |
case 31: return ppc_opc_gen_fnmaddsx(); |
498 |
} |
499 |
return ppc_opc_gen_invalid(); |
500 |
} |
501 |
|
502 |
// main opcode 63 |
503 |
static void ppc_opc_group_f2() |
504 |
{ |
505 |
if ((gCPU.msr & MSR_FP) == 0) { |
506 |
ppc_exception(PPC_EXC_NO_FPU); |
507 |
return; |
508 |
} |
509 |
uint32 ext = PPC_OPC_EXT(gCPU.current_opc); |
510 |
if (ext & 16) { |
511 |
switch (ext & 0x1f) { |
512 |
case 18: ppc_opc_fdivx(); return; |
513 |
case 20: ppc_opc_fsubx(); return; |
514 |
case 21: ppc_opc_faddx(); return; |
515 |
case 22: ppc_opc_fsqrtx(); return; |
516 |
case 23: ppc_opc_fselx(); return; |
517 |
case 25: ppc_opc_fmulx(); return; |
518 |
case 26: ppc_opc_frsqrtex(); return; |
519 |
case 28: ppc_opc_fmsubx(); return; |
520 |
case 29: ppc_opc_fmaddx(); return; |
521 |
case 30: ppc_opc_fnmsubx(); return; |
522 |
case 31: ppc_opc_fnmaddx(); return; |
523 |
} |
524 |
} else { |
525 |
switch (ext) { |
526 |
case 0: ppc_opc_fcmpu(); return; |
527 |
case 12: ppc_opc_frspx(); return; |
528 |
case 14: ppc_opc_fctiwx(); return; |
529 |
case 15: ppc_opc_fctiwzx(); return; |
530 |
//-- |
531 |
case 32: ppc_opc_fcmpo(); return; |
532 |
case 38: ppc_opc_mtfsb1x(); return; |
533 |
case 40: ppc_opc_fnegx(); return; |
534 |
case 64: ppc_opc_mcrfs(); return; |
535 |
case 70: ppc_opc_mtfsb0x(); return; |
536 |
case 72: ppc_opc_fmrx(); return; |
537 |
case 134: ppc_opc_mtfsfix(); return; |
538 |
case 136: ppc_opc_fnabsx(); return; |
539 |
case 264: ppc_opc_fabsx(); return; |
540 |
case 583: ppc_opc_mffsx(); return; |
541 |
case 711: ppc_opc_mtfsfx(); return; |
542 |
} |
543 |
} |
544 |
ppc_opc_invalid(); |
545 |
} |
546 |
static JITCFlow ppc_opc_gen_group_f2() |
547 |
{ |
548 |
ppc_opc_gen_check_fpu(); |
549 |
uint32 ext = PPC_OPC_EXT(gJITC.current_opc); |
550 |
if (ext & 16) { |
551 |
switch (ext & 0x1f) { |
552 |
case 18: return ppc_opc_gen_fdivx(); |
553 |
case 20: return ppc_opc_gen_fsubx(); |
554 |
case 21: return ppc_opc_gen_faddx(); |
555 |
case 22: return ppc_opc_gen_fsqrtx(); |
556 |
case 23: return ppc_opc_gen_fselx(); |
557 |
case 25: return ppc_opc_gen_fmulx(); |
558 |
case 26: return ppc_opc_gen_frsqrtex(); |
559 |
case 28: return ppc_opc_gen_fmsubx(); |
560 |
case 29: return ppc_opc_gen_fmaddx(); |
561 |
case 30: return ppc_opc_gen_fnmsubx(); |
562 |
case 31: return ppc_opc_gen_fnmaddx(); |
563 |
} |
564 |
} else { |
565 |
switch (ext) { |
566 |
case 0: return ppc_opc_gen_fcmpu(); |
567 |
case 12: return ppc_opc_gen_frspx(); |
568 |
case 14: return ppc_opc_gen_fctiwx(); |
569 |
case 15: return ppc_opc_gen_fctiwzx(); |
570 |
//-- |
571 |
case 32: return ppc_opc_gen_fcmpo(); |
572 |
case 38: return ppc_opc_gen_mtfsb1x(); |
573 |
case 40: return ppc_opc_gen_fnegx(); |
574 |
case 64: return ppc_opc_gen_mcrfs(); |
575 |
case 70: return ppc_opc_gen_mtfsb0x(); |
576 |
case 72: return ppc_opc_gen_fmrx(); |
577 |
case 134: return ppc_opc_gen_mtfsfix(); |
578 |
case 136: return ppc_opc_gen_fnabsx(); |
579 |
case 264: return ppc_opc_gen_fabsx(); |
580 |
case 583: return ppc_opc_gen_mffsx(); |
581 |
case 711: return ppc_opc_gen_mtfsfx(); |
582 |
} |
583 |
} |
584 |
return ppc_opc_gen_invalid(); |
585 |
} |
586 |
|
587 |
ppc_opc_function ppc_opc_table_groupv[965]; |
588 |
ppc_opc_gen_function ppc_opc_table_gen_groupv[965]; |
589 |
|
590 |
static void ppc_opc_init_groupv() |
591 |
{ |
592 |
for (uint i=0; i<(sizeof ppc_opc_table_groupv / sizeof ppc_opc_table_groupv[0]);i++) { |
593 |
ppc_opc_table_groupv[i] = ppc_opc_invalid; |
594 |
ppc_opc_table_gen_groupv[i] = ppc_opc_gen_invalid; |
595 |
} |
596 |
ppc_opc_table_groupv[0] = ppc_opc_vaddubm; |
597 |
ppc_opc_table_groupv[1] = ppc_opc_vmaxub; |
598 |
ppc_opc_table_groupv[2] = ppc_opc_vrlb; |
599 |
ppc_opc_table_groupv[4] = ppc_opc_vmuloub; |
600 |
ppc_opc_table_groupv[5] = ppc_opc_vaddfp; |
601 |
ppc_opc_table_groupv[6] = ppc_opc_vmrghb; |
602 |
ppc_opc_table_groupv[7] = ppc_opc_vpkuhum; |
603 |
ppc_opc_table_groupv[32] = ppc_opc_vadduhm; |
604 |
ppc_opc_table_groupv[33] = ppc_opc_vmaxuh; |
605 |
ppc_opc_table_groupv[34] = ppc_opc_vrlh; |
606 |
ppc_opc_table_groupv[36] = ppc_opc_vmulouh; |
607 |
ppc_opc_table_groupv[37] = ppc_opc_vsubfp; |
608 |
ppc_opc_table_groupv[38] = ppc_opc_vmrghh; |
609 |
ppc_opc_table_groupv[39] = ppc_opc_vpkuwum; |
610 |
ppc_opc_table_groupv[42] = ppc_opc_vpkpx; |
611 |
ppc_opc_table_groupv[64] = ppc_opc_vadduwm; |
612 |
ppc_opc_table_groupv[65] = ppc_opc_vmaxuw; |
613 |
ppc_opc_table_groupv[66] = ppc_opc_vrlw; |
614 |
ppc_opc_table_groupv[70] = ppc_opc_vmrghw; |
615 |
ppc_opc_table_groupv[71] = ppc_opc_vpkuhus; |
616 |
ppc_opc_table_groupv[103] = ppc_opc_vpkuwus; |
617 |
ppc_opc_table_groupv[129] = ppc_opc_vmaxsb; |
618 |
ppc_opc_table_groupv[130] = ppc_opc_vslb; |
619 |
ppc_opc_table_groupv[132] = ppc_opc_vmulosb; |
620 |
ppc_opc_table_groupv[133] = ppc_opc_vrefp; |
621 |
ppc_opc_table_groupv[134] = ppc_opc_vmrglb; |
622 |
ppc_opc_table_groupv[135] = ppc_opc_vpkshus; |
623 |
ppc_opc_table_groupv[161] = ppc_opc_vmaxsh; |
624 |
ppc_opc_table_groupv[162] = ppc_opc_vslh; |
625 |
ppc_opc_table_groupv[164] = ppc_opc_vmulosh; |
626 |
ppc_opc_table_groupv[165] = ppc_opc_vrsqrtefp; |
627 |
ppc_opc_table_groupv[166] = ppc_opc_vmrglh; |
628 |
ppc_opc_table_groupv[167] = ppc_opc_vpkswus; |
629 |
ppc_opc_table_groupv[192] = ppc_opc_vaddcuw; |
630 |
ppc_opc_table_groupv[193] = ppc_opc_vmaxsw; |
631 |
ppc_opc_table_groupv[194] = ppc_opc_vslw; |
632 |
ppc_opc_table_groupv[197] = ppc_opc_vexptefp; |
633 |
ppc_opc_table_groupv[198] = ppc_opc_vmrglw; |
634 |
ppc_opc_table_groupv[199] = ppc_opc_vpkshss; |
635 |
ppc_opc_table_groupv[226] = ppc_opc_vsl; |
636 |
ppc_opc_table_groupv[229] = ppc_opc_vlogefp; |
637 |
ppc_opc_table_groupv[231] = ppc_opc_vpkswss; |
638 |
ppc_opc_table_groupv[256] = ppc_opc_vaddubs; |
639 |
ppc_opc_table_groupv[257] = ppc_opc_vminub; |
640 |
ppc_opc_table_groupv[258] = ppc_opc_vsrb; |
641 |
ppc_opc_table_groupv[260] = ppc_opc_vmuleub; |
642 |
ppc_opc_table_groupv[261] = ppc_opc_vrfin; |
643 |
ppc_opc_table_groupv[262] = ppc_opc_vspltb; |
644 |
ppc_opc_table_groupv[263] = ppc_opc_vupkhsb; |
645 |
ppc_opc_table_groupv[288] = ppc_opc_vadduhs; |
646 |
ppc_opc_table_groupv[289] = ppc_opc_vminuh; |
647 |
ppc_opc_table_groupv[290] = ppc_opc_vsrh; |
648 |
ppc_opc_table_groupv[292] = ppc_opc_vmuleuh; |
649 |
ppc_opc_table_groupv[293] = ppc_opc_vrfiz; |
650 |
ppc_opc_table_groupv[294] = ppc_opc_vsplth; |
651 |
ppc_opc_table_groupv[295] = ppc_opc_vupkhsh; |
652 |
ppc_opc_table_groupv[320] = ppc_opc_vadduws; |
653 |
ppc_opc_table_groupv[321] = ppc_opc_vminuw; |
654 |
ppc_opc_table_groupv[322] = ppc_opc_vsrw; |
655 |
ppc_opc_table_groupv[325] = ppc_opc_vrfip; |
656 |
ppc_opc_table_groupv[326] = ppc_opc_vspltw; |
657 |
ppc_opc_table_groupv[327] = ppc_opc_vupklsb; |
658 |
ppc_opc_table_groupv[354] = ppc_opc_vsr; |
659 |
ppc_opc_table_groupv[357] = ppc_opc_vrfim; |
660 |
ppc_opc_table_groupv[359] = ppc_opc_vupklsh; |
661 |
ppc_opc_table_groupv[384] = ppc_opc_vaddsbs; |
662 |
ppc_opc_table_groupv[385] = ppc_opc_vminsb; |
663 |
ppc_opc_table_groupv[386] = ppc_opc_vsrab; |
664 |
ppc_opc_table_groupv[388] = ppc_opc_vmulesb; |
665 |
ppc_opc_table_groupv[389] = ppc_opc_vcfux; |
666 |
ppc_opc_table_groupv[390] = ppc_opc_vspltisb; |
667 |
ppc_opc_table_groupv[391] = ppc_opc_vpkpx; |
668 |
ppc_opc_table_groupv[416] = ppc_opc_vaddshs; |
669 |
ppc_opc_table_groupv[417] = ppc_opc_vminsh; |
670 |
ppc_opc_table_groupv[418] = ppc_opc_vsrah; |
671 |
ppc_opc_table_groupv[420] = ppc_opc_vmulesh; |
672 |
ppc_opc_table_groupv[421] = ppc_opc_vcfsx; |
673 |
ppc_opc_table_groupv[422] = ppc_opc_vspltish; |
674 |
ppc_opc_table_groupv[423] = ppc_opc_vupkhpx; |
675 |
ppc_opc_table_groupv[448] = ppc_opc_vaddsws; |
676 |
ppc_opc_table_groupv[449] = ppc_opc_vminsw; |
677 |
ppc_opc_table_groupv[450] = ppc_opc_vsraw; |
678 |
ppc_opc_table_groupv[453] = ppc_opc_vctuxs; |
679 |
ppc_opc_table_groupv[454] = ppc_opc_vspltisw; |
680 |
ppc_opc_table_groupv[485] = ppc_opc_vctsxs; |
681 |
ppc_opc_table_groupv[487] = ppc_opc_vupklpx; |
682 |
ppc_opc_table_groupv[512] = ppc_opc_vsububm; |
683 |
ppc_opc_table_groupv[513] = ppc_opc_vavgub; |
684 |
ppc_opc_table_groupv[514] = ppc_opc_vand; |
685 |
ppc_opc_table_groupv[517] = ppc_opc_vmaxfp; |
686 |
ppc_opc_table_groupv[518] = ppc_opc_vslo; |
687 |
ppc_opc_table_groupv[544] = ppc_opc_vsubuhm; |
688 |
ppc_opc_table_groupv[545] = ppc_opc_vavguh; |
689 |
ppc_opc_table_groupv[546] = ppc_opc_vandc; |
690 |
ppc_opc_table_groupv[549] = ppc_opc_vminfp; |
691 |
ppc_opc_table_groupv[550] = ppc_opc_vsro; |
692 |
ppc_opc_table_groupv[576] = ppc_opc_vsubuwm; |
693 |
ppc_opc_table_groupv[577] = ppc_opc_vavguw; |
694 |
ppc_opc_table_groupv[578] = ppc_opc_vor; |
695 |
ppc_opc_table_groupv[610] = ppc_opc_vxor; |
696 |
ppc_opc_table_groupv[641] = ppc_opc_vavgsb; |
697 |
ppc_opc_table_groupv[642] = ppc_opc_vnor; |
698 |
ppc_opc_table_groupv[673] = ppc_opc_vavgsh; |
699 |
ppc_opc_table_groupv[704] = ppc_opc_vsubcuw; |
700 |
ppc_opc_table_groupv[705] = ppc_opc_vavgsw; |
701 |
ppc_opc_table_groupv[768] = ppc_opc_vsububs; |
702 |
ppc_opc_table_groupv[770] = ppc_opc_mfvscr; |
703 |
ppc_opc_table_groupv[772] = ppc_opc_vsum4ubs; |
704 |
ppc_opc_table_groupv[800] = ppc_opc_vsubuhs; |
705 |
ppc_opc_table_groupv[802] = ppc_opc_mtvscr; |
706 |
ppc_opc_table_groupv[804] = ppc_opc_vsum4shs; |
707 |
ppc_opc_table_groupv[832] = ppc_opc_vsubuws; |
708 |
ppc_opc_table_groupv[836] = ppc_opc_vsum2sws; |
709 |
ppc_opc_table_groupv[896] = ppc_opc_vsubsbs; |
710 |
ppc_opc_table_groupv[900] = ppc_opc_vsum4sbs; |
711 |
ppc_opc_table_groupv[928] = ppc_opc_vsubshs; |
712 |
ppc_opc_table_groupv[960] = ppc_opc_vsubsws; |
713 |
ppc_opc_table_groupv[964] = ppc_opc_vsumsws; |
714 |
|
715 |
ppc_opc_table_gen_groupv[0] = ppc_opc_gen_vaddubm; |
716 |
ppc_opc_table_gen_groupv[1] = ppc_opc_gen_vmaxub; |
717 |
ppc_opc_table_gen_groupv[2] = ppc_opc_gen_vrlb; |
718 |
ppc_opc_table_gen_groupv[4] = ppc_opc_gen_vmuloub; |
719 |
ppc_opc_table_gen_groupv[5] = ppc_opc_gen_vaddfp; |
720 |
ppc_opc_table_gen_groupv[6] = ppc_opc_gen_vmrghb; |
721 |
ppc_opc_table_gen_groupv[7] = ppc_opc_gen_vpkuhum; |
722 |
ppc_opc_table_gen_groupv[32] = ppc_opc_gen_vadduhm; |
723 |
ppc_opc_table_gen_groupv[33] = ppc_opc_gen_vmaxuh; |
724 |
ppc_opc_table_gen_groupv[34] = ppc_opc_gen_vrlh; |
725 |
ppc_opc_table_gen_groupv[36] = ppc_opc_gen_vmulouh; |
726 |
ppc_opc_table_gen_groupv[37] = ppc_opc_gen_vsubfp; |
727 |
ppc_opc_table_gen_groupv[38] = ppc_opc_gen_vmrghh; |
728 |
ppc_opc_table_gen_groupv[39] = ppc_opc_gen_vpkuwum; |
729 |
ppc_opc_table_gen_groupv[42] = ppc_opc_gen_vpkpx; |
730 |
ppc_opc_table_gen_groupv[64] = ppc_opc_gen_vadduwm; |
731 |
ppc_opc_table_gen_groupv[65] = ppc_opc_gen_vmaxuw; |
732 |
ppc_opc_table_gen_groupv[66] = ppc_opc_gen_vrlw; |
733 |
ppc_opc_table_gen_groupv[70] = ppc_opc_gen_vmrghw; |
734 |
ppc_opc_table_gen_groupv[71] = ppc_opc_gen_vpkuhus; |
735 |
ppc_opc_table_gen_groupv[103] = ppc_opc_gen_vpkuwus; |
736 |
ppc_opc_table_gen_groupv[129] = ppc_opc_gen_vmaxsb; |
737 |
ppc_opc_table_gen_groupv[130] = ppc_opc_gen_vslb; |
738 |
ppc_opc_table_gen_groupv[132] = ppc_opc_gen_vmulosb; |
739 |
ppc_opc_table_gen_groupv[133] = ppc_opc_gen_vrefp; |
740 |
ppc_opc_table_gen_groupv[134] = ppc_opc_gen_vmrglb; |
741 |
ppc_opc_table_gen_groupv[135] = ppc_opc_gen_vpkshus; |
742 |
ppc_opc_table_gen_groupv[161] = ppc_opc_gen_vmaxsh; |
743 |
ppc_opc_table_gen_groupv[162] = ppc_opc_gen_vslh; |
744 |
ppc_opc_table_gen_groupv[164] = ppc_opc_gen_vmulosh; |
745 |
ppc_opc_table_gen_groupv[165] = ppc_opc_gen_vrsqrtefp; |
746 |
ppc_opc_table_gen_groupv[166] = ppc_opc_gen_vmrglh; |
747 |
ppc_opc_table_gen_groupv[167] = ppc_opc_gen_vpkswus; |
748 |
ppc_opc_table_gen_groupv[192] = ppc_opc_gen_vaddcuw; |
749 |
ppc_opc_table_gen_groupv[193] = ppc_opc_gen_vmaxsw; |
750 |
ppc_opc_table_gen_groupv[194] = ppc_opc_gen_vslw; |
751 |
ppc_opc_table_gen_groupv[197] = ppc_opc_gen_vexptefp; |
752 |
ppc_opc_table_gen_groupv[198] = ppc_opc_gen_vmrglw; |
753 |
ppc_opc_table_gen_groupv[199] = ppc_opc_gen_vpkshss; |
754 |
ppc_opc_table_gen_groupv[226] = ppc_opc_gen_vsl; |
755 |
ppc_opc_table_gen_groupv[229] = ppc_opc_gen_vlogefp; |
756 |
ppc_opc_table_gen_groupv[231] = ppc_opc_gen_vpkswss; |
757 |
ppc_opc_table_gen_groupv[256] = ppc_opc_gen_vaddubs; |
758 |
ppc_opc_table_gen_groupv[257] = ppc_opc_gen_vminub; |
759 |
ppc_opc_table_gen_groupv[258] = ppc_opc_gen_vsrb; |
760 |
ppc_opc_table_gen_groupv[260] = ppc_opc_gen_vmuleub; |
761 |
ppc_opc_table_gen_groupv[261] = ppc_opc_gen_vrfin; |
762 |
ppc_opc_table_gen_groupv[262] = ppc_opc_gen_vspltb; |
763 |
ppc_opc_table_gen_groupv[263] = ppc_opc_gen_vupkhsb; |
764 |
ppc_opc_table_gen_groupv[288] = ppc_opc_gen_vadduhs; |
765 |
ppc_opc_table_gen_groupv[289] = ppc_opc_gen_vminuh; |
766 |
ppc_opc_table_gen_groupv[290] = ppc_opc_gen_vsrh; |
767 |
ppc_opc_table_gen_groupv[292] = ppc_opc_gen_vmuleuh; |
768 |
ppc_opc_table_gen_groupv[293] = ppc_opc_gen_vrfiz; |
769 |
ppc_opc_table_gen_groupv[294] = ppc_opc_gen_vsplth; |
770 |
ppc_opc_table_gen_groupv[295] = ppc_opc_gen_vupkhsh; |
771 |
ppc_opc_table_gen_groupv[320] = ppc_opc_gen_vadduws; |
772 |
ppc_opc_table_gen_groupv[321] = ppc_opc_gen_vminuw; |
773 |
ppc_opc_table_gen_groupv[322] = ppc_opc_gen_vsrw; |
774 |
ppc_opc_table_gen_groupv[325] = ppc_opc_gen_vrfip; |
775 |
ppc_opc_table_gen_groupv[326] = ppc_opc_gen_vspltw; |
776 |
ppc_opc_table_gen_groupv[327] = ppc_opc_gen_vupklsb; |
777 |
ppc_opc_table_gen_groupv[354] = ppc_opc_gen_vsr; |
778 |
ppc_opc_table_gen_groupv[357] = ppc_opc_gen_vrfim; |
779 |
ppc_opc_table_gen_groupv[359] = ppc_opc_gen_vupklsh; |
780 |
ppc_opc_table_gen_groupv[384] = ppc_opc_gen_vaddsbs; |
781 |
ppc_opc_table_gen_groupv[385] = ppc_opc_gen_vminsb; |
782 |
ppc_opc_table_gen_groupv[386] = ppc_opc_gen_vsrab; |
783 |
ppc_opc_table_gen_groupv[388] = ppc_opc_gen_vmulesb; |
784 |
ppc_opc_table_gen_groupv[389] = ppc_opc_gen_vcfux; |
785 |
ppc_opc_table_gen_groupv[390] = ppc_opc_gen_vspltisb; |
786 |
ppc_opc_table_gen_groupv[391] = ppc_opc_gen_vpkpx; |
787 |
ppc_opc_table_gen_groupv[416] = ppc_opc_gen_vaddshs; |
788 |
ppc_opc_table_gen_groupv[417] = ppc_opc_gen_vminsh; |
789 |
ppc_opc_table_gen_groupv[418] = ppc_opc_gen_vsrah; |
790 |
ppc_opc_table_gen_groupv[420] = ppc_opc_gen_vmulesh; |
791 |
ppc_opc_table_gen_groupv[421] = ppc_opc_gen_vcfsx; |
792 |
ppc_opc_table_gen_groupv[422] = ppc_opc_gen_vspltish; |
793 |
ppc_opc_table_gen_groupv[423] = ppc_opc_gen_vupkhpx; |
794 |
ppc_opc_table_gen_groupv[448] = ppc_opc_gen_vaddsws; |
795 |
ppc_opc_table_gen_groupv[449] = ppc_opc_gen_vminsw; |
796 |
ppc_opc_table_gen_groupv[450] = ppc_opc_gen_vsraw; |
797 |
ppc_opc_table_gen_groupv[453] = ppc_opc_gen_vctuxs; |
798 |
ppc_opc_table_gen_groupv[454] = ppc_opc_gen_vspltisw; |
799 |
ppc_opc_table_gen_groupv[485] = ppc_opc_gen_vctsxs; |
800 |
ppc_opc_table_gen_groupv[487] = ppc_opc_gen_vupklpx; |
801 |
ppc_opc_table_gen_groupv[512] = ppc_opc_gen_vsububm; |
802 |
ppc_opc_table_gen_groupv[513] = ppc_opc_gen_vavgub; |
803 |
ppc_opc_table_gen_groupv[514] = ppc_opc_gen_vand; |
804 |
ppc_opc_table_gen_groupv[517] = ppc_opc_gen_vmaxfp; |
805 |
ppc_opc_table_gen_groupv[518] = ppc_opc_gen_vslo; |
806 |
ppc_opc_table_gen_groupv[544] = ppc_opc_gen_vsubuhm; |
807 |
ppc_opc_table_gen_groupv[545] = ppc_opc_gen_vavguh; |
808 |
ppc_opc_table_gen_groupv[546] = ppc_opc_gen_vandc; |
809 |
ppc_opc_table_gen_groupv[549] = ppc_opc_gen_vminfp; |
810 |
ppc_opc_table_gen_groupv[550] = ppc_opc_gen_vsro; |
811 |
ppc_opc_table_gen_groupv[576] = ppc_opc_gen_vsubuwm; |
812 |
ppc_opc_table_gen_groupv[577] = ppc_opc_gen_vavguw; |
813 |
ppc_opc_table_gen_groupv[578] = ppc_opc_gen_vor; |
814 |
ppc_opc_table_gen_groupv[610] = ppc_opc_gen_vxor; |
815 |
ppc_opc_table_gen_groupv[641] = ppc_opc_gen_vavgsb; |
816 |
ppc_opc_table_gen_groupv[642] = ppc_opc_gen_vnor; |
817 |
ppc_opc_table_gen_groupv[673] = ppc_opc_gen_vavgsh; |
818 |
ppc_opc_table_gen_groupv[704] = ppc_opc_gen_vsubcuw; |
819 |
ppc_opc_table_gen_groupv[705] = ppc_opc_gen_vavgsw; |
820 |
ppc_opc_table_gen_groupv[768] = ppc_opc_gen_vsububs; |
821 |
ppc_opc_table_gen_groupv[770] = ppc_opc_gen_mfvscr; |
822 |
ppc_opc_table_gen_groupv[772] = ppc_opc_gen_vsum4ubs; |
823 |
ppc_opc_table_gen_groupv[800] = ppc_opc_gen_vsubuhs; |
824 |
ppc_opc_table_gen_groupv[802] = ppc_opc_gen_mtvscr; |
825 |
ppc_opc_table_gen_groupv[804] = ppc_opc_gen_vsum4shs; |
826 |
ppc_opc_table_gen_groupv[832] = ppc_opc_gen_vsubuws; |
827 |
ppc_opc_table_gen_groupv[836] = ppc_opc_gen_vsum2sws; |
828 |
ppc_opc_table_gen_groupv[896] = ppc_opc_gen_vsubsbs; |
829 |
ppc_opc_table_gen_groupv[900] = ppc_opc_gen_vsum4sbs; |
830 |
ppc_opc_table_gen_groupv[928] = ppc_opc_gen_vsubshs; |
831 |
ppc_opc_table_gen_groupv[960] = ppc_opc_gen_vsubsws; |
832 |
ppc_opc_table_gen_groupv[964] = ppc_opc_gen_vsumsws; |
833 |
|
834 |
/* Put any MMX/SSE/SSE2 optimizations here under conditional |
835 |
* of a CPU caps. |
836 |
*/ |
837 |
} |
838 |
|
839 |
// main opcode 04 |
840 |
static void ppc_opc_group_v() |
841 |
{ |
842 |
uint32 ext = PPC_OPC_EXT(gCPU.current_opc); |
843 |
#ifndef __VEC_EXC_OFF__ |
844 |
if ((gCPU.msr & MSR_VEC) == 0) { |
845 |
ppc_exception(PPC_EXC_NO_VEC); |
846 |
return; |
847 |
} |
848 |
#endif |
849 |
switch(ext & 0x1f) { |
850 |
case 16: |
851 |
if (gCPU.current_opc & PPC_OPC_Rc) |
852 |
return ppc_opc_vmhraddshs(); |
853 |
else |
854 |
return ppc_opc_vmhaddshs(); |
855 |
case 17: return ppc_opc_vmladduhm(); |
856 |
case 18: |
857 |
if (gCPU.current_opc & PPC_OPC_Rc) |
858 |
return ppc_opc_vmsummbm(); |
859 |
else |
860 |
return ppc_opc_vmsumubm(); |
861 |
case 19: |
862 |
if (gCPU.current_opc & PPC_OPC_Rc) |
863 |
return ppc_opc_vmsumuhs(); |
864 |
else |
865 |
return ppc_opc_vmsumuhm(); |
866 |
case 20: |
867 |
if (gCPU.current_opc & PPC_OPC_Rc) |
868 |
return ppc_opc_vmsumshs(); |
869 |
else |
870 |
return ppc_opc_vmsumshm(); |
871 |
case 21: |
872 |
if (gCPU.current_opc & PPC_OPC_Rc) |
873 |
return ppc_opc_vperm(); |
874 |
else |
875 |
return ppc_opc_vsel(); |
876 |
case 22: return ppc_opc_vsldoi(); |
877 |
case 23: |
878 |
if (gCPU.current_opc & PPC_OPC_Rc) |
879 |
return ppc_opc_vnmsubfp(); |
880 |
else |
881 |
return ppc_opc_vmaddfp(); |
882 |
} |
883 |
switch(ext & 0x1ff) |
884 |
{ |
885 |
case 3: return ppc_opc_vcmpequbx(); |
886 |
case 35: return ppc_opc_vcmpequhx(); |
887 |
case 67: return ppc_opc_vcmpequwx(); |
888 |
case 99: return ppc_opc_vcmpeqfpx(); |
889 |
case 227: return ppc_opc_vcmpgefpx(); |
890 |
case 259: return ppc_opc_vcmpgtubx(); |
891 |
case 291: return ppc_opc_vcmpgtuhx(); |
892 |
case 323: return ppc_opc_vcmpgtuwx(); |
893 |
case 355: return ppc_opc_vcmpgtfpx(); |
894 |
case 387: return ppc_opc_vcmpgtsbx(); |
895 |
case 419: return ppc_opc_vcmpgtshx(); |
896 |
case 451: return ppc_opc_vcmpgtswx(); |
897 |
case 483: return ppc_opc_vcmpbfpx(); |
898 |
} |
899 |
|
900 |
if (ext >= (sizeof ppc_opc_table_groupv / sizeof ppc_opc_table_groupv[0])) { |
901 |
return ppc_opc_invalid(); |
902 |
} |
903 |
return ppc_opc_table_groupv[ext](); |
904 |
} |
905 |
|
906 |
// main opcode 04 |
907 |
static JITCFlow ppc_opc_gen_group_v() |
908 |
{ |
909 |
uint32 ext = PPC_OPC_EXT(gJITC.current_opc); |
910 |
int vrS = (gJITC.current_opc >> 21) & 0x1f; |
911 |
|
912 |
ppc_opc_gen_check_vec(); |
913 |
|
914 |
if (vrS == gJITC.nativeVectorReg) { |
915 |
gJITC.nativeVectorReg = VECTREG_NO; |
916 |
} |
917 |
|
918 |
switch(ext & 0x1f) { |
919 |
case 16: |
920 |
if (gJITC.current_opc & PPC_OPC_Rc) |
921 |
return ppc_opc_gen_vmhraddshs(); |
922 |
else |
923 |
return ppc_opc_gen_vmhaddshs(); |
924 |
case 17: return ppc_opc_gen_vmladduhm(); |
925 |
case 18: |
926 |
if (gJITC.current_opc & PPC_OPC_Rc) |
927 |
return ppc_opc_gen_vmsummbm(); |
928 |
else |
929 |
return ppc_opc_gen_vmsumubm(); |
930 |
case 19: |
931 |
if (gJITC.current_opc & PPC_OPC_Rc) |
932 |
return ppc_opc_gen_vmsumuhs(); |
933 |
else |
934 |
return ppc_opc_gen_vmsumuhm(); |
935 |
case 20: |
936 |
if (gJITC.current_opc & PPC_OPC_Rc) |
937 |
return ppc_opc_gen_vmsumshs(); |
938 |
else |
939 |
return ppc_opc_gen_vmsumshm(); |
940 |
case 21: |
941 |
if (gJITC.current_opc & PPC_OPC_Rc) |
942 |
return ppc_opc_gen_vperm(); |
943 |
else |
944 |
return ppc_opc_gen_vsel(); |
945 |
case 22: return ppc_opc_gen_vsldoi(); |
946 |
case 23: |
947 |
if (gJITC.current_opc & PPC_OPC_Rc) |
948 |
return ppc_opc_gen_vnmsubfp(); |
949 |
else |
950 |
return ppc_opc_gen_vmaddfp(); |
951 |
} |
952 |
switch(ext & 0x1ff) |
953 |
{ |
954 |
case 3: return ppc_opc_gen_vcmpequbx(); |
955 |
case 35: return ppc_opc_gen_vcmpequhx(); |
956 |
case 67: return ppc_opc_gen_vcmpequwx(); |
957 |
case 99: return ppc_opc_gen_vcmpeqfpx(); |
958 |
case 227: return ppc_opc_gen_vcmpgefpx(); |
959 |
case 259: return ppc_opc_gen_vcmpgtubx(); |
960 |
case 291: return ppc_opc_gen_vcmpgtuhx(); |
961 |
case 323: return ppc_opc_gen_vcmpgtuwx(); |
962 |
case 355: return ppc_opc_gen_vcmpgtfpx(); |
963 |
case 387: return ppc_opc_gen_vcmpgtsbx(); |
964 |
case 419: return ppc_opc_gen_vcmpgtshx(); |
965 |
case 451: return ppc_opc_gen_vcmpgtswx(); |
966 |
case 483: return ppc_opc_gen_vcmpbfpx(); |
967 |
} |
968 |
|
969 |
if (ext >= (sizeof ppc_opc_table_gen_groupv / sizeof ppc_opc_table_gen_groupv[0])) { |
970 |
return ppc_opc_gen_invalid(); |
971 |
} |
972 |
return ppc_opc_table_gen_groupv[ext](); |
973 |
} |
974 |
|
975 |
|
976 |
static ppc_opc_function ppc_opc_table_main[64] = { |
977 |
&ppc_opc_special, // 0 |
978 |
&ppc_opc_invalid, // 1 |
979 |
&ppc_opc_invalid, // 2 (tdi on 64 bit platforms) |
980 |
&ppc_opc_twi, // 3 |
981 |
&ppc_opc_invalid, // 4 (altivec) |
982 |
&ppc_opc_invalid, // 5 |
983 |
&ppc_opc_invalid, // 6 |
984 |
&ppc_opc_mulli, // 7 |
985 |
&ppc_opc_subfic, // 8 |
986 |
&ppc_opc_invalid, // 9 |
987 |
&ppc_opc_cmpli, // 10 |
988 |
&ppc_opc_cmpi, // 11 |
989 |
&ppc_opc_addic, // 12 |
990 |
&ppc_opc_addic_, // 13 |
991 |
&ppc_opc_addi, // 14 |
992 |
&ppc_opc_addis, // 15 |
993 |
&ppc_opc_bcx, // 16 |
994 |
&ppc_opc_sc, // 17 |
995 |
&ppc_opc_bx, // 18 |
996 |
&ppc_opc_group_1, // 19 |
997 |
&ppc_opc_rlwimix, // 20 |
998 |
&ppc_opc_rlwinmx, // 21 |
999 |
&ppc_opc_invalid, // 22 |
1000 |
&ppc_opc_rlwnmx, // 23 |
1001 |
&ppc_opc_ori, // 24 |
1002 |
&ppc_opc_oris, // 25 |
1003 |
&ppc_opc_xori, // 26 |
1004 |
&ppc_opc_xoris, // 27 |
1005 |
&ppc_opc_andi_, // 28 |
1006 |
&ppc_opc_andis_, // 29 |
1007 |
&ppc_opc_invalid, // 30 (group_rld on 64 bit platforms) |
1008 |
&ppc_opc_group_2, // 31 |
1009 |
&ppc_opc_lwz, // 32 |
1010 |
&ppc_opc_lwzu, // 33 |
1011 |
&ppc_opc_lbz, // 34 |
1012 |
&ppc_opc_lbzu, // 35 |
1013 |
&ppc_opc_stw, // 36 |
1014 |
&ppc_opc_stwu, // 37 |
1015 |
&ppc_opc_stb, // 38 |
1016 |
&ppc_opc_stbu, // 39 |
1017 |
&ppc_opc_lhz, // 40 |
1018 |
&ppc_opc_lhzu, // 41 |
1019 |
&ppc_opc_lha, // 42 |
1020 |
&ppc_opc_lhau, // 43 |
1021 |
&ppc_opc_sth, // 44 |
1022 |
&ppc_opc_sthu, // 45 |
1023 |
&ppc_opc_lmw, // 46 |
1024 |
&ppc_opc_stmw, // 47 |
1025 |
&ppc_opc_lfs, // 48 |
1026 |
&ppc_opc_lfsu, // 49 |
1027 |
&ppc_opc_lfd, // 50 |
1028 |
&ppc_opc_lfdu, // 51 |
1029 |
&ppc_opc_stfs, // 52 |
1030 |
&ppc_opc_stfsu, // 53 |
1031 |
&ppc_opc_stfd, // 54 |
1032 |
&ppc_opc_stfdu, // 55 |
1033 |
&ppc_opc_invalid, // 56 |
1034 |
&ppc_opc_invalid, // 57 |
1035 |
&ppc_opc_invalid, // 58 (ld on 64 bit platforms) |
1036 |
&ppc_opc_group_f1, // 59 |
1037 |
&ppc_opc_invalid, // 60 |
1038 |
&ppc_opc_invalid, // 61 |
1039 |
&ppc_opc_invalid, // 62 |
1040 |
&ppc_opc_group_f2, // 63 |
1041 |
}; |
1042 |
static ppc_opc_gen_function ppc_opc_table_gen_main[64] = { |
1043 |
&ppc_opc_gen_special, // 0 |
1044 |
&ppc_opc_gen_invalid, // 1 |
1045 |
&ppc_opc_gen_invalid, // 2 (tdi on 64 bit platforms) |
1046 |
&ppc_opc_gen_twi, // 3 |
1047 |
&ppc_opc_gen_invalid, // 4 (altivec) |
1048 |
&ppc_opc_gen_invalid, // 5 |
1049 |
&ppc_opc_gen_invalid, // 6 |
1050 |
&ppc_opc_gen_mulli, // 7 |
1051 |
&ppc_opc_gen_subfic, // 8 |
1052 |
&ppc_opc_gen_invalid, // 9 |
1053 |
&ppc_opc_gen_cmpli, // 10 |
1054 |
&ppc_opc_gen_cmpi, // 11 |
1055 |
&ppc_opc_gen_addic, // 12 |
1056 |
&ppc_opc_gen_addic_, // 13 |
1057 |
&ppc_opc_gen_addi, // 14 |
1058 |
&ppc_opc_gen_addis, // 15 |
1059 |
&ppc_opc_gen_bcx, // 16 |
1060 |
&ppc_opc_gen_sc, // 17 |
1061 |
&ppc_opc_gen_bx, // 18 |
1062 |
&ppc_opc_gen_group_1, // 19 |
1063 |
&ppc_opc_gen_rlwimix, // 20 |
1064 |
&ppc_opc_gen_rlwinmx, // 21 |
1065 |
&ppc_opc_gen_invalid, // 22 |
1066 |
&ppc_opc_gen_rlwnmx, // 23 |
1067 |
&ppc_opc_gen_ori, // 24 |
1068 |
&ppc_opc_gen_oris, // 25 |
1069 |
&ppc_opc_gen_xori, // 26 |
1070 |
&ppc_opc_gen_xoris, // 27 |
1071 |
&ppc_opc_gen_andi_, // 28 |
1072 |
&ppc_opc_gen_andis_, // 29 |
1073 |
&ppc_opc_gen_invalid, // 30 (group_rld on 64 bit platforms) |
1074 |
&ppc_opc_gen_group_2, // 31 |
1075 |
&ppc_opc_gen_lwz, // 32 |
1076 |
&ppc_opc_gen_lwzu, // 33 |
1077 |
&ppc_opc_gen_lbz, // 34 |
1078 |
&ppc_opc_gen_lbzu, // 35 |
1079 |
&ppc_opc_gen_stw, // 36 |
1080 |
&ppc_opc_gen_stwu, // 37 |
1081 |
&ppc_opc_gen_stb, // 38 |
1082 |
&ppc_opc_gen_stbu, // 39 |
1083 |
&ppc_opc_gen_lhz, // 40 |
1084 |
&ppc_opc_gen_lhzu, // 41 |
1085 |
&ppc_opc_gen_lha, // 42 |
1086 |
&ppc_opc_gen_lhau, // 43 |
1087 |
&ppc_opc_gen_sth, // 44 |
1088 |
&ppc_opc_gen_sthu, // 45 |
1089 |
&ppc_opc_gen_lmw, // 46 |
1090 |
&ppc_opc_gen_stmw, // 47 |
1091 |
&ppc_opc_gen_lfs, // 48 |
1092 |
&ppc_opc_gen_lfsu, // 49 |
1093 |
&ppc_opc_gen_lfd, // 50 |
1094 |
&ppc_opc_gen_lfdu, // 51 |
1095 |
&ppc_opc_gen_stfs, // 52 |
1096 |
&ppc_opc_gen_stfsu, // 53 |
1097 |
&ppc_opc_gen_stfd, // 54 |
1098 |
&ppc_opc_gen_stfdu, // 55 |
1099 |
&ppc_opc_gen_invalid, // 56 |
1100 |
&ppc_opc_gen_invalid, // 57 |
1101 |
&ppc_opc_gen_invalid, // 58 (ld on 64 bit platforms) |
1102 |
&ppc_opc_gen_group_f1, // 59 |
1103 |
&ppc_opc_gen_invalid, // 60 |
1104 |
&ppc_opc_gen_invalid, // 61 |
1105 |
&ppc_opc_gen_invalid, // 62 |
1106 |
&ppc_opc_gen_group_f2, // 63 |
1107 |
}; |
1108 |
|
1109 |
void FASTCALL ppc_exec_opc() |
1110 |
{ |
1111 |
uint32 mainopc = PPC_OPC_MAIN(gCPU.current_opc); |
1112 |
ppc_opc_table_main[mainopc](); |
1113 |
} |
1114 |
|
1115 |
static uint32 last_instr = 0, instr_report = 0, instr_count = 0; |
1116 |
|
1117 |
JITCFlow FASTCALL ppc_gen_opc() |
1118 |
{ |
1119 |
uint32 mainopc = PPC_OPC_MAIN(gJITC.current_opc); |
1120 |
|
1121 |
/*if (instr_report) { |
1122 |
uint32 ext = PPC_OPC_EXT(gJITC.current_opc); |
1123 |
uint32 rD, rA, rB, rC; |
1124 |
PPC_OPC_TEMPL_A(gJITC.current_opc, rD, rA, rB, rC); |
1125 |
|
1126 |
printf("*** (%08x) %08x (%i, %i) (%i, %i, %i, %i)\n", instr_count++, gJITC.current_opc, mainopc, ext, rD, rA, rB, rC); |
1127 |
} else { |
1128 |
if (last_instr == 0x7c00004c && gJITC.current_opc == 0x10e0038c) { |
1129 |
instr_report = 1; |
1130 |
} |
1131 |
|
1132 |
last_instr = gJITC.current_opc; |
1133 |
}*/ |
1134 |
|
1135 |
return ppc_opc_table_gen_main[mainopc](); |
1136 |
} |
1137 |
|
1138 |
void ppc_dec_init() |
1139 |
{ |
1140 |
ppc_opc_init_group2(); |
1141 |
if ((ppc_cpu_get_pvr(0) & 0xffff0000) == 0x000c0000) { |
1142 |
ht_printf("[PPC/VEC] Vector Address: %08x\n", (uint32)&gCPU.vr[0]); |
1143 |
ppc_opc_table_main[4] = ppc_opc_group_v; |
1144 |
ppc_opc_table_gen_main[4] = ppc_opc_gen_group_v; |
1145 |
ppc_opc_init_groupv(); |
1146 |
} |
1147 |
} |