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