1 |
#ifndef READCPU_H |
2 |
#define READCPU_H |
3 |
|
4 |
#ifdef __cplusplus |
5 |
extern "C" { |
6 |
#endif |
7 |
|
8 |
ENUMDECL { |
9 |
Dreg, Areg, Aind, Aipi, Apdi, Ad16, Ad8r, |
10 |
absw, absl, PC16, PC8r, imm, imm0, imm1, imm2, immi, am_unknown, am_illg |
11 |
} ENUMNAME (amodes); |
12 |
|
13 |
ENUMDECL { |
14 |
i_ILLG, |
15 |
|
16 |
i_OR, i_AND, i_EOR, i_ORSR, i_ANDSR, i_EORSR, |
17 |
i_SUB, i_SUBA, i_SUBX, i_SBCD, |
18 |
i_ADD, i_ADDA, i_ADDX, i_ABCD, |
19 |
i_NEG, i_NEGX, i_NBCD, i_CLR, i_NOT, i_TST, |
20 |
i_BTST, i_BCHG, i_BCLR, i_BSET, |
21 |
i_CMP, i_CMPM, i_CMPA, |
22 |
i_MVPRM, i_MVPMR, i_MOVE, i_MOVEA, i_MVSR2, i_MV2SR, |
23 |
i_SWAP, i_EXG, i_EXT, i_MVMEL, i_MVMLE, |
24 |
i_TRAP, i_MVR2USP, i_MVUSP2R, i_RESET, i_NOP, i_STOP, i_RTE, i_RTD, |
25 |
i_LINK, i_UNLK, |
26 |
i_RTS, i_TRAPV, i_RTR, |
27 |
i_JSR, i_JMP, i_BSR, i_Bcc, |
28 |
i_LEA, i_PEA, i_DBcc, i_Scc, |
29 |
i_DIVU, i_DIVS, i_MULU, i_MULS, |
30 |
i_ASR, i_ASL, i_LSR, i_LSL, i_ROL, i_ROR, i_ROXL, i_ROXR, |
31 |
i_ASRW, i_ASLW, i_LSRW, i_LSLW, i_ROLW, i_RORW, i_ROXLW, i_ROXRW, |
32 |
i_CHK,i_CHK2, |
33 |
i_MOVEC2, i_MOVE2C, i_CAS, i_CAS2, i_DIVL, i_MULL, |
34 |
i_BFTST,i_BFEXTU,i_BFCHG,i_BFEXTS,i_BFCLR,i_BFFFO,i_BFSET,i_BFINS, |
35 |
i_PACK, i_UNPK, i_TAS, i_BKPT, i_CALLM, i_RTM, i_TRAPcc, i_MOVES, |
36 |
i_FPP, i_FDBcc, i_FScc, i_FTRAPcc, i_FBcc, i_FSAVE, i_FRESTORE, |
37 |
i_CINVL, i_CINVP, i_CINVA, i_CPUSHL, i_CPUSHP, i_CPUSHA, i_MOVE16, |
38 |
i_MMUOP, |
39 |
i_EMULOP_RETURN, i_EMULOP |
40 |
} ENUMNAME (instrmnem); |
41 |
|
42 |
extern struct mnemolookup { |
43 |
instrmnem mnemo; |
44 |
const char *name; |
45 |
} lookuptab[]; |
46 |
|
47 |
ENUMDECL { |
48 |
sz_byte, sz_word, sz_long |
49 |
} ENUMNAME (wordsizes); |
50 |
|
51 |
ENUMDECL { |
52 |
fa_set, fa_unset, fa_zero, fa_one, fa_dontcare, fa_unknown, fa_isjmp |
53 |
} ENUMNAME (flagaffect); |
54 |
|
55 |
ENUMDECL { |
56 |
fu_used, fu_unused, fu_maybecc, fu_unknown, fu_isjmp |
57 |
} ENUMNAME (flaguse); |
58 |
|
59 |
ENUMDECL { |
60 |
fl_normal = 0, |
61 |
fl_branch = 1, |
62 |
fl_jump = 2, |
63 |
fl_return = 3, |
64 |
fl_trap = 4, |
65 |
fl_const_jump = 8, |
66 |
|
67 |
/* Instructions that can trap don't mark the end of a block */ |
68 |
fl_end_block = 3 |
69 |
} ENUMNAME (cflow_t); |
70 |
|
71 |
ENUMDECL { |
72 |
bit0, bit1, bitc, bitC, bitf, biti, bitI, bitj, bitJ, bitk, bitK, |
73 |
bits, bitS, bitd, bitD, bitr, bitR, bitz, bitE, bitp, lastbit |
74 |
} ENUMNAME (bitvals); |
75 |
|
76 |
struct instr_def { |
77 |
unsigned int bits; |
78 |
int n_variable; |
79 |
char bitpos[16]; |
80 |
unsigned int mask; |
81 |
int cpulevel; |
82 |
int plevel; |
83 |
struct { |
84 |
unsigned int flaguse:3; |
85 |
unsigned int flagset:3; |
86 |
} flaginfo[5]; |
87 |
unsigned char cflow; |
88 |
unsigned char sduse; |
89 |
const char *opcstr; |
90 |
}; |
91 |
|
92 |
extern struct instr_def defs68k[]; |
93 |
extern int n_defs68k; |
94 |
|
95 |
extern struct instr { |
96 |
long int handler; |
97 |
unsigned char dreg; |
98 |
unsigned char sreg; |
99 |
signed char dpos; |
100 |
signed char spos; |
101 |
unsigned char sduse; |
102 |
int flagdead:8, flaglive:8; |
103 |
unsigned int mnemo:8; |
104 |
unsigned int cc:4; |
105 |
unsigned int plev:2; |
106 |
wordsizes size:2; |
107 |
amodes smode:5; |
108 |
unsigned int stype:3; |
109 |
amodes dmode:5; |
110 |
unsigned int suse:1; |
111 |
unsigned int duse:1; |
112 |
unsigned int unused1:1; |
113 |
unsigned int clev:3; |
114 |
unsigned int cflow:3; |
115 |
unsigned int unused2:2; |
116 |
} *table68k; |
117 |
|
118 |
extern void read_table68k (void); |
119 |
extern void do_merges (void); |
120 |
extern int get_no_mismatches (void); |
121 |
extern int nr_cpuop_funcs; |
122 |
|
123 |
#ifdef __cplusplus |
124 |
} |
125 |
#endif |
126 |
|
127 |
#endif /* READCPU_H */ |