1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * Mupen64plus - ops.h *
3 * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
4 * Copyright (C) 2002 Hacktarux *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
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. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
22 typedef struct _cpu_instruction_table
24 /* All jump/branch instructions (except JR and JALR) have three versions:
25 * - JUMPNAME() which for jumps inside the current block.
26 * - JUMPNAME_OUT() which jumps outside the current block.
27 * - JUMPNAME_IDLE() which does busy wait optimization.
29 * Busy wait optimization is used when a jump jumps to itself,
30 * and the instruction on the delay slot is a NOP.
31 * The program is waiting for the next interrupt, so we can just
32 * increase Count until the point where the next interrupt happens. */
34 // Load and store instructions
59 // Arithmetic instructions (ALU immediate)
72 // Arithmetic instructions (3-operand)
89 // Multiply and divide instructions
100 void (*DMULTU)(void);
104 // Jump and branch instructions
107 void (*J_IDLE)(void);
109 void (*JAL_OUT)(void);
110 void (*JAL_IDLE)(void);
114 void (*BEQ_OUT)(void);
115 void (*BEQ_IDLE)(void);
117 void (*BNE_OUT)(void);
118 void (*BNE_IDLE)(void);
120 void (*BLEZ_OUT)(void);
121 void (*BLEZ_IDLE)(void);
123 void (*BGTZ_OUT)(void);
124 void (*BGTZ_IDLE)(void);
126 void (*BLTZ_OUT)(void);
127 void (*BLTZ_IDLE)(void);
129 void (*BGEZ_OUT)(void);
130 void (*BGEZ_IDLE)(void);
131 void (*BLTZAL)(void);
132 void (*BLTZAL_OUT)(void);
133 void (*BLTZAL_IDLE)(void);
134 void (*BGEZAL)(void);
135 void (*BGEZAL_OUT)(void);
136 void (*BGEZAL_IDLE)(void);
139 void (*BEQL_OUT)(void);
140 void (*BEQL_IDLE)(void);
142 void (*BNEL_OUT)(void);
143 void (*BNEL_IDLE)(void);
145 void (*BLEZL_OUT)(void);
146 void (*BLEZL_IDLE)(void);
148 void (*BGTZL_OUT)(void);
149 void (*BGTZL_IDLE)(void);
151 void (*BLTZL_OUT)(void);
152 void (*BLTZL_IDLE)(void);
154 void (*BGEZL_OUT)(void);
155 void (*BGEZL_IDLE)(void);
156 void (*BLTZALL)(void);
157 void (*BLTZALL_OUT)(void);
158 void (*BLTZALL_IDLE)(void);
159 void (*BGEZALL)(void);
160 void (*BGEZALL_OUT)(void);
161 void (*BGEZALL_IDLE)(void);
163 void (*BC1TL_OUT)(void);
164 void (*BC1TL_IDLE)(void);
166 void (*BC1FL_OUT)(void);
167 void (*BC1FL_IDLE)(void);
169 // Shift instructions
183 void (*DSLL32)(void);
184 void (*DSRL32)(void);
185 void (*DSRA32)(void);
206 void (*BC1T_OUT)(void);
207 void (*BC1T_IDLE)(void);
209 void (*BC1F_OUT)(void);
210 void (*BC1F_IDLE)(void);
217 void (*CVT_S_D)(void);
218 void (*CVT_S_W)(void);
219 void (*CVT_S_L)(void);
220 void (*CVT_D_S)(void);
221 void (*CVT_D_W)(void);
222 void (*CVT_D_L)(void);
223 void (*CVT_W_S)(void);
224 void (*CVT_W_D)(void);
225 void (*CVT_L_S)(void);
226 void (*CVT_L_D)(void);
228 void (*ROUND_W_S)(void);
229 void (*ROUND_W_D)(void);
230 void (*ROUND_L_S)(void);
231 void (*ROUND_L_D)(void);
233 void (*TRUNC_W_S)(void);
234 void (*TRUNC_W_D)(void);
235 void (*TRUNC_L_S)(void);
236 void (*TRUNC_L_D)(void);
238 void (*CEIL_W_S)(void);
239 void (*CEIL_W_D)(void);
240 void (*CEIL_L_S)(void);
241 void (*CEIL_L_D)(void);
243 void (*FLOOR_W_S)(void);
244 void (*FLOOR_W_D)(void);
245 void (*FLOOR_L_S)(void);
246 void (*FLOOR_L_D)(void);
269 void (*SQRT_S)(void);
270 void (*SQRT_D)(void);
274 void (*C_UN_S)(void);
275 void (*C_UN_D)(void);
276 void (*C_EQ_S)(void);
277 void (*C_EQ_D)(void);
278 void (*C_UEQ_S)(void);
279 void (*C_UEQ_D)(void);
280 void (*C_OLT_S)(void);
281 void (*C_OLT_D)(void);
282 void (*C_ULT_S)(void);
283 void (*C_ULT_D)(void);
284 void (*C_OLE_S)(void);
285 void (*C_OLE_D)(void);
286 void (*C_ULE_S)(void);
287 void (*C_ULE_D)(void);
288 void (*C_SF_S)(void);
289 void (*C_SF_D)(void);
290 void (*C_NGLE_S)(void);
291 void (*C_NGLE_D)(void);
292 void (*C_SEQ_S)(void);
293 void (*C_SEQ_D)(void);
294 void (*C_NGL_S)(void);
295 void (*C_NGL_D)(void);
296 void (*C_LT_S)(void);
297 void (*C_LT_D)(void);
298 void (*C_NGE_S)(void);
299 void (*C_NGE_D)(void);
300 void (*C_LE_S)(void);
301 void (*C_LE_D)(void);
302 void (*C_NGT_S)(void);
303 void (*C_NGT_D)(void);
305 // Special instructions
306 void (*SYSCALL)(void);
308 // Exception instructions
311 // Emulator helper functions
312 void (*NOP)(void); // No operation (used to nullify R0 writes)
313 void (*RESERVED)(void); // Reserved instruction handler
314 void (*NI)(void); // Not implemented instruction handler
316 void (*FIN_BLOCK)(void); // Handler for the end of a block
317 void (*NOTCOMPILED)(void); // Handler for not yet compiled code
318 void (*NOTCOMPILED2)(void); // TODOXXX
319 } cpu_instruction_table;
321 extern const cpu_instruction_table cached_interpreter_table;
322 extern cpu_instruction_table current_instruction_table;