root / target-mips / cpu.h @ e034e2c3
History | View | Annotate | Download (11.2 kB)
1 | 6af0bf9c | bellard | #if !defined (__MIPS_CPU_H__)
|
---|---|---|---|
2 | 6af0bf9c | bellard | #define __MIPS_CPU_H__
|
3 | 6af0bf9c | bellard | |
4 | 4ad40f36 | bellard | #define TARGET_HAS_ICE 1 |
5 | 4ad40f36 | bellard | |
6 | 9042c0e2 | ths | #define ELF_MACHINE EM_MIPS
|
7 | 9042c0e2 | ths | |
8 | c5d6edc3 | bellard | #include "config.h" |
9 | 6af0bf9c | bellard | #include "mips-defs.h" |
10 | 6af0bf9c | bellard | #include "cpu-defs.h" |
11 | 6af0bf9c | bellard | #include "softfloat.h" |
12 | 6af0bf9c | bellard | |
13 | fdbb4691 | bellard | // uint_fast8_t and uint_fast16_t not in <sys/int_types.h>
|
14 | fdbb4691 | bellard | // XXX: move that elsewhere
|
15 | 36bb244b | ths | #if defined(HOST_SOLARIS) && HOST_SOLARIS < 10 |
16 | fdbb4691 | bellard | typedef unsigned char uint_fast8_t; |
17 | fdbb4691 | bellard | typedef unsigned int uint_fast16_t; |
18 | fdbb4691 | bellard | #endif
|
19 | fdbb4691 | bellard | |
20 | 6af0bf9c | bellard | typedef union fpr_t fpr_t; |
21 | 6af0bf9c | bellard | union fpr_t {
|
22 | 6ea83fed | bellard | float64 fd; /* ieee double precision */
|
23 | 6ea83fed | bellard | float32 fs[2];/* ieee single precision */ |
24 | 5a5012ec | ths | uint64_t d; /* binary double fixed-point */
|
25 | 6ea83fed | bellard | uint32_t w[2]; /* binary single fixed-point */ |
26 | 6af0bf9c | bellard | }; |
27 | 6ea83fed | bellard | /* define FP_ENDIAN_IDX to access the same location
|
28 | 6ea83fed | bellard | * in the fpr_t union regardless of the host endianess
|
29 | 6ea83fed | bellard | */
|
30 | 6ea83fed | bellard | #if defined(WORDS_BIGENDIAN)
|
31 | 6ea83fed | bellard | # define FP_ENDIAN_IDX 1 |
32 | 6ea83fed | bellard | #else
|
33 | 6ea83fed | bellard | # define FP_ENDIAN_IDX 0 |
34 | 6ea83fed | bellard | #endif
|
35 | 6af0bf9c | bellard | |
36 | 29929e34 | ths | typedef struct r4k_tlb_t r4k_tlb_t; |
37 | 29929e34 | ths | struct r4k_tlb_t {
|
38 | 6af0bf9c | bellard | target_ulong VPN; |
39 | 9c2149c8 | ths | uint32_t PageMask; |
40 | 98c1b82b | pbrook | uint_fast8_t ASID; |
41 | 98c1b82b | pbrook | uint_fast16_t G:1;
|
42 | 98c1b82b | pbrook | uint_fast16_t C0:3;
|
43 | 98c1b82b | pbrook | uint_fast16_t C1:3;
|
44 | 98c1b82b | pbrook | uint_fast16_t V0:1;
|
45 | 98c1b82b | pbrook | uint_fast16_t V1:1;
|
46 | 98c1b82b | pbrook | uint_fast16_t D0:1;
|
47 | 98c1b82b | pbrook | uint_fast16_t D1:1;
|
48 | 6af0bf9c | bellard | target_ulong PFN[2];
|
49 | 6af0bf9c | bellard | }; |
50 | 6af0bf9c | bellard | |
51 | 51b2772f | ths | typedef struct mips_def_t mips_def_t; |
52 | 51b2772f | ths | |
53 | 6af0bf9c | bellard | typedef struct CPUMIPSState CPUMIPSState; |
54 | 6af0bf9c | bellard | struct CPUMIPSState {
|
55 | 6af0bf9c | bellard | /* General integer registers */
|
56 | 6af0bf9c | bellard | target_ulong gpr[32];
|
57 | 6af0bf9c | bellard | /* Special registers */
|
58 | 6af0bf9c | bellard | target_ulong PC; |
59 | c570fd16 | ths | #if TARGET_LONG_BITS > HOST_LONG_BITS
|
60 | c570fd16 | ths | target_ulong t0; |
61 | c570fd16 | ths | target_ulong t1; |
62 | c570fd16 | ths | target_ulong t2; |
63 | c570fd16 | ths | #endif
|
64 | c570fd16 | ths | target_ulong HI, LO; |
65 | 6af0bf9c | bellard | /* Floating point registers */
|
66 | f7cfb2a1 | ths | fpr_t fpr[32];
|
67 | 6ea83fed | bellard | #ifndef USE_HOST_FLOAT_REGS
|
68 | 6ea83fed | bellard | fpr_t ft0; |
69 | 6ea83fed | bellard | fpr_t ft1; |
70 | 6ea83fed | bellard | fpr_t ft2; |
71 | 6ea83fed | bellard | #endif
|
72 | 6ea83fed | bellard | float_status fp_status; |
73 | 5a5012ec | ths | /* fpu implementation/revision register (fir) */
|
74 | 6af0bf9c | bellard | uint32_t fcr0; |
75 | 5a5012ec | ths | #define FCR0_F64 22 |
76 | 5a5012ec | ths | #define FCR0_L 21 |
77 | 5a5012ec | ths | #define FCR0_W 20 |
78 | 5a5012ec | ths | #define FCR0_3D 19 |
79 | 5a5012ec | ths | #define FCR0_PS 18 |
80 | 5a5012ec | ths | #define FCR0_D 17 |
81 | 5a5012ec | ths | #define FCR0_S 16 |
82 | 5a5012ec | ths | #define FCR0_PRID 8 |
83 | 5a5012ec | ths | #define FCR0_REV 0 |
84 | 6ea83fed | bellard | /* fcsr */
|
85 | 6ea83fed | bellard | uint32_t fcr31; |
86 | fd4a04eb | ths | #define SET_FP_COND(num,env) do { ((env)->fcr31) |= ((num) ? (1 << ((num) + 24)) : (1 << 23)); } while(0) |
87 | fd4a04eb | ths | #define CLEAR_FP_COND(num,env) do { ((env)->fcr31) &= ~((num) ? (1 << ((num) + 24)) : (1 << 23)); } while(0) |
88 | fd4a04eb | ths | #define GET_FP_COND(env) ((((env)->fcr31 >> 24) & 0xfe) | (((env)->fcr31 >> 23) & 0x1)) |
89 | 5a5012ec | ths | #define GET_FP_CAUSE(reg) (((reg) >> 12) & 0x3f) |
90 | 5a5012ec | ths | #define GET_FP_ENABLE(reg) (((reg) >> 7) & 0x1f) |
91 | 5a5012ec | ths | #define GET_FP_FLAGS(reg) (((reg) >> 2) & 0x1f) |
92 | 5a5012ec | ths | #define SET_FP_CAUSE(reg,v) do { (reg) = ((reg) & ~(0x3f << 12)) | ((v & 0x3f) << 12); } while(0) |
93 | 5a5012ec | ths | #define SET_FP_ENABLE(reg,v) do { (reg) = ((reg) & ~(0x1f << 7)) | ((v & 0x1f) << 7); } while(0) |
94 | 5a5012ec | ths | #define SET_FP_FLAGS(reg,v) do { (reg) = ((reg) & ~(0x1f << 2)) | ((v & 0x1f) << 2); } while(0) |
95 | 5a5012ec | ths | #define UPDATE_FP_FLAGS(reg,v) do { (reg) |= ((v & 0x1f) << 2); } while(0) |
96 | 6ea83fed | bellard | #define FP_INEXACT 1 |
97 | 6ea83fed | bellard | #define FP_UNDERFLOW 2 |
98 | 6ea83fed | bellard | #define FP_OVERFLOW 4 |
99 | 6ea83fed | bellard | #define FP_DIV0 8 |
100 | 6ea83fed | bellard | #define FP_INVALID 16 |
101 | 6ea83fed | bellard | #define FP_UNIMPLEMENTED 32 |
102 | 36d23958 | ths | |
103 | fcb4a419 | ths | uint32_t nb_tlb; |
104 | 29929e34 | ths | uint32_t tlb_in_use; |
105 | e034e2c3 | ths | uint32_t SEGBITS; |
106 | e034e2c3 | ths | target_ulong SEGMask; |
107 | 29929e34 | ths | int (*map_address) (CPUMIPSState *env, target_ulong *physical, int *prot, target_ulong address, int rw, int access_type); |
108 | 29929e34 | ths | void (*do_tlbwi) (void); |
109 | 29929e34 | ths | void (*do_tlbwr) (void); |
110 | 29929e34 | ths | void (*do_tlbp) (void); |
111 | 29929e34 | ths | void (*do_tlbr) (void); |
112 | 29929e34 | ths | union {
|
113 | 29929e34 | ths | struct {
|
114 | 29929e34 | ths | r4k_tlb_t tlb[MIPS_TLB_MAX]; |
115 | 29929e34 | ths | } r4k; |
116 | 29929e34 | ths | } mmu; |
117 | 29929e34 | ths | |
118 | 9c2149c8 | ths | int32_t CP0_Index; |
119 | 9c2149c8 | ths | int32_t CP0_Random; |
120 | 9c2149c8 | ths | target_ulong CP0_EntryLo0; |
121 | 9c2149c8 | ths | target_ulong CP0_EntryLo1; |
122 | 9c2149c8 | ths | target_ulong CP0_Context; |
123 | 9c2149c8 | ths | int32_t CP0_PageMask; |
124 | 9c2149c8 | ths | int32_t CP0_PageGrain; |
125 | 9c2149c8 | ths | int32_t CP0_Wired; |
126 | 9c2149c8 | ths | int32_t CP0_HWREna; |
127 | c570fd16 | ths | target_ulong CP0_BadVAddr; |
128 | 9c2149c8 | ths | int32_t CP0_Count; |
129 | 9c2149c8 | ths | target_ulong CP0_EntryHi; |
130 | 9c2149c8 | ths | int32_t CP0_Compare; |
131 | 9c2149c8 | ths | int32_t CP0_Status; |
132 | 6af0bf9c | bellard | #define CP0St_CU3 31 |
133 | 6af0bf9c | bellard | #define CP0St_CU2 30 |
134 | 6af0bf9c | bellard | #define CP0St_CU1 29 |
135 | 6af0bf9c | bellard | #define CP0St_CU0 28 |
136 | 6af0bf9c | bellard | #define CP0St_RP 27 |
137 | 6ea83fed | bellard | #define CP0St_FR 26 |
138 | 6af0bf9c | bellard | #define CP0St_RE 25 |
139 | 7a387fff | ths | #define CP0St_MX 24 |
140 | 7a387fff | ths | #define CP0St_PX 23 |
141 | 6af0bf9c | bellard | #define CP0St_BEV 22 |
142 | 6af0bf9c | bellard | #define CP0St_TS 21 |
143 | 6af0bf9c | bellard | #define CP0St_SR 20 |
144 | 6af0bf9c | bellard | #define CP0St_NMI 19 |
145 | 6af0bf9c | bellard | #define CP0St_IM 8 |
146 | 7a387fff | ths | #define CP0St_KX 7 |
147 | 7a387fff | ths | #define CP0St_SX 6 |
148 | 7a387fff | ths | #define CP0St_UX 5 |
149 | 6af0bf9c | bellard | #define CP0St_UM 4 |
150 | 7a387fff | ths | #define CP0St_R0 3 |
151 | 6af0bf9c | bellard | #define CP0St_ERL 2 |
152 | 6af0bf9c | bellard | #define CP0St_EXL 1 |
153 | 6af0bf9c | bellard | #define CP0St_IE 0 |
154 | 9c2149c8 | ths | int32_t CP0_IntCtl; |
155 | 9c2149c8 | ths | int32_t CP0_SRSCtl; |
156 | 9c2149c8 | ths | int32_t CP0_SRSMap; |
157 | 9c2149c8 | ths | int32_t CP0_Cause; |
158 | 7a387fff | ths | #define CP0Ca_BD 31 |
159 | 7a387fff | ths | #define CP0Ca_TI 30 |
160 | 7a387fff | ths | #define CP0Ca_CE 28 |
161 | 7a387fff | ths | #define CP0Ca_DC 27 |
162 | 7a387fff | ths | #define CP0Ca_PCI 26 |
163 | 6af0bf9c | bellard | #define CP0Ca_IV 23 |
164 | 7a387fff | ths | #define CP0Ca_WP 22 |
165 | 7a387fff | ths | #define CP0Ca_IP 8 |
166 | 4de9b249 | ths | #define CP0Ca_IP_mask 0x0000FF00 |
167 | 7a387fff | ths | #define CP0Ca_EC 2 |
168 | c570fd16 | ths | target_ulong CP0_EPC; |
169 | 9c2149c8 | ths | int32_t CP0_PRid; |
170 | b29a0341 | ths | int32_t CP0_EBase; |
171 | 9c2149c8 | ths | int32_t CP0_Config0; |
172 | 6af0bf9c | bellard | #define CP0C0_M 31 |
173 | 6af0bf9c | bellard | #define CP0C0_K23 28 |
174 | 6af0bf9c | bellard | #define CP0C0_KU 25 |
175 | 6af0bf9c | bellard | #define CP0C0_MDU 20 |
176 | 6af0bf9c | bellard | #define CP0C0_MM 17 |
177 | 6af0bf9c | bellard | #define CP0C0_BM 16 |
178 | 6af0bf9c | bellard | #define CP0C0_BE 15 |
179 | 6af0bf9c | bellard | #define CP0C0_AT 13 |
180 | 6af0bf9c | bellard | #define CP0C0_AR 10 |
181 | 6af0bf9c | bellard | #define CP0C0_MT 7 |
182 | 7a387fff | ths | #define CP0C0_VI 3 |
183 | 6af0bf9c | bellard | #define CP0C0_K0 0 |
184 | 9c2149c8 | ths | int32_t CP0_Config1; |
185 | 7a387fff | ths | #define CP0C1_M 31 |
186 | 6af0bf9c | bellard | #define CP0C1_MMU 25 |
187 | 6af0bf9c | bellard | #define CP0C1_IS 22 |
188 | 6af0bf9c | bellard | #define CP0C1_IL 19 |
189 | 6af0bf9c | bellard | #define CP0C1_IA 16 |
190 | 6af0bf9c | bellard | #define CP0C1_DS 13 |
191 | 6af0bf9c | bellard | #define CP0C1_DL 10 |
192 | 6af0bf9c | bellard | #define CP0C1_DA 7 |
193 | 7a387fff | ths | #define CP0C1_C2 6 |
194 | 7a387fff | ths | #define CP0C1_MD 5 |
195 | 6af0bf9c | bellard | #define CP0C1_PC 4 |
196 | 6af0bf9c | bellard | #define CP0C1_WR 3 |
197 | 6af0bf9c | bellard | #define CP0C1_CA 2 |
198 | 6af0bf9c | bellard | #define CP0C1_EP 1 |
199 | 6af0bf9c | bellard | #define CP0C1_FP 0 |
200 | 9c2149c8 | ths | int32_t CP0_Config2; |
201 | 7a387fff | ths | #define CP0C2_M 31 |
202 | 7a387fff | ths | #define CP0C2_TU 28 |
203 | 7a387fff | ths | #define CP0C2_TS 24 |
204 | 7a387fff | ths | #define CP0C2_TL 20 |
205 | 7a387fff | ths | #define CP0C2_TA 16 |
206 | 7a387fff | ths | #define CP0C2_SU 12 |
207 | 7a387fff | ths | #define CP0C2_SS 8 |
208 | 7a387fff | ths | #define CP0C2_SL 4 |
209 | 7a387fff | ths | #define CP0C2_SA 0 |
210 | 9c2149c8 | ths | int32_t CP0_Config3; |
211 | 7a387fff | ths | #define CP0C3_M 31 |
212 | 7a387fff | ths | #define CP0C3_DSPP 10 |
213 | 7a387fff | ths | #define CP0C3_LPA 7 |
214 | 7a387fff | ths | #define CP0C3_VEIC 6 |
215 | 7a387fff | ths | #define CP0C3_VInt 5 |
216 | 7a387fff | ths | #define CP0C3_SP 4 |
217 | 7a387fff | ths | #define CP0C3_MT 2 |
218 | 7a387fff | ths | #define CP0C3_SM 1 |
219 | 7a387fff | ths | #define CP0C3_TL 0 |
220 | e397ee33 | ths | int32_t CP0_Config6; |
221 | e397ee33 | ths | int32_t CP0_Config7; |
222 | c570fd16 | ths | target_ulong CP0_LLAddr; |
223 | fd88b6ab | ths | target_ulong CP0_WatchLo[8];
|
224 | fd88b6ab | ths | int32_t CP0_WatchHi[8];
|
225 | 9c2149c8 | ths | target_ulong CP0_XContext; |
226 | 9c2149c8 | ths | int32_t CP0_Framemask; |
227 | 9c2149c8 | ths | int32_t CP0_Debug; |
228 | 6af0bf9c | bellard | #define CPDB_DBD 31 |
229 | 6af0bf9c | bellard | #define CP0DB_DM 30 |
230 | 6af0bf9c | bellard | #define CP0DB_LSNM 28 |
231 | 6af0bf9c | bellard | #define CP0DB_Doze 27 |
232 | 6af0bf9c | bellard | #define CP0DB_Halt 26 |
233 | 6af0bf9c | bellard | #define CP0DB_CNT 25 |
234 | 6af0bf9c | bellard | #define CP0DB_IBEP 24 |
235 | 6af0bf9c | bellard | #define CP0DB_DBEP 21 |
236 | 6af0bf9c | bellard | #define CP0DB_IEXI 20 |
237 | 6af0bf9c | bellard | #define CP0DB_VER 15 |
238 | 6af0bf9c | bellard | #define CP0DB_DEC 10 |
239 | 6af0bf9c | bellard | #define CP0DB_SSt 8 |
240 | 6af0bf9c | bellard | #define CP0DB_DINT 5 |
241 | 6af0bf9c | bellard | #define CP0DB_DIB 4 |
242 | 6af0bf9c | bellard | #define CP0DB_DDBS 3 |
243 | 6af0bf9c | bellard | #define CP0DB_DDBL 2 |
244 | 6af0bf9c | bellard | #define CP0DB_DBp 1 |
245 | 6af0bf9c | bellard | #define CP0DB_DSS 0 |
246 | c570fd16 | ths | target_ulong CP0_DEPC; |
247 | 9c2149c8 | ths | int32_t CP0_Performance0; |
248 | 9c2149c8 | ths | int32_t CP0_TagLo; |
249 | 9c2149c8 | ths | int32_t CP0_DataLo; |
250 | 9c2149c8 | ths | int32_t CP0_TagHi; |
251 | 9c2149c8 | ths | int32_t CP0_DataHi; |
252 | c570fd16 | ths | target_ulong CP0_ErrorEPC; |
253 | 9c2149c8 | ths | int32_t CP0_DESAVE; |
254 | 6af0bf9c | bellard | /* Qemu */
|
255 | 6af0bf9c | bellard | int interrupt_request;
|
256 | 6af0bf9c | bellard | jmp_buf jmp_env; |
257 | 6af0bf9c | bellard | int exception_index;
|
258 | 6af0bf9c | bellard | int error_code;
|
259 | 6af0bf9c | bellard | int user_mode_only; /* user mode only simulation */ |
260 | 6af0bf9c | bellard | uint32_t hflags; /* CPU State */
|
261 | 6af0bf9c | bellard | /* TMASK defines different execution modes */
|
262 | 56b19403 | pbrook | #define MIPS_HFLAG_TMASK 0x007F |
263 | 78749ba8 | ths | #define MIPS_HFLAG_MODE 0x0007 /* execution modes */ |
264 | 6af0bf9c | bellard | #define MIPS_HFLAG_UM 0x0001 /* user mode */ |
265 | 5e755519 | ths | #define MIPS_HFLAG_DM 0x0002 /* Debug mode */ |
266 | 5e755519 | ths | #define MIPS_HFLAG_SM 0x0004 /* Supervisor mode */ |
267 | 5e755519 | ths | #define MIPS_HFLAG_64 0x0008 /* 64-bit instructions enabled */ |
268 | 5e755519 | ths | #define MIPS_HFLAG_FPU 0x0010 /* FPU enabled */ |
269 | 5e755519 | ths | #define MIPS_HFLAG_F64 0x0020 /* 64-bit FPU enabled */ |
270 | 6af0bf9c | bellard | #define MIPS_HFLAG_RE 0x0040 /* Reversed endianness */ |
271 | 4ad40f36 | bellard | /* If translation is interrupted between the branch instruction and
|
272 | 4ad40f36 | bellard | * the delay slot, record what type of branch it is so that we can
|
273 | 4ad40f36 | bellard | * resume translation properly. It might be possible to reduce
|
274 | 4ad40f36 | bellard | * this from three bits to two. */
|
275 | 4ad40f36 | bellard | #define MIPS_HFLAG_BMASK 0x0380 |
276 | 4ad40f36 | bellard | #define MIPS_HFLAG_B 0x0080 /* Unconditional branch */ |
277 | 4ad40f36 | bellard | #define MIPS_HFLAG_BC 0x0100 /* Conditional branch */ |
278 | 4ad40f36 | bellard | #define MIPS_HFLAG_BL 0x0180 /* Likely branch */ |
279 | 4ad40f36 | bellard | #define MIPS_HFLAG_BR 0x0200 /* branch to register (can't link TB) */ |
280 | 6af0bf9c | bellard | target_ulong btarget; /* Jump / branch target */
|
281 | 6af0bf9c | bellard | int bcond; /* Branch condition (if needed) */ |
282 | a316d335 | bellard | |
283 | 4ad40f36 | bellard | int halted; /* TRUE if the CPU is in suspend state */ |
284 | 4ad40f36 | bellard | |
285 | 7a387fff | ths | int SYNCI_Step; /* Address step size for SYNCI */ |
286 | 7a387fff | ths | int CCRes; /* Cycle count resolution/divisor */ |
287 | 5a5012ec | ths | int Status_rw_bitmask; /* Read/write bits in CP0_Status */ |
288 | 7a387fff | ths | |
289 | 33ac7f16 | ths | #ifdef CONFIG_USER_ONLY
|
290 | 6f5b89a0 | ths | target_ulong tls_value; |
291 | 6f5b89a0 | ths | #endif
|
292 | 6f5b89a0 | ths | |
293 | a316d335 | bellard | CPU_COMMON |
294 | 6ae81775 | ths | |
295 | 6ae81775 | ths | int ram_size;
|
296 | 6ae81775 | ths | const char *kernel_filename; |
297 | 6ae81775 | ths | const char *kernel_cmdline; |
298 | 6ae81775 | ths | const char *initrd_filename; |
299 | 6ae81775 | ths | |
300 | 51b2772f | ths | mips_def_t *cpu_model; |
301 | 33ac7f16 | ths | #ifndef CONFIG_USER_ONLY
|
302 | 33ac7f16 | ths | void *irq[8]; |
303 | 33ac7f16 | ths | #endif
|
304 | 51b2772f | ths | |
305 | 6ae81775 | ths | struct QEMUTimer *timer; /* Internal timer */ |
306 | 6af0bf9c | bellard | }; |
307 | 6af0bf9c | bellard | |
308 | 29929e34 | ths | int no_mmu_map_address (CPUMIPSState *env, target_ulong *physical, int *prot, |
309 | 29929e34 | ths | target_ulong address, int rw, int access_type); |
310 | 29929e34 | ths | int fixed_mmu_map_address (CPUMIPSState *env, target_ulong *physical, int *prot, |
311 | 29929e34 | ths | target_ulong address, int rw, int access_type); |
312 | 29929e34 | ths | int r4k_map_address (CPUMIPSState *env, target_ulong *physical, int *prot, |
313 | 29929e34 | ths | target_ulong address, int rw, int access_type); |
314 | 29929e34 | ths | void r4k_do_tlbwi (void); |
315 | 29929e34 | ths | void r4k_do_tlbwr (void); |
316 | 29929e34 | ths | void r4k_do_tlbp (void); |
317 | 29929e34 | ths | void r4k_do_tlbr (void); |
318 | 33d68b5f | ths | int mips_find_by_name (const unsigned char *name, mips_def_t **def); |
319 | 33d68b5f | ths | void mips_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...)); |
320 | 33d68b5f | ths | int cpu_mips_register (CPUMIPSState *env, mips_def_t *def);
|
321 | 33d68b5f | ths | |
322 | 9467d44c | ths | #define CPUState CPUMIPSState
|
323 | 9467d44c | ths | #define cpu_init cpu_mips_init
|
324 | 9467d44c | ths | #define cpu_exec cpu_mips_exec
|
325 | 9467d44c | ths | #define cpu_gen_code cpu_mips_gen_code
|
326 | 9467d44c | ths | #define cpu_signal_handler cpu_mips_signal_handler
|
327 | 9467d44c | ths | |
328 | 6af0bf9c | bellard | #include "cpu-all.h" |
329 | 6af0bf9c | bellard | |
330 | 6af0bf9c | bellard | /* Memory access type :
|
331 | 6af0bf9c | bellard | * may be needed for precise access rights control and precise exceptions.
|
332 | 6af0bf9c | bellard | */
|
333 | 6af0bf9c | bellard | enum {
|
334 | 6af0bf9c | bellard | /* 1 bit to define user level / supervisor access */
|
335 | 6af0bf9c | bellard | ACCESS_USER = 0x00,
|
336 | 6af0bf9c | bellard | ACCESS_SUPER = 0x01,
|
337 | 6af0bf9c | bellard | /* 1 bit to indicate direction */
|
338 | 6af0bf9c | bellard | ACCESS_STORE = 0x02,
|
339 | 6af0bf9c | bellard | /* Type of instruction that generated the access */
|
340 | 6af0bf9c | bellard | ACCESS_CODE = 0x10, /* Code fetch access */ |
341 | 6af0bf9c | bellard | ACCESS_INT = 0x20, /* Integer load/store access */ |
342 | 6af0bf9c | bellard | ACCESS_FLOAT = 0x30, /* floating point load/store access */ |
343 | 6af0bf9c | bellard | }; |
344 | 6af0bf9c | bellard | |
345 | 6af0bf9c | bellard | /* Exceptions */
|
346 | 6af0bf9c | bellard | enum {
|
347 | 6af0bf9c | bellard | EXCP_NONE = -1,
|
348 | 6af0bf9c | bellard | EXCP_RESET = 0,
|
349 | 6af0bf9c | bellard | EXCP_SRESET, |
350 | 6af0bf9c | bellard | EXCP_DSS, |
351 | 6af0bf9c | bellard | EXCP_DINT, |
352 | 6af0bf9c | bellard | EXCP_NMI, |
353 | 6af0bf9c | bellard | EXCP_MCHECK, |
354 | 6af0bf9c | bellard | EXCP_EXT_INTERRUPT, |
355 | 6af0bf9c | bellard | EXCP_DFWATCH, |
356 | 6af0bf9c | bellard | EXCP_DIB, /* 8 */
|
357 | 6af0bf9c | bellard | EXCP_IWATCH, |
358 | 6af0bf9c | bellard | EXCP_AdEL, |
359 | 6af0bf9c | bellard | EXCP_AdES, |
360 | 6af0bf9c | bellard | EXCP_TLBF, |
361 | 6af0bf9c | bellard | EXCP_IBE, |
362 | 6af0bf9c | bellard | EXCP_DBp, |
363 | 6af0bf9c | bellard | EXCP_SYSCALL, |
364 | 4ad40f36 | bellard | EXCP_BREAK, /* 16 */
|
365 | 4ad40f36 | bellard | EXCP_CpU, |
366 | 6af0bf9c | bellard | EXCP_RI, |
367 | 6af0bf9c | bellard | EXCP_OVERFLOW, |
368 | 6af0bf9c | bellard | EXCP_TRAP, |
369 | 5a5012ec | ths | EXCP_FPE, |
370 | 6af0bf9c | bellard | EXCP_DDBS, |
371 | 6af0bf9c | bellard | EXCP_DWATCH, |
372 | 5a5012ec | ths | EXCP_LAE, /* 24 */
|
373 | 5a5012ec | ths | EXCP_SAE, |
374 | 6af0bf9c | bellard | EXCP_LTLBL, |
375 | 6af0bf9c | bellard | EXCP_TLBL, |
376 | 6af0bf9c | bellard | EXCP_TLBS, |
377 | 6af0bf9c | bellard | EXCP_DBE, |
378 | 6af0bf9c | bellard | EXCP_DDBL, |
379 | 6af0bf9c | bellard | EXCP_MTCP0 = 0x104, /* mtmsr instruction: */ |
380 | 6af0bf9c | bellard | /* may change privilege level */
|
381 | 6af0bf9c | bellard | EXCP_BRANCH = 0x108, /* branch instruction */ |
382 | 6af0bf9c | bellard | EXCP_ERET = 0x10C, /* return from interrupt */ |
383 | 6af0bf9c | bellard | EXCP_SYSCALL_USER = 0x110, /* System call in user mode only */ |
384 | 6af0bf9c | bellard | EXCP_FLUSH = 0x109,
|
385 | 6af0bf9c | bellard | }; |
386 | 6af0bf9c | bellard | |
387 | 6af0bf9c | bellard | int cpu_mips_exec(CPUMIPSState *s);
|
388 | 6af0bf9c | bellard | CPUMIPSState *cpu_mips_init(void);
|
389 | 6af0bf9c | bellard | uint32_t cpu_mips_get_clock (void);
|
390 | 388bb21a | ths | int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc); |
391 | 6af0bf9c | bellard | |
392 | 6af0bf9c | bellard | #endif /* !defined (__MIPS_CPU_H__) */ |