1 |
/* |
/* |
2 |
* PPC emulation micro-operations for qemu. |
* PowerPC emulation micro-operations for qemu. |
3 |
* |
* |
4 |
* Copyright (c) 2003 Jocelyn Mayer |
* Copyright (c) 2003-2005 Jocelyn Mayer |
5 |
* |
* |
6 |
* This library is free software; you can redistribute it and/or |
* This library is free software; you can redistribute it and/or |
7 |
* modify it under the terms of the GNU Lesser General Public |
* modify it under the terms of the GNU Lesser General Public |
130 |
#define REG 31 |
#define REG 31 |
131 |
#include "op_template.h" |
#include "op_template.h" |
132 |
|
|
133 |
/* PPC state maintenance operations */ |
/* PowerPC state maintenance operations */ |
134 |
/* set_Rc0 */ |
/* set_Rc0 */ |
135 |
PPC_OP(set_Rc0) |
PPC_OP(set_Rc0) |
136 |
{ |
{ |
223 |
|
|
224 |
PPC_OP(store_srin) |
PPC_OP(store_srin) |
225 |
{ |
{ |
226 |
do_store_sr(T1 >> 28); |
do_store_sr(env, ((uint32_t)T1 >> 28), T0); |
227 |
RETURN(); |
RETURN(); |
228 |
} |
} |
229 |
|
|
235 |
|
|
236 |
PPC_OP(store_sdr1) |
PPC_OP(store_sdr1) |
237 |
{ |
{ |
238 |
regs->sdr1 = T0; |
do_store_sdr1(env, T0); |
239 |
RETURN(); |
RETURN(); |
240 |
} |
} |
241 |
|
|
247 |
/* Load/store special registers */ |
/* Load/store special registers */ |
248 |
PPC_OP(load_cr) |
PPC_OP(load_cr) |
249 |
{ |
{ |
250 |
do_load_cr(); |
T0 = do_load_cr(env); |
251 |
RETURN(); |
RETURN(); |
252 |
} |
} |
253 |
|
|
254 |
PPC_OP(store_cr) |
PPC_OP(store_cr) |
255 |
{ |
{ |
256 |
do_store_cr(PARAM(1)); |
do_store_cr(env, T0, PARAM(1)); |
257 |
RETURN(); |
RETURN(); |
258 |
} |
} |
259 |
|
|
279 |
|
|
280 |
PPC_OP(load_xer) |
PPC_OP(load_xer) |
281 |
{ |
{ |
282 |
do_load_xer(); |
T0 = do_load_xer(env); |
283 |
RETURN(); |
RETURN(); |
284 |
} |
} |
285 |
|
|
286 |
PPC_OP(store_xer) |
PPC_OP(store_xer) |
287 |
{ |
{ |
288 |
do_store_xer(); |
do_store_xer(env, T0); |
289 |
RETURN(); |
RETURN(); |
290 |
} |
} |
291 |
|
|
292 |
PPC_OP(load_msr) |
PPC_OP(load_msr) |
293 |
{ |
{ |
294 |
do_load_msr(); |
T0 = do_load_msr(env); |
295 |
RETURN(); |
RETURN(); |
296 |
} |
} |
297 |
|
|
298 |
PPC_OP(store_msr) |
PPC_OP(store_msr) |
299 |
{ |
{ |
300 |
do_store_msr(); |
do_store_msr(env, T0); |
301 |
RETURN(); |
RETURN(); |
302 |
} |
} |
303 |
|
|
378 |
T0 = regs->IBAT[PARAM(1)][PARAM(2)]; |
T0 = regs->IBAT[PARAM(1)][PARAM(2)]; |
379 |
} |
} |
380 |
|
|
381 |
PPC_OP(store_ibat) |
void op_store_ibatu (void) |
382 |
{ |
{ |
383 |
do_store_ibat(PARAM(1), PARAM(2)); |
do_store_ibatu(env, PARAM1, T0); |
384 |
|
RETURN(); |
385 |
|
} |
386 |
|
|
387 |
|
void op_store_ibatl (void) |
388 |
|
{ |
389 |
|
#if 1 |
390 |
|
env->IBAT[1][PARAM1] = T0; |
391 |
|
#else |
392 |
|
do_store_ibatl(env, PARAM1, T0); |
393 |
|
#endif |
394 |
|
RETURN(); |
395 |
} |
} |
396 |
|
|
397 |
PPC_OP(load_dbat) |
PPC_OP(load_dbat) |
399 |
T0 = regs->DBAT[PARAM(1)][PARAM(2)]; |
T0 = regs->DBAT[PARAM(1)][PARAM(2)]; |
400 |
} |
} |
401 |
|
|
402 |
PPC_OP(store_dbat) |
void op_store_dbatu (void) |
403 |
|
{ |
404 |
|
do_store_dbatu(env, PARAM1, T0); |
405 |
|
RETURN(); |
406 |
|
} |
407 |
|
|
408 |
|
void op_store_dbatl (void) |
409 |
{ |
{ |
410 |
do_store_dbat(PARAM(1), PARAM(2)); |
#if 1 |
411 |
|
env->DBAT[1][PARAM1] = T0; |
412 |
|
#else |
413 |
|
do_store_dbatl(env, PARAM1, T0); |
414 |
|
#endif |
415 |
|
RETURN(); |
416 |
} |
} |
417 |
|
|
418 |
/* FPSCR */ |
/* FPSCR */ |
419 |
PPC_OP(load_fpscr) |
PPC_OP(load_fpscr) |
420 |
{ |
{ |
421 |
do_load_fpscr(); |
FT0 = do_load_fpscr(env); |
422 |
RETURN(); |
RETURN(); |
423 |
} |
} |
424 |
|
|
425 |
PPC_OP(store_fpscr) |
PPC_OP(store_fpscr) |
426 |
{ |
{ |
427 |
do_store_fpscr(PARAM(1)); |
do_store_fpscr(env, FT0, PARAM1); |
428 |
RETURN(); |
RETURN(); |
429 |
} |
} |
430 |
|
|
1384 |
/* Return from interrupt */ |
/* Return from interrupt */ |
1385 |
PPC_OP(rfi) |
PPC_OP(rfi) |
1386 |
{ |
{ |
1387 |
regs->nip = regs->spr[SRR0] & ~0x00000003; |
regs->nip = regs->spr[SPR_SRR0] & ~0x00000003; |
1388 |
#if 1 // TRY |
#if 1 // TRY |
1389 |
T0 = regs->spr[SRR1] & ~0xFFF00000; |
T0 = regs->spr[SPR_SRR1] & ~0xFFF00000; |
1390 |
#else |
#else |
1391 |
T0 = regs->spr[SRR1] & ~0xFFFF0000; |
T0 = regs->spr[SPR_SRR1] & ~0xFFFF0000; |
|
#endif |
|
|
do_store_msr(); |
|
|
#if defined (DEBUG_OP) |
|
|
dump_rfi(); |
|
1392 |
#endif |
#endif |
1393 |
// do_tlbia(); |
do_store_msr(env, T0); |
1394 |
do_raise_exception(EXCP_RFI); |
do_raise_exception(EXCP_RFI); |
1395 |
RETURN(); |
RETURN(); |
1396 |
} |
} |
1438 |
do_tlbie(); |
do_tlbie(); |
1439 |
RETURN(); |
RETURN(); |
1440 |
} |
} |
1441 |
|
|
1442 |
|
void op_store_pir (void) |
1443 |
|
{ |
1444 |
|
env->spr[SPR_PIR] = T0 & 0x0000000FUL; |
1445 |
|
RETURN(); |
1446 |
|
} |