1 |
dpavlin |
1 |
/* |
2 |
|
|
* PearPC |
3 |
|
|
* ppc_dec.h |
4 |
|
|
* |
5 |
|
|
* Copyright (C) 2003, 2004 Sebastian Biallas (sb@biallas.net) |
6 |
|
|
* |
7 |
|
|
* This program is free software; you can redistribute it and/or modify |
8 |
|
|
* it under the terms of the GNU General Public License version 2 as |
9 |
|
|
* published by the Free Software Foundation. |
10 |
|
|
* |
11 |
|
|
* This program is distributed in the hope that it will be useful, |
12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
|
* GNU General Public License for more details. |
15 |
|
|
* |
16 |
|
|
* You should have received a copy of the GNU General Public License |
17 |
|
|
* along with this program; if not, write to the Free Software |
18 |
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 |
|
|
*/ |
20 |
|
|
|
21 |
|
|
#ifndef __PPC_DEC_H__ |
22 |
|
|
#define __PPC_DEC_H__ |
23 |
|
|
|
24 |
|
|
#include "system/types.h" |
25 |
|
|
#include "jitc_types.h" |
26 |
|
|
|
27 |
|
|
typedef JITCFlow (*ppc_opc_gen_function)(); |
28 |
|
|
|
29 |
|
|
void FASTCALL ppc_exec_opc(); |
30 |
|
|
JITCFlow FASTCALL ppc_gen_opc(); |
31 |
|
|
void ppc_dec_init(); |
32 |
|
|
|
33 |
|
|
#define PPC_OPC_ASSERT(v) |
34 |
|
|
|
35 |
|
|
#define PPC_OPC_MAIN(opc) (((opc)>>26)&0x3f) |
36 |
|
|
#define PPC_OPC_EXT(opc) (((opc)>>1)&0x3ff) |
37 |
|
|
#define PPC_OPC_Rc 1 |
38 |
|
|
#define PPC_OPC_OE (1<<10) |
39 |
|
|
#define PPC_OPC_LK 1 |
40 |
|
|
#define PPC_OPC_AA (1<<1) |
41 |
|
|
|
42 |
|
|
#define PPC_OPC_TEMPL_A(opc, rD, rA, rB, rC) {rD=((opc)>>21)&0x1f;rA=((opc)>>16)&0x1f;rB=((opc)>>11)&0x1f;rC=((opc)>>6)&0x1f;} |
43 |
|
|
#define PPC_OPC_TEMPL_B(opc, BO, BI, BD) {BO=((opc)>>21)&0x1f;BI=((opc)>>16)&0x1f;BD=(opc)&0xfffc;if (BD&0x8000) BD |= 0xffff0000;} |
44 |
|
|
#define PPC_OPC_TEMPL_D_SImm(opc, rD, rA, imm) {rD=((opc)>>21)&0x1f;rA=((opc)>>16)&0x1f;imm=(opc)&0xffff;if (imm & 0x8000) imm |= 0xffff0000;} |
45 |
|
|
#define PPC_OPC_TEMPL_D_UImm(opc, rD, rA, imm) {rD=((opc)>>21)&0x1f;rA=((opc)>>16)&0x1f;imm=(opc)&0xffff;} |
46 |
|
|
#define PPC_OPC_TEMPL_D_Shift16(opc, rD, rA, imm) {rD=((opc)>>21)&0x1f;rA=((opc)>>16)&0x1f;imm=(opc)<<16;} |
47 |
|
|
#define PPC_OPC_TEMPL_I(opc, LI) {LI=(opc)&0x3fffffc;if (LI&0x02000000) LI |= 0xfc000000;} |
48 |
|
|
#define PPC_OPC_TEMPL_M(opc, rS, rA, SH, MB, ME) {rS=((opc)>>21)&0x1f;rA=((opc)>>16)&0x1f;SH=((opc)>>11)&0x1f;MB=((opc)>>6)&0x1f;ME=((opc)>>1)&0x1f;} |
49 |
|
|
#define PPC_OPC_TEMPL_X(opc, rS, rA, rB) {rS=((opc)>>21)&0x1f;rA=((opc)>>16)&0x1f;rB=((opc)>>11)&0x1f;} |
50 |
|
|
#define PPC_OPC_TEMPL_XFX(opc, rS, CRM) {rS=((opc)>>21)&0x1f;CRM=((opc)>>12)&0xff;} |
51 |
|
|
#define PPC_OPC_TEMPL_XO(opc, rS, rA, rB) {rS=((opc)>>21)&0x1f;rA=((opc)>>16)&0x1f;rB=((opc)>>11)&0x1f;} |
52 |
|
|
#define PPC_OPC_TEMPL_XL(opc, BO, BI, BD) {BO=((opc)>>21)&0x1f;BI=((opc)>>16)&0x1f;BD=((opc)>>11)&0x1f;} |
53 |
|
|
#define PPC_OPC_TEMPL_XFL(opc, rB, FM) {rB=((opc)>>11)&0x1f;FM=((opc)>>17)&0xff;} |
54 |
|
|
|
55 |
|
|
#endif |