2012-11-01 15:19:01 +00:00
// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
2012-11-04 22:01:49 +00:00
// the Free Software Foundation, version 2.0 or later versions.
2012-11-01 15:19:01 +00:00
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
2013-03-29 19:51:14 +00:00
# include "Core/System.h"
# include "Core/MIPS/MIPS.h"
# include "Core/MIPS/MIPSDis.h"
# include "Core/MIPS/MIPSDisVFPU.h"
# include "Core/MIPS/MIPSInt.h"
# include "Core/MIPS/MIPSIntVFPU.h"
# include "Core/MIPS/MIPSCodeUtils.h"
# include "Core/MIPS/MIPSTables.h"
# include "Core/CoreTiming.h"
2013-08-12 01:20:43 +00:00
# include "Core/Reporting.h"
2013-03-29 19:51:14 +00:00
# include "Core/Debugger/Breakpoints.h"
2012-11-01 15:19:01 +00:00
# include "JitCommon/JitCommon.h"
enum MipsEncoding
{
2013-08-12 00:12:54 +00:00
Imme ,
Spec ,
Spe2 ,
Spe3 ,
RegI ,
Cop0 ,
Cop0CO ,
2012-11-01 15:19:01 +00:00
Cop1 ,
Cop1BC ,
2013-08-12 01:17:03 +00:00
Cop1S ,
Cop1W ,
2013-08-12 00:12:54 +00:00
Cop2 ,
Cop2BC2 ,
2012-11-01 15:19:01 +00:00
Cop2Rese ,
2013-08-12 00:12:54 +00:00
VFPU0 ,
VFPU1 ,
2012-11-01 15:19:01 +00:00
VFPU3 ,
VFPU4Jump ,
VFPU7 ,
VFPU4 ,
VFPU5 ,
VFPU6 ,
VFPUMatrix1 ,
VFPU9 ,
ALLEGREX0 ,
2013-08-12 00:12:54 +00:00
Emu ,
Rese ,
2013-08-12 02:10:17 +00:00
NumEncodings ,
2012-11-01 15:19:01 +00:00
} ;
struct MIPSInstruction
{
int altEncoding ;
const char * name ;
MIPSComp : : MIPSCompileFunc compile ;
# ifndef FINAL
MIPSDisFunc disasm ;
# endif
MIPSInterpretFunc interpret ;
//MIPSInstructionInfo information;
2013-08-24 20:22:10 +00:00
MIPSInfo flags ;
2012-11-01 15:19:01 +00:00
} ;
# define INVALID {-2}
2013-08-12 01:01:55 +00:00
# define INVALID_X_8 INVALID,INVALID,INVALID,INVALID,INVALID,INVALID,INVALID,INVALID
2012-11-01 15:19:01 +00:00
# define N(a) a
# ifndef FINAL
# define ENCODING(a) {a}
2013-08-24 20:22:10 +00:00
# define INSTR(name, comp, dis, inter, flags) {-1, N(name), comp, dis, inter, MIPSInfo(flags)}
2012-11-01 15:19:01 +00:00
# else
# define ENCODING(a) {a}
# define INSTR(name, comp, dis, inter, flags) {-1, comp, inter, flags}
# endif
using namespace MIPSDis ;
using namespace MIPSInt ;
using namespace MIPSComp ;
//regregreg instructions
2013-08-12 01:41:21 +00:00
const MIPSInstruction tableImmediate [ 64 ] = // xxxxxx ..... ..... ................
2012-11-01 15:19:01 +00:00
{
//0
ENCODING ( Spec ) ,
ENCODING ( RegI ) ,
INSTR ( " j " , & Jit : : Comp_Jump , Dis_JumpType , Int_JumpType , IS_JUMP | IN_IMM26 | DELAYSLOT ) ,
INSTR ( " jal " , & Jit : : Comp_Jump , Dis_JumpType , Int_JumpType , IS_JUMP | IN_IMM26 | OUT_RA | DELAYSLOT ) ,
2013-08-12 04:27:27 +00:00
INSTR ( " beq " , & Jit : : Comp_RelBranch , Dis_RelBranch2 , Int_RelBranch , IS_CONDBRANCH | IN_IMM16 | IN_RS | IN_RT | DELAYSLOT | CONDTYPE_EQ ) ,
INSTR ( " bne " , & Jit : : Comp_RelBranch , Dis_RelBranch2 , Int_RelBranch , IS_CONDBRANCH | IN_IMM16 | IN_RS | IN_RT | DELAYSLOT | CONDTYPE_NE ) ,
INSTR ( " blez " , & Jit : : Comp_RelBranch , Dis_RelBranch , Int_RelBranch , IS_CONDBRANCH | IN_IMM16 | IN_RS | DELAYSLOT | CONDTYPE_LEZ ) ,
INSTR ( " bgtz " , & Jit : : Comp_RelBranch , Dis_RelBranch , Int_RelBranch , IS_CONDBRANCH | IN_IMM16 | IN_RS | DELAYSLOT | CONDTYPE_GTZ ) ,
2012-11-01 15:19:01 +00:00
//8
INSTR ( " addi " , & Jit : : Comp_IType , Dis_addi , Int_IType , IN_RS | IN_IMM16 | OUT_RT ) ,
INSTR ( " addiu " , & Jit : : Comp_IType , Dis_addi , Int_IType , IN_RS | IN_IMM16 | OUT_RT ) ,
INSTR ( " slti " , & Jit : : Comp_IType , Dis_IType , Int_IType , IN_RS | IN_IMM16 | OUT_RT ) ,
INSTR ( " sltiu " , & Jit : : Comp_IType , Dis_IType , Int_IType , IN_RS | IN_IMM16 | OUT_RT ) ,
INSTR ( " andi " , & Jit : : Comp_IType , Dis_IType , Int_IType , IN_RS | IN_IMM16 | OUT_RT ) ,
INSTR ( " ori " , & Jit : : Comp_IType , Dis_ori , Int_IType , IN_RS | IN_IMM16 | OUT_RT ) ,
INSTR ( " xori " , & Jit : : Comp_IType , Dis_IType , Int_IType , IN_RS | IN_IMM16 | OUT_RT ) ,
INSTR ( " lui " , & Jit : : Comp_IType , Dis_IType1 , Int_IType , IN_IMM16 | OUT_RT ) ,
//16
ENCODING ( Cop0 ) , //cop0
ENCODING ( Cop1 ) , //cop1
ENCODING ( Cop2 ) , //cop2
INVALID , //copU
2013-08-12 04:27:27 +00:00
INSTR ( " beql " , & Jit : : Comp_RelBranch , Dis_RelBranch2 , Int_RelBranch , IS_CONDBRANCH | IN_IMM16 | IN_RS | IN_RT | DELAYSLOT | LIKELY | CONDTYPE_EQ ) , //L = likely
INSTR ( " bnel " , & Jit : : Comp_RelBranch , Dis_RelBranch2 , Int_RelBranch , IS_CONDBRANCH | IN_IMM16 | IN_RS | IN_RT | DELAYSLOT | LIKELY | CONDTYPE_NE ) ,
INSTR ( " blezl " , & Jit : : Comp_RelBranch , Dis_RelBranch , Int_RelBranch , IS_CONDBRANCH | IN_IMM16 | IN_RS | DELAYSLOT | LIKELY | CONDTYPE_LEZ ) ,
INSTR ( " bgtzl " , & Jit : : Comp_RelBranch , Dis_RelBranch , Int_RelBranch , IS_CONDBRANCH | IN_IMM16 | IN_RS | DELAYSLOT | LIKELY | CONDTYPE_GTZ ) ,
2012-11-01 15:19:01 +00:00
//24
2013-08-12 00:12:54 +00:00
ENCODING ( VFPU0 ) ,
ENCODING ( VFPU1 ) ,
ENCODING ( Emu ) ,
ENCODING ( VFPU3 ) ,
ENCODING ( Spe2 ) , //special2
INVALID , //, "jalx", 0, Dis_JumpType, Int_JumpType},
INVALID ,
ENCODING ( Spe3 ) , //special3
2012-11-01 15:19:01 +00:00
//32
2013-07-30 09:29:30 +00:00
INSTR ( " lb " , & Jit : : Comp_ITypeMem , Dis_ITypeMem , Int_ITypeMem , IN_MEM | IN_IMM16 | IN_RS_ADDR | OUT_RT | MEMTYPE_BYTE ) ,
INSTR ( " lh " , & Jit : : Comp_ITypeMem , Dis_ITypeMem , Int_ITypeMem , IN_MEM | IN_IMM16 | IN_RS_ADDR | OUT_RT | MEMTYPE_HWORD ) ,
INSTR ( " lwl " , & Jit : : Comp_ITypeMem , Dis_ITypeMem , Int_ITypeMem , IN_MEM | IN_IMM16 | IN_RS_ADDR | OUT_RT | MEMTYPE_WORD ) ,
INSTR ( " lw " , & Jit : : Comp_ITypeMem , Dis_ITypeMem , Int_ITypeMem , IN_MEM | IN_IMM16 | IN_RS_ADDR | OUT_RT | MEMTYPE_WORD ) ,
INSTR ( " lbu " , & Jit : : Comp_ITypeMem , Dis_ITypeMem , Int_ITypeMem , IN_MEM | IN_IMM16 | IN_RS_ADDR | OUT_RT | MEMTYPE_BYTE ) ,
INSTR ( " lhu " , & Jit : : Comp_ITypeMem , Dis_ITypeMem , Int_ITypeMem , IN_MEM | IN_IMM16 | IN_RS_ADDR | OUT_RT | MEMTYPE_HWORD ) ,
INSTR ( " lwr " , & Jit : : Comp_ITypeMem , Dis_ITypeMem , Int_ITypeMem , IN_MEM | IN_IMM16 | IN_RS_ADDR | OUT_RT | MEMTYPE_WORD ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2012-11-01 15:19:01 +00:00
//40
2013-07-30 09:29:30 +00:00
INSTR ( " sb " , & Jit : : Comp_ITypeMem , Dis_ITypeMem , Int_ITypeMem , IN_IMM16 | IN_RS_ADDR | IN_RT | OUT_MEM | MEMTYPE_BYTE ) ,
INSTR ( " sh " , & Jit : : Comp_ITypeMem , Dis_ITypeMem , Int_ITypeMem , IN_IMM16 | IN_RS_ADDR | IN_RT | OUT_MEM | MEMTYPE_HWORD ) ,
INSTR ( " swl " , & Jit : : Comp_ITypeMem , Dis_ITypeMem , Int_ITypeMem , IN_IMM16 | IN_RS_ADDR | IN_RT | OUT_MEM | MEMTYPE_WORD ) ,
INSTR ( " sw " , & Jit : : Comp_ITypeMem , Dis_ITypeMem , Int_ITypeMem , IN_IMM16 | IN_RS_ADDR | IN_RT | OUT_MEM | MEMTYPE_WORD ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
2013-07-30 09:29:30 +00:00
INSTR ( " swr " , & Jit : : Comp_ITypeMem , Dis_ITypeMem , Int_ITypeMem , IN_IMM16 | IN_RS_ADDR | IN_RT | OUT_MEM | MEMTYPE_WORD ) ,
2013-08-12 00:37:46 +00:00
INSTR ( " cache " , & Jit : : Comp_Generic , Dis_Generic , Int_Cache , IN_MEM | IN_IMM16 | IN_RS_ADDR | IN_OTHER | OUT_OTHER ) ,
2012-11-01 15:19:01 +00:00
//48
2013-08-12 00:37:46 +00:00
INSTR ( " ll " , & Jit : : Comp_Generic , Dis_Generic , Int_StoreSync , IN_MEM | IN_IMM16 | IN_RS_ADDR | OUT_RT | OUT_OTHER | MEMTYPE_WORD ) ,
INSTR ( " lwc1 " , & Jit : : Comp_FPULS , Dis_FPULS , Int_FPULS , IN_MEM | IN_IMM16 | IN_RS_ADDR | OUT_OTHER | MEMTYPE_FLOAT ) ,
INSTR ( " lv.s " , & Jit : : Comp_SV , Dis_SV , Int_SV , IN_MEM | IN_IMM16 | IN_RS_ADDR | OUT_OTHER | IS_VFPU | VFPU_NO_PREFIX | MEMTYPE_FLOAT ) ,
2013-08-12 00:12:54 +00:00
INVALID , // HIT THIS IN WIPEOUT
ENCODING ( VFPU4Jump ) ,
2013-08-12 00:37:46 +00:00
INSTR ( " lv " , & Jit : : Comp_SVQ , Dis_SVLRQ , Int_SVQ , IN_MEM | IN_IMM16 | IN_RS_ADDR | OUT_OTHER | IS_VFPU | VFPU_NO_PREFIX | MEMTYPE_VQUAD ) ,
INSTR ( " lv.q " , & Jit : : Comp_SVQ , Dis_SVQ , Int_SVQ , IN_MEM | IN_IMM16 | IN_RS_ADDR | OUT_OTHER | IS_VFPU | VFPU_NO_PREFIX | MEMTYPE_VQUAD ) , //copU
2013-08-12 00:12:54 +00:00
ENCODING ( VFPU5 ) ,
2012-11-01 15:19:01 +00:00
//56
2013-08-12 00:37:46 +00:00
INSTR ( " sc " , & Jit : : Comp_Generic , Dis_Generic , Int_StoreSync , IN_IMM16 | IN_RS_ADDR | IN_OTHER | IN_RT | OUT_RT | OUT_MEM | MEMTYPE_WORD ) ,
INSTR ( " swc1 " , & Jit : : Comp_FPULS , Dis_FPULS , Int_FPULS , IN_IMM16 | IN_RS_ADDR | IN_OTHER | OUT_MEM | MEMTYPE_FLOAT ) , //copU
INSTR ( " sv.s " , & Jit : : Comp_SV , Dis_SV , Int_SV , IN_IMM16 | IN_RS_ADDR | IN_OTHER | OUT_MEM | IS_VFPU | VFPU_NO_PREFIX | MEMTYPE_FLOAT ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2012-11-01 15:19:01 +00:00
//60
2013-08-12 00:12:54 +00:00
ENCODING ( VFPU6 ) ,
2013-08-12 00:37:46 +00:00
INSTR ( " sv " , & Jit : : Comp_SVQ , Dis_SVLRQ , Int_SVQ , IN_IMM16 | IN_RS_ADDR | IN_OTHER | OUT_MEM | IS_VFPU | VFPU_NO_PREFIX | MEMTYPE_VQUAD ) , //copU
INSTR ( " sv.q " , & Jit : : Comp_SVQ , Dis_SVQ , Int_SVQ , IN_IMM16 | IN_RS_ADDR | IN_OTHER | OUT_MEM | IS_VFPU | VFPU_NO_PREFIX | MEMTYPE_VQUAD ) ,
// Some call this VFPU7 (vflush/vnop/vsync), but it's not super important.
2013-08-11 13:31:54 +00:00
INSTR ( " vflush " , & Jit : : Comp_DoNothing , Dis_Vflush , Int_Vflush , IS_VFPU | VFPU_NO_PREFIX ) ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 01:41:21 +00:00
const MIPSInstruction tableSpecial [ 64 ] = // 000000 ..... ..... ..... ..... xxxxxx
2012-11-01 15:19:01 +00:00
{
INSTR ( " sll " , & Jit : : Comp_ShiftType , Dis_ShiftType , Int_ShiftType , OUT_RD | IN_RT | IN_SA ) ,
2013-08-12 00:12:54 +00:00
INVALID , // copu
2012-11-01 15:19:01 +00:00
INSTR ( " srl " , & Jit : : Comp_ShiftType , Dis_ShiftType , Int_ShiftType , OUT_RD | IN_RT | IN_SA ) ,
INSTR ( " sra " , & Jit : : Comp_ShiftType , Dis_ShiftType , Int_ShiftType , OUT_RD | IN_RT | IN_SA ) ,
INSTR ( " sllv " , & Jit : : Comp_ShiftType , Dis_VarShiftType , Int_ShiftType , OUT_RD | IN_RT | IN_RS_SHIFT ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2012-11-01 15:19:01 +00:00
INSTR ( " srlv " , & Jit : : Comp_ShiftType , Dis_VarShiftType , Int_ShiftType , OUT_RD | IN_RT | IN_RS_SHIFT ) ,
INSTR ( " srav " , & Jit : : Comp_ShiftType , Dis_VarShiftType , Int_ShiftType , OUT_RD | IN_RT | IN_RS_SHIFT ) ,
//8
2013-07-30 09:29:30 +00:00
INSTR ( " jr " , & Jit : : Comp_JumpReg , Dis_JumpRegType , Int_JumpRegType , IS_JUMP | IN_RS | DELAYSLOT ) ,
INSTR ( " jalr " , & Jit : : Comp_JumpReg , Dis_JumpRegType , Int_JumpRegType , IS_JUMP | IN_RS | OUT_RA | DELAYSLOT ) ,
INSTR ( " movz " , & Jit : : Comp_RType3 , Dis_RType3 , Int_RType3 , OUT_RD | IN_RS | IN_RT | IS_CONDMOVE | CONDTYPE_EQ ) ,
INSTR ( " movn " , & Jit : : Comp_RType3 , Dis_RType3 , Int_RType3 , OUT_RD | IN_RS | IN_RT | IS_CONDMOVE | CONDTYPE_NE ) ,
2013-08-12 01:01:55 +00:00
INSTR ( " syscall " , & Jit : : Comp_Syscall , Dis_Syscall , Int_Syscall , IN_MEM | IN_OTHER | OUT_MEM | OUT_OTHER ) ,
2013-02-01 08:49:14 +00:00
INSTR ( " break " , & Jit : : Comp_Break , Dis_Generic , Int_Break , 0 ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2013-02-10 11:14:55 +00:00
INSTR ( " sync " , & Jit : : Comp_DoNothing , Dis_Generic , Int_Sync , 0 ) ,
2012-11-01 15:19:01 +00:00
//16
2013-01-28 23:48:42 +00:00
INSTR ( " mfhi " , & Jit : : Comp_MulDivType , Dis_FromHiloTransfer , Int_MulDivType , OUT_RD | IN_OTHER ) ,
INSTR ( " mthi " , & Jit : : Comp_MulDivType , Dis_ToHiloTransfer , Int_MulDivType , IN_RS | OUT_OTHER ) ,
INSTR ( " mflo " , & Jit : : Comp_MulDivType , Dis_FromHiloTransfer , Int_MulDivType , OUT_RD | IN_OTHER ) ,
INSTR ( " mtlo " , & Jit : : Comp_MulDivType , Dis_ToHiloTransfer , Int_MulDivType , IN_RS | OUT_OTHER ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
2013-08-12 01:01:55 +00:00
INSTR ( " clz " , & Jit : : Comp_RType2 , Dis_RType2 , Int_RType2 , OUT_RD | IN_RS ) ,
INSTR ( " clo " , & Jit : : Comp_RType2 , Dis_RType2 , Int_RType2 , OUT_RD | IN_RS ) ,
2012-11-01 15:19:01 +00:00
//24
2013-01-28 23:48:42 +00:00
INSTR ( " mult " , & Jit : : Comp_MulDivType , Dis_MulDivType , Int_MulDivType , IN_RS | IN_RT | OUT_OTHER ) ,
INSTR ( " multu " , & Jit : : Comp_MulDivType , Dis_MulDivType , Int_MulDivType , IN_RS | IN_RT | OUT_OTHER ) ,
INSTR ( " div " , & Jit : : Comp_MulDivType , Dis_MulDivType , Int_MulDivType , IN_RS | IN_RT | OUT_OTHER ) ,
INSTR ( " divu " , & Jit : : Comp_MulDivType , Dis_MulDivType , Int_MulDivType , IN_RS | IN_RT | OUT_OTHER ) ,
2013-08-12 01:01:55 +00:00
INSTR ( " madd " , & Jit : : Comp_MulDivType , Dis_MulDivType , Int_MulDivType , IN_RS | IN_RT | IN_OTHER | OUT_OTHER ) ,
INSTR ( " maddu " , & Jit : : Comp_MulDivType , Dis_MulDivType , Int_MulDivType , IN_RS | IN_RT | IN_OTHER | OUT_OTHER ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
2012-11-01 15:19:01 +00:00
//32
2013-08-12 01:01:55 +00:00
INSTR ( " add " , & Jit : : Comp_RType3 , Dis_RType3 , Int_RType3 , IN_RS | IN_RT | OUT_RD ) ,
INSTR ( " addu " , & Jit : : Comp_RType3 , Dis_addu , Int_RType3 , IN_RS | IN_RT | OUT_RD ) ,
INSTR ( " sub " , & Jit : : Comp_RType3 , Dis_RType3 , Int_RType3 , IN_RS | IN_RT | OUT_RD ) ,
INSTR ( " subu " , & Jit : : Comp_RType3 , Dis_RType3 , Int_RType3 , IN_RS | IN_RT | OUT_RD ) ,
INSTR ( " and " , & Jit : : Comp_RType3 , Dis_RType3 , Int_RType3 , IN_RS | IN_RT | OUT_RD ) ,
INSTR ( " or " , & Jit : : Comp_RType3 , Dis_addu , Int_RType3 , IN_RS | IN_RT | OUT_RD ) ,
INSTR ( " xor " , & Jit : : Comp_RType3 , Dis_RType3 , Int_RType3 , IN_RS | IN_RT | OUT_RD ) ,
INSTR ( " nor " , & Jit : : Comp_RType3 , Dis_RType3 , Int_RType3 , IN_RS | IN_RT | OUT_RD ) ,
2012-11-01 15:19:01 +00:00
//40
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
2013-08-12 01:01:55 +00:00
INSTR ( " slt " , & Jit : : Comp_RType3 , Dis_RType3 , Int_RType3 , IN_RS | IN_RT | OUT_RD ) ,
INSTR ( " sltu " , & Jit : : Comp_RType3 , Dis_RType3 , Int_RType3 , IN_RS | IN_RT | OUT_RD ) ,
INSTR ( " max " , & Jit : : Comp_RType3 , Dis_RType3 , Int_RType3 , IN_RS | IN_RT | OUT_RD ) ,
INSTR ( " min " , & Jit : : Comp_RType3 , Dis_RType3 , Int_RType3 , IN_RS | IN_RT | OUT_RD ) ,
INSTR ( " msub " , & Jit : : Comp_MulDivType , Dis_MulDivType , Int_MulDivType , IN_RS | IN_RT | IN_OTHER | OUT_OTHER ) ,
INSTR ( " msubu " , & Jit : : Comp_MulDivType , Dis_MulDivType , Int_MulDivType , IN_RS | IN_RT | IN_OTHER | OUT_OTHER ) ,
2012-11-01 15:19:01 +00:00
//48
INSTR ( " tge " , & Jit : : Comp_Generic , Dis_RType3 , 0 , 0 ) ,
INSTR ( " tgeu " , & Jit : : Comp_Generic , Dis_RType3 , 0 , 0 ) ,
INSTR ( " tlt " , & Jit : : Comp_Generic , Dis_RType3 , 0 , 0 ) ,
INSTR ( " tltu " , & Jit : : Comp_Generic , Dis_RType3 , 0 , 0 ) ,
INSTR ( " teq " , & Jit : : Comp_Generic , Dis_RType3 , 0 , 0 ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2012-11-01 15:19:01 +00:00
INSTR ( " tne " , & Jit : : Comp_Generic , Dis_RType3 , 0 , 0 ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2012-11-01 15:19:01 +00:00
//56
2013-08-12 01:01:55 +00:00
INVALID_X_8 ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 01:17:03 +00:00
// Theoretically should not hit these.
2013-08-12 01:41:21 +00:00
const MIPSInstruction tableSpecial2 [ 64 ] = // 011100 ..... ..... ..... ..... xxxxxx
2012-11-01 15:19:01 +00:00
{
2013-08-12 01:17:03 +00:00
INSTR ( " halt " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
INVALID , INVALID , INVALID , INVALID , INVALID , INVALID , INVALID ,
2013-08-12 02:10:17 +00:00
//8
2013-08-12 01:01:55 +00:00
INVALID_X_8 ,
2013-08-12 01:17:03 +00:00
INVALID_X_8 ,
2013-08-12 01:01:55 +00:00
INVALID_X_8 ,
2013-08-12 02:10:17 +00:00
//32
2013-08-12 01:17:03 +00:00
INVALID , INVALID , INVALID , INVALID ,
INSTR ( " mfic " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2013-08-12 01:17:03 +00:00
INSTR ( " mtic " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2013-08-12 02:10:17 +00:00
//40
2013-08-12 01:01:55 +00:00
INVALID_X_8 ,
2013-08-12 01:17:03 +00:00
INVALID_X_8 ,
INVALID_X_8 ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 01:41:21 +00:00
const MIPSInstruction tableSpecial3 [ 64 ] = // 011111 ..... ..... ..... ..... xxxxxx
2012-11-01 15:19:01 +00:00
{
2013-02-10 11:14:55 +00:00
INSTR ( " ext " , & Jit : : Comp_Special3 , Dis_Special3 , Int_Special3 , IN_RS | OUT_RT ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
INVALID ,
2013-08-12 01:41:21 +00:00
INSTR ( " ins " , & Jit : : Comp_Special3 , Dis_Special3 , Int_Special3 , IN_RS | IN_RT | OUT_RT ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
INVALID ,
2012-11-01 15:19:01 +00:00
//8
2013-08-12 01:01:55 +00:00
INVALID_X_8 ,
2012-11-01 15:19:01 +00:00
//16
2013-08-12 01:01:55 +00:00
INVALID_X_8 ,
2013-08-12 02:10:17 +00:00
//24
2013-08-12 03:40:21 +00:00
// TODO: Is this right? Or should it only be 32? Comment above (24) was mistakenly 32 before.
2013-08-12 00:12:54 +00:00
ENCODING ( ALLEGREX0 ) ,
INVALID , INVALID , INVALID , INVALID , INVALID , INVALID , INVALID ,
2013-08-12 02:10:17 +00:00
//32
2013-08-12 00:12:54 +00:00
ENCODING ( ALLEGREX0 ) ,
INVALID , INVALID , INVALID , INVALID , INVALID , INVALID , INVALID ,
2013-08-12 02:10:17 +00:00
//40
2013-08-12 01:01:55 +00:00
INVALID_X_8 ,
INVALID_X_8 ,
2013-08-12 02:10:17 +00:00
//56
2013-08-12 00:12:54 +00:00
INVALID , INVALID , INVALID ,
2012-11-01 15:19:01 +00:00
INSTR ( " rdhwr " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
2013-08-12 00:12:54 +00:00
INVALID , INVALID , INVALID , INVALID ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 01:41:21 +00:00
const MIPSInstruction tableRegImm [ 32 ] = // 000001 ..... xxxxx ................
2012-11-01 15:19:01 +00:00
{
2013-08-12 04:27:27 +00:00
INSTR ( " bltz " , & Jit : : Comp_RelBranchRI , Dis_RelBranch , Int_RelBranchRI , IS_CONDBRANCH | IN_IMM16 | IN_RS | DELAYSLOT | CONDTYPE_LTZ ) ,
INSTR ( " bgez " , & Jit : : Comp_RelBranchRI , Dis_RelBranch , Int_RelBranchRI , IS_CONDBRANCH | IN_IMM16 | IN_RS | DELAYSLOT | CONDTYPE_GEZ ) ,
INSTR ( " bltzl " , & Jit : : Comp_RelBranchRI , Dis_RelBranch , Int_RelBranchRI , IS_CONDBRANCH | IN_IMM16 | IN_RS | DELAYSLOT | LIKELY | CONDTYPE_LTZ ) ,
INSTR ( " bgezl " , & Jit : : Comp_RelBranchRI , Dis_RelBranch , Int_RelBranchRI , IS_CONDBRANCH | IN_IMM16 | IN_RS | DELAYSLOT | LIKELY | CONDTYPE_GEZ ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
INVALID ,
INVALID ,
2013-08-12 02:10:17 +00:00
//8
2012-11-01 15:19:01 +00:00
INSTR ( " tgei " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
INSTR ( " tgeiu " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
INSTR ( " tlti " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
INSTR ( " tltiu " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
INSTR ( " teqi " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2012-11-01 15:19:01 +00:00
INSTR ( " tnei " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2013-08-12 02:10:17 +00:00
//16
2013-08-12 04:27:27 +00:00
INSTR ( " bltzal " , & Jit : : Comp_RelBranchRI , Dis_RelBranch , Int_RelBranchRI , IS_CONDBRANCH | IN_IMM16 | IN_RS | OUT_RA | DELAYSLOT | CONDTYPE_LTZ ) ,
INSTR ( " bgezal " , & Jit : : Comp_RelBranchRI , Dis_RelBranch , Int_RelBranchRI , IS_CONDBRANCH | IN_IMM16 | IN_RS | OUT_RA | DELAYSLOT | CONDTYPE_GEZ ) ,
INSTR ( " bltzall " , & Jit : : Comp_RelBranchRI , Dis_RelBranch , Int_RelBranchRI , IS_CONDBRANCH | IN_IMM16 | IN_RS | OUT_RA | DELAYSLOT | LIKELY | CONDTYPE_LTZ ) , //L = likely
INSTR ( " bgezall " , & Jit : : Comp_RelBranchRI , Dis_RelBranch , Int_RelBranchRI , IS_CONDBRANCH | IN_IMM16 | IN_RS | OUT_RA | DELAYSLOT | LIKELY | CONDTYPE_GEZ ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
INVALID ,
INVALID ,
2013-08-12 02:10:17 +00:00
//24
2013-08-12 00:12:54 +00:00
INVALID , INVALID , INVALID , INVALID , INVALID , INVALID , INVALID ,
2012-11-01 15:19:01 +00:00
INSTR ( " synci " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
} ;
2013-08-12 02:10:17 +00:00
const MIPSInstruction tableCop2 [ 32 ] = // 010010 xxxxx ..... ................
2012-11-01 15:19:01 +00:00
{
INSTR ( " mfc2 " , & Jit : : Comp_Generic , Dis_Generic , 0 , OUT_RT ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2012-11-01 15:19:01 +00:00
INSTR ( " cfc2 " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
2013-08-12 02:10:17 +00:00
INSTR ( " mfv " , & Jit : : Comp_Mftv , Dis_Mftv , Int_Mftv , IN_OTHER | OUT_RT | IS_VFPU ) ,
2012-11-01 15:19:01 +00:00
INSTR ( " mtc2 " , & Jit : : Comp_Generic , Dis_Generic , 0 , IN_RT ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2012-11-01 15:19:01 +00:00
INSTR ( " ctc2 " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
2013-08-12 02:10:17 +00:00
INSTR ( " mtv " , & Jit : : Comp_Mftv , Dis_Mftv , Int_Mftv , IN_RT | OUT_OTHER | IS_VFPU ) ,
//8
2013-08-12 00:12:54 +00:00
ENCODING ( Cop2BC2 ) ,
2012-11-01 15:19:01 +00:00
INSTR ( " ?? " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
INSTR ( " ?? " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
INSTR ( " ?? " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
INSTR ( " ?? " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
INSTR ( " ?? " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
INSTR ( " ?? " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
INSTR ( " ?? " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
2013-08-12 02:10:17 +00:00
//16
2013-08-12 01:01:55 +00:00
INVALID_X_8 ,
INVALID_X_8 ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 02:10:17 +00:00
const MIPSInstruction tableCop2BC2 [ 4 ] = // 010010 01000 ...xx ................
2012-11-01 15:19:01 +00:00
{
2013-08-12 04:27:27 +00:00
INSTR ( " bvf " , & Jit : : Comp_VBranch , Dis_VBranch , Int_VBranch , IS_CONDBRANCH | IN_IMM16 | IN_OTHER | DELAYSLOT | IS_VFPU ) ,
INSTR ( " bvt " , & Jit : : Comp_VBranch , Dis_VBranch , Int_VBranch , IS_CONDBRANCH | IN_IMM16 | IN_OTHER | DELAYSLOT | IS_VFPU ) ,
INSTR ( " bvfl " , & Jit : : Comp_VBranch , Dis_VBranch , Int_VBranch , IS_CONDBRANCH | IN_IMM16 | IN_OTHER | DELAYSLOT | LIKELY | IS_VFPU ) ,
INSTR ( " bvtl " , & Jit : : Comp_VBranch , Dis_VBranch , Int_VBranch , IS_CONDBRANCH | IN_IMM16 | IN_OTHER | DELAYSLOT | LIKELY | IS_VFPU ) ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 02:10:17 +00:00
const MIPSInstruction tableCop0 [ 32 ] = // 010000 xxxxx ..... ................
2012-11-01 15:19:01 +00:00
{
INSTR ( " mfc0 " , & Jit : : Comp_Generic , Dis_Generic , 0 , OUT_RT ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
INVALID ,
2012-11-01 15:19:01 +00:00
INSTR ( " mtc0 " , & Jit : : Comp_Generic , Dis_Generic , 0 , IN_RT ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
INVALID ,
2013-08-12 02:10:17 +00:00
//8
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
2012-11-01 15:19:01 +00:00
INSTR ( " rdpgpr " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
INSTR ( " mfmc0 " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
2012-11-01 15:19:01 +00:00
INSTR ( " wrpgpr " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2013-08-12 02:10:17 +00:00
//16
2013-08-12 00:12:54 +00:00
ENCODING ( Cop0CO ) , ENCODING ( Cop0CO ) , ENCODING ( Cop0CO ) , ENCODING ( Cop0CO ) , ENCODING ( Cop0CO ) , ENCODING ( Cop0CO ) , ENCODING ( Cop0CO ) , ENCODING ( Cop0CO ) ,
ENCODING ( Cop0CO ) , ENCODING ( Cop0CO ) , ENCODING ( Cop0CO ) , ENCODING ( Cop0CO ) , ENCODING ( Cop0CO ) , ENCODING ( Cop0CO ) , ENCODING ( Cop0CO ) , ENCODING ( Cop0CO ) ,
2012-11-01 15:19:01 +00:00
} ;
2013-02-02 22:47:00 +00:00
// we won't encounter these since we only do user mode emulation
2013-08-12 02:10:17 +00:00
const MIPSInstruction tableCop0CO [ 64 ] = // 010000 1.... ..... ..... ..... xxxxxx
2012-11-01 15:19:01 +00:00
{
2013-08-12 00:12:54 +00:00
INVALID ,
2012-11-01 15:19:01 +00:00
INSTR ( " tlbr " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
INSTR ( " tlbwi " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
INVALID ,
2012-11-01 15:19:01 +00:00
INSTR ( " tlbwr " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2013-08-12 02:10:17 +00:00
//8
2012-11-01 15:19:01 +00:00
INSTR ( " tlbp " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
2013-08-12 00:12:54 +00:00
INVALID , INVALID , INVALID , INVALID , INVALID , INVALID , INVALID ,
2013-08-12 01:01:55 +00:00
INVALID_X_8 ,
2013-08-12 02:10:17 +00:00
//24
2012-11-01 15:19:01 +00:00
INSTR ( " eret " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
INSTR ( " iack " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
2013-08-12 00:12:54 +00:00
INVALID , INVALID , INVALID , INVALID , INVALID ,
2012-11-01 15:19:01 +00:00
INSTR ( " deret " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
2013-08-12 02:10:17 +00:00
//32
2012-11-01 15:19:01 +00:00
INSTR ( " wait " , & Jit : : Comp_Generic , Dis_Generic , 0 , 0 ) ,
2013-08-12 00:12:54 +00:00
INVALID , INVALID , INVALID , INVALID , INVALID , INVALID , INVALID ,
2013-08-12 02:10:17 +00:00
//40
2013-08-12 01:01:55 +00:00
INVALID_X_8 ,
INVALID_X_8 ,
INVALID_X_8 ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 02:33:52 +00:00
const MIPSInstruction tableCop1 [ 32 ] = // 010001 xxxxx ..... ..... ...........
2012-11-01 15:19:01 +00:00
{
2013-08-12 03:40:21 +00:00
INSTR ( " mfc1 " , & Jit : : Comp_mxc1 , Dis_mxc1 , Int_mxc1 , IN_OTHER | OUT_RT ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2013-08-12 03:40:21 +00:00
INSTR ( " cfc1 " , & Jit : : Comp_mxc1 , Dis_mxc1 , Int_mxc1 , IN_OTHER | IN_FPUFLAG | OUT_RT ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2013-08-12 03:40:21 +00:00
INSTR ( " mtc1 " , & Jit : : Comp_mxc1 , Dis_mxc1 , Int_mxc1 , IN_RT | OUT_OTHER ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2013-08-12 03:40:21 +00:00
INSTR ( " ctc1 " , & Jit : : Comp_mxc1 , Dis_mxc1 , Int_mxc1 , IN_RT | OUT_FPUFLAG | OUT_OTHER ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2013-08-12 02:33:52 +00:00
//8
2013-08-12 00:12:54 +00:00
ENCODING ( Cop1BC ) , INVALID , INVALID , INVALID , INVALID , INVALID , INVALID , INVALID ,
2013-08-12 02:33:52 +00:00
//16
2013-08-12 01:17:03 +00:00
ENCODING ( Cop1S ) , INVALID , INVALID , INVALID ,
ENCODING ( Cop1W ) , INVALID , INVALID , INVALID ,
2013-08-12 02:33:52 +00:00
//24
2013-08-12 01:01:55 +00:00
INVALID_X_8 ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 02:33:52 +00:00
const MIPSInstruction tableCop1BC [ 32 ] = // 010001 01000 xxxxx ................
2012-11-01 15:19:01 +00:00
{
2013-08-12 04:27:27 +00:00
INSTR ( " bc1f " , & Jit : : Comp_FPUBranch , Dis_FPUBranch , Int_FPUBranch , IS_CONDBRANCH | IN_IMM16 | IN_FPUFLAG | DELAYSLOT ) ,
INSTR ( " bc1t " , & Jit : : Comp_FPUBranch , Dis_FPUBranch , Int_FPUBranch , IS_CONDBRANCH | IN_IMM16 | IN_FPUFLAG | DELAYSLOT ) ,
INSTR ( " bc1fl " , & Jit : : Comp_FPUBranch , Dis_FPUBranch , Int_FPUBranch , IS_CONDBRANCH | IN_IMM16 | IN_FPUFLAG | DELAYSLOT | LIKELY ) ,
INSTR ( " bc1tl " , & Jit : : Comp_FPUBranch , Dis_FPUBranch , Int_FPUBranch , IS_CONDBRANCH | IN_IMM16 | IN_FPUFLAG | DELAYSLOT | LIKELY ) ,
2013-08-12 00:12:54 +00:00
INVALID , INVALID , INVALID , INVALID ,
2013-08-12 02:33:52 +00:00
//8
2013-08-12 01:01:55 +00:00
INVALID_X_8 ,
INVALID_X_8 ,
INVALID_X_8 ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 02:33:52 +00:00
const MIPSInstruction tableCop1S [ 64 ] = // 010001 10000 ..... ..... ..... xxxxxx
2013-08-12 01:17:03 +00:00
{
2013-08-12 02:33:52 +00:00
INSTR ( " add.s " , & Jit : : Comp_FPU3op , Dis_FPU3op , Int_FPU3op , IN_OTHER | OUT_OTHER ) ,
INSTR ( " sub.s " , & Jit : : Comp_FPU3op , Dis_FPU3op , Int_FPU3op , IN_OTHER | OUT_OTHER ) ,
INSTR ( " mul.s " , & Jit : : Comp_FPU3op , Dis_FPU3op , Int_FPU3op , IN_OTHER | OUT_OTHER ) ,
INSTR ( " div.s " , & Jit : : Comp_FPU3op , Dis_FPU3op , Int_FPU3op , IN_OTHER | OUT_OTHER ) ,
INSTR ( " sqrt.s " , & Jit : : Comp_FPU2op , Dis_FPU2op , Int_FPU2op , IN_OTHER | OUT_OTHER ) ,
INSTR ( " abs.s " , & Jit : : Comp_FPU2op , Dis_FPU2op , Int_FPU2op , IN_OTHER | OUT_OTHER ) ,
INSTR ( " mov.s " , & Jit : : Comp_FPU2op , Dis_FPU2op , Int_FPU2op , IN_OTHER | OUT_OTHER ) ,
INSTR ( " neg.s " , & Jit : : Comp_FPU2op , Dis_FPU2op , Int_FPU2op , IN_OTHER | OUT_OTHER ) ,
//8
2013-08-12 01:17:03 +00:00
INVALID , INVALID , INVALID , INVALID ,
2013-08-12 02:33:52 +00:00
INSTR ( " round.w.s " , & Jit : : Comp_FPU2op , Dis_FPU2op , Int_FPU2op , IN_OTHER | OUT_OTHER ) ,
INSTR ( " trunc.w.s " , & Jit : : Comp_FPU2op , Dis_FPU2op , Int_FPU2op , IN_OTHER | OUT_OTHER ) ,
INSTR ( " ceil.w.s " , & Jit : : Comp_FPU2op , Dis_FPU2op , Int_FPU2op , IN_OTHER | OUT_OTHER ) ,
INSTR ( " floor.w.s " , & Jit : : Comp_FPU2op , Dis_FPU2op , Int_FPU2op , IN_OTHER | OUT_OTHER ) ,
//16
2013-08-12 01:17:03 +00:00
INVALID_X_8 ,
2013-08-12 02:33:52 +00:00
//24
2013-08-12 01:17:03 +00:00
INVALID_X_8 ,
2013-08-12 02:33:52 +00:00
//32
INVALID , INVALID , INVALID , INVALID ,
//36
INSTR ( " cvt.w.s " , & Jit : : Comp_FPU2op , Dis_FPU2op , Int_FPU2op , IN_OTHER | OUT_OTHER ) ,
2013-08-12 01:17:03 +00:00
INVALID ,
INSTR ( " dis.int " , & Jit : : Comp_Generic , Dis_Generic , Int_Interrupt , 0 ) ,
INVALID ,
2013-08-12 02:33:52 +00:00
//40
2013-08-12 01:17:03 +00:00
INVALID_X_8 ,
2013-08-12 03:08:48 +00:00
//48 - 010001 10000 ..... ..... ..... 11xxxx
2013-08-12 02:33:52 +00:00
INSTR ( " c.f " , & Jit : : Comp_FPUComp , Dis_FPUComp , Int_FPUComp , IN_OTHER | OUT_FPUFLAG ) ,
INSTR ( " c.un " , & Jit : : Comp_FPUComp , Dis_FPUComp , Int_FPUComp , IN_OTHER | OUT_FPUFLAG ) ,
INSTR ( " c.eq " , & Jit : : Comp_FPUComp , Dis_FPUComp , Int_FPUComp , IN_OTHER | OUT_FPUFLAG ) ,
INSTR ( " c.ueq " , & Jit : : Comp_FPUComp , Dis_FPUComp , Int_FPUComp , IN_OTHER | OUT_FPUFLAG ) ,
INSTR ( " c.olt " , & Jit : : Comp_FPUComp , Dis_FPUComp , Int_FPUComp , IN_OTHER | OUT_FPUFLAG ) ,
INSTR ( " c.ult " , & Jit : : Comp_FPUComp , Dis_FPUComp , Int_FPUComp , IN_OTHER | OUT_FPUFLAG ) ,
INSTR ( " c.ole " , & Jit : : Comp_FPUComp , Dis_FPUComp , Int_FPUComp , IN_OTHER | OUT_FPUFLAG ) ,
INSTR ( " c.ule " , & Jit : : Comp_FPUComp , Dis_FPUComp , Int_FPUComp , IN_OTHER | OUT_FPUFLAG ) ,
INSTR ( " c.sf " , & Jit : : Comp_FPUComp , Dis_FPUComp , Int_FPUComp , IN_OTHER | OUT_FPUFLAG ) ,
INSTR ( " c.ngle " , & Jit : : Comp_FPUComp , Dis_FPUComp , Int_FPUComp , IN_OTHER | OUT_FPUFLAG ) ,
INSTR ( " c.seq " , & Jit : : Comp_FPUComp , Dis_FPUComp , Int_FPUComp , IN_OTHER | OUT_FPUFLAG ) ,
INSTR ( " c.ngl " , & Jit : : Comp_FPUComp , Dis_FPUComp , Int_FPUComp , IN_OTHER | OUT_FPUFLAG ) ,
INSTR ( " c.lt " , & Jit : : Comp_FPUComp , Dis_FPUComp , Int_FPUComp , IN_OTHER | OUT_FPUFLAG ) ,
INSTR ( " c.nge " , & Jit : : Comp_FPUComp , Dis_FPUComp , Int_FPUComp , IN_OTHER | OUT_FPUFLAG ) ,
INSTR ( " c.le " , & Jit : : Comp_FPUComp , Dis_FPUComp , Int_FPUComp , IN_OTHER | OUT_FPUFLAG ) ,
INSTR ( " c.ngt " , & Jit : : Comp_FPUComp , Dis_FPUComp , Int_FPUComp , IN_OTHER | OUT_FPUFLAG ) ,
2013-08-12 01:17:03 +00:00
} ;
2013-08-12 02:33:52 +00:00
const MIPSInstruction tableCop1W [ 64 ] = // 010001 10100 ..... ..... ..... xxxxxx
2013-08-12 01:17:03 +00:00
{
INVALID_X_8 ,
2013-08-12 02:33:52 +00:00
//8
INVALID_X_8 ,
//16
2013-08-12 01:17:03 +00:00
INVALID_X_8 ,
2013-08-12 02:33:52 +00:00
//24
INVALID_X_8 ,
//32
INSTR ( " cvt.s.w " , & Jit : : Comp_FPU2op , Dis_FPU2op , Int_FPU2op , IN_OTHER | OUT_OTHER ) ,
2013-08-12 01:17:03 +00:00
INVALID , INVALID , INVALID ,
2013-08-12 02:33:52 +00:00
//36
INVALID ,
2013-08-12 01:17:03 +00:00
INVALID ,
INVALID ,
2013-08-12 02:33:52 +00:00
INVALID ,
//40
INVALID_X_8 ,
//48
INVALID_X_8 ,
2013-08-12 01:17:03 +00:00
INVALID_X_8 ,
} ;
2013-08-12 03:08:48 +00:00
const MIPSInstruction tableVFPU0 [ 8 ] = // 011000 xxx ....... . ....... . .......
2012-11-01 15:19:01 +00:00
{
2013-08-12 03:40:21 +00:00
INSTR ( " vadd " , & Jit : : Comp_VecDo3 , Dis_VectorSet3 , Int_VecDo3 , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vsub " , & Jit : : Comp_VecDo3 , Dis_VectorSet3 , Int_VecDo3 , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2013-08-12 03:08:48 +00:00
// TODO: Flags may not be correct (prefixes, etc.)
2013-08-12 03:40:21 +00:00
INSTR ( " vsbn " , & Jit : : Comp_Generic , Dis_VectorSet3 , Int_Vsbn , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
2013-08-12 00:12:54 +00:00
INVALID , INVALID , INVALID , INVALID ,
2013-08-12 03:40:21 +00:00
INSTR ( " vdiv " , & Jit : : Comp_VecDo3 , Dis_VectorSet3 , Int_VecDo3 , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 03:08:48 +00:00
const MIPSInstruction tableVFPU1 [ 8 ] = // 011001 xxx ....... . ....... . .......
2012-11-01 15:19:01 +00:00
{
2013-08-12 03:40:21 +00:00
INSTR ( " vmul " , & Jit : : Comp_VecDo3 , Dis_VectorSet3 , Int_VecDo3 , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vdot " , & Jit : : Comp_VDot , Dis_VectorDot , Int_VDot , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vscl " , & Jit : : Comp_VScl , Dis_VScl , Int_VScl , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2013-08-12 03:40:21 +00:00
INSTR ( " vhdp " , & Jit : : Comp_VHdp , Dis_Generic , Int_VHdp , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vcrs " , & Jit : : Comp_VCrs , Dis_Vcrs , Int_Vcrs , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vdet " , & Jit : : Comp_VDet , Dis_Generic , Int_Vdet , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 03:08:48 +00:00
const MIPSInstruction tableVFPU3 [ 8 ] = // 011011 xxx ....... . ....... . .......
2012-11-01 15:19:01 +00:00
{
2013-08-12 03:40:21 +00:00
INSTR ( " vcmp " , & Jit : : Comp_Vcmp , Dis_Vcmp , Int_Vcmp , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2013-08-12 03:40:21 +00:00
INSTR ( " vmin " , & Jit : : Comp_VecDo3 , Dis_VectorSet3 , Int_Vminmax , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vmax " , & Jit : : Comp_VecDo3 , Dis_VectorSet3 , Int_Vminmax , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2013-08-12 03:40:21 +00:00
INSTR ( " vscmp " , & Jit : : Comp_Generic , Dis_VectorSet3 , Int_Vscmp , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vsge " , & Jit : : Comp_VecDo3 , Dis_VectorSet3 , Int_Vsge , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vslt " , & Jit : : Comp_VecDo3 , Dis_VectorSet3 , Int_Vslt , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 03:08:48 +00:00
const MIPSInstruction tableVFPU4Jump [ 32 ] = // 110100 xxxxx ..... . ....... . .......
2012-11-01 15:19:01 +00:00
{
2013-08-12 00:12:54 +00:00
ENCODING ( VFPU4 ) ,
ENCODING ( VFPU7 ) ,
ENCODING ( VFPU9 ) ,
2013-08-12 03:08:48 +00:00
INSTR ( " vcst " , & Jit : : Comp_Vcst , Dis_Vcst , Int_Vcst , OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2013-08-12 00:12:54 +00:00
INVALID , INVALID , INVALID , INVALID ,
2012-11-01 15:19:01 +00:00
//8
2013-08-12 01:01:55 +00:00
INVALID_X_8 ,
2012-11-01 15:19:01 +00:00
//16
2013-08-12 03:08:48 +00:00
INSTR ( " vf2in " , & Jit : : Comp_Vf2i , Dis_Vf2i , Int_Vf2i , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vf2iz " , & Jit : : Comp_Vf2i , Dis_Vf2i , Int_Vf2i , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vf2iu " , & Jit : : Comp_Vf2i , Dis_Vf2i , Int_Vf2i , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vf2id " , & Jit : : Comp_Vf2i , Dis_Vf2i , Int_Vf2i , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2012-11-01 15:19:01 +00:00
//20
2013-08-12 03:08:48 +00:00
INSTR ( " vi2f " , & Jit : : Comp_Vi2f , Dis_Vf2i , Int_Vi2f , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vcmov " , & Jit : : Comp_Vcmov , Dis_Vcmov , Int_Vcmov , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INVALID ,
INVALID ,
//24 - 110100 11 ........ . ....... . .......
// TODO: Flags may not be correct (prefixes, etc.)
INSTR ( " vwbn.s " , & Jit : : Comp_Generic , Dis_Generic , Int_Vwbn , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
INSTR ( " vwbn.s " , & Jit : : Comp_Generic , Dis_Generic , Int_Vwbn , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
INSTR ( " vwbn.s " , & Jit : : Comp_Generic , Dis_Generic , Int_Vwbn , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
INSTR ( " vwbn.s " , & Jit : : Comp_Generic , Dis_Generic , Int_Vwbn , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
INSTR ( " vwbn.s " , & Jit : : Comp_Generic , Dis_Generic , Int_Vwbn , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
INSTR ( " vwbn.s " , & Jit : : Comp_Generic , Dis_Generic , Int_Vwbn , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
INSTR ( " vwbn.s " , & Jit : : Comp_Generic , Dis_Generic , Int_Vwbn , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
INSTR ( " vwbn.s " , & Jit : : Comp_Generic , Dis_Generic , Int_Vwbn , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 03:08:48 +00:00
const MIPSInstruction tableVFPU7 [ 32 ] = // 110100 00001 xxxxx . ....... . .......
2012-11-01 15:19:01 +00:00
{
2013-08-12 03:08:48 +00:00
INSTR ( " vrnds " , & Jit : : Comp_Generic , Dis_Generic , Int_Vrnds , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vrndi " , & Jit : : Comp_Generic , Dis_Generic , Int_VrndX , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vrndf1 " , & Jit : : Comp_Generic , Dis_Generic , Int_VrndX , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vrndf2 " , & Jit : : Comp_Generic , Dis_Generic , Int_VrndX , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2013-08-12 00:12:54 +00:00
INVALID , INVALID , INVALID , INVALID ,
2012-11-01 15:19:01 +00:00
//8
2013-08-12 00:12:54 +00:00
INVALID , INVALID , INVALID , INVALID ,
2013-08-12 03:08:48 +00:00
// TODO: Flags may not be correct (prefixes, etc.) Is this the correct encoding? Others say 10110.
INSTR ( " vsbz " , & Jit : : Comp_Generic , Dis_Generic , Int_Vsbz , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
2013-08-12 00:12:54 +00:00
INVALID , INVALID , INVALID ,
2012-11-01 15:19:01 +00:00
//16
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
2013-08-12 03:08:48 +00:00
INSTR ( " vf2h " , & Jit : : Comp_Generic , Dis_Generic , Int_Vf2h , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vh2f " , & Jit : : Comp_Generic , Dis_Generic , Int_Vh2f , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2012-11-01 15:19:01 +00:00
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
INVALID ,
2013-08-12 03:08:48 +00:00
// TODO: Flags may not be correct (prefixes, etc.)
INSTR ( " vlgb " , & Jit : : Comp_Generic , Dis_Generic , Int_Vlgb , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
2012-11-01 15:19:01 +00:00
//24
2013-08-12 03:08:48 +00:00
INSTR ( " vuc2i " , & Jit : : Comp_Vx2i , Dis_Vs2i , Int_Vx2i , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) , // Seen in BraveStory, initialization 110100 00001110000 000 0001 0000 0000
INSTR ( " vc2i " , & Jit : : Comp_Vx2i , Dis_Vs2i , Int_Vx2i , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vus2i " , & Jit : : Comp_Vx2i , Dis_Vs2i , Int_Vx2i , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vs2i " , & Jit : : Comp_Vx2i , Dis_Vs2i , Int_Vx2i , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vi2uc " , & Jit : : Comp_Vi2x , Dis_Vi2x , Int_Vi2x , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vi2c " , & Jit : : Comp_Vi2x , Dis_Vi2x , Int_Vi2x , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vi2us " , & Jit : : Comp_Vi2x , Dis_Vi2x , Int_Vi2x , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vi2s " , & Jit : : Comp_Vi2x , Dis_Vi2x , Int_Vi2x , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2012-11-01 15:19:01 +00:00
} ;
// 110100 00000 10100 0000000000000000
// 110100 00000 10111 0000000000000000
2013-08-12 03:08:48 +00:00
const MIPSInstruction tableVFPU4 [ 32 ] = // 110100 00000 xxxxx . ....... . .......
2012-11-01 15:19:01 +00:00
{
2013-08-12 03:08:48 +00:00
INSTR ( " vmov " , & Jit : : Comp_VV2Op , Dis_VectorSet2 , Int_VV2Op , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vabs " , & Jit : : Comp_VV2Op , Dis_VectorSet2 , Int_VV2Op , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vneg " , & Jit : : Comp_VV2Op , Dis_VectorSet2 , Int_VV2Op , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vidt " , & Jit : : Comp_VIdt , Dis_VectorSet1 , Int_Vidt , OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vsat0 " , & Jit : : Comp_VV2Op , Dis_VectorSet2 , Int_VV2Op , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vsat1 " , & Jit : : Comp_VV2Op , Dis_VectorSet2 , Int_VV2Op , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vzero " , & Jit : : Comp_VVectorInit , Dis_VectorSet1 , Int_VVectorInit , OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vone " , & Jit : : Comp_VVectorInit , Dis_VectorSet1 , Int_VVectorInit , OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
//8
INVALID_X_8 ,
//16
INSTR ( " vrcp " , & Jit : : Comp_VV2Op , Dis_VectorSet2 , Int_VV2Op , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vrsq " , & Jit : : Comp_VV2Op , Dis_VectorSet2 , Int_VV2Op , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vsin " , & Jit : : Comp_VV2Op , Dis_VectorSet2 , Int_VV2Op , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vcos " , & Jit : : Comp_VV2Op , Dis_VectorSet2 , Int_VV2Op , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vexp2 " , & Jit : : Comp_VV2Op , Dis_VectorSet2 , Int_VV2Op , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vlog2 " , & Jit : : Comp_VV2Op , Dis_VectorSet2 , Int_VV2Op , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vsqrt " , & Jit : : Comp_VV2Op , Dis_VectorSet2 , Int_VV2Op , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vasin " , & Jit : : Comp_VV2Op , Dis_VectorSet2 , Int_VV2Op , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
//24
INSTR ( " vnrcp " , & Jit : : Comp_VV2Op , Dis_VectorSet2 , Int_VV2Op , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INVALID ,
INSTR ( " vnsin " , & Jit : : Comp_VV2Op , Dis_VectorSet2 , Int_VV2Op , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INVALID ,
2013-08-12 03:40:21 +00:00
INSTR ( " vrexp2 " , & Jit : : Comp_VV2Op , Dis_VectorSet2 , Int_VV2Op , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2013-08-12 00:12:54 +00:00
INVALID , INVALID , INVALID ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 03:40:21 +00:00
MIPSInstruction tableVFPU5 [ 8 ] = // 110111 xxx ....... ................
2012-11-01 15:19:01 +00:00
{
2013-08-12 04:27:27 +00:00
INSTR ( " vpfxs " , & Jit : : Comp_VPFX , Dis_VPFXST , Int_VPFX , IN_IMM16 | OUT_OTHER | IS_VFPU ) ,
INSTR ( " vpfxs " , & Jit : : Comp_VPFX , Dis_VPFXST , Int_VPFX , IN_IMM16 | OUT_OTHER | IS_VFPU ) ,
INSTR ( " vpfxt " , & Jit : : Comp_VPFX , Dis_VPFXST , Int_VPFX , IN_IMM16 | OUT_OTHER | IS_VFPU ) ,
INSTR ( " vpfxt " , & Jit : : Comp_VPFX , Dis_VPFXST , Int_VPFX , IN_IMM16 | OUT_OTHER | IS_VFPU ) ,
INSTR ( " vpfxd " , & Jit : : Comp_VPFX , Dis_VPFXD , Int_VPFX , IN_IMM16 | OUT_OTHER | IS_VFPU ) ,
INSTR ( " vpfxd " , & Jit : : Comp_VPFX , Dis_VPFXD , Int_VPFX , IN_IMM16 | OUT_OTHER | IS_VFPU ) ,
INSTR ( " viim.s " , & Jit : : Comp_Viim , Dis_Viim , Int_Viim , IN_IMM16 | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vfim.s " , & Jit : : Comp_Vfim , Dis_Viim , Int_Viim , IN_IMM16 | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 03:40:21 +00:00
const MIPSInstruction tableVFPU6 [ 32 ] = // 111100 xxxxx ..... . ....... . .......
2012-11-01 15:19:01 +00:00
{
2013-08-12 03:40:21 +00:00
//0
INSTR ( " vmmul " , & Jit : : Comp_Vmmul , Dis_MatrixMult , Int_Vmmul , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vmmul " , & Jit : : Comp_Vmmul , Dis_MatrixMult , Int_Vmmul , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vmmul " , & Jit : : Comp_Vmmul , Dis_MatrixMult , Int_Vmmul , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vmmul " , & Jit : : Comp_Vmmul , Dis_MatrixMult , Int_Vmmul , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " v(h)tfm2 " , & Jit : : Comp_Vtfm , Dis_Vtfm , Int_Vtfm , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " v(h)tfm2 " , & Jit : : Comp_Vtfm , Dis_Vtfm , Int_Vtfm , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " v(h)tfm2 " , & Jit : : Comp_Vtfm , Dis_Vtfm , Int_Vtfm , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " v(h)tfm2 " , & Jit : : Comp_Vtfm , Dis_Vtfm , Int_Vtfm , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
//8
INSTR ( " v(h)tfm3 " , & Jit : : Comp_Vtfm , Dis_Vtfm , Int_Vtfm , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " v(h)tfm3 " , & Jit : : Comp_Vtfm , Dis_Vtfm , Int_Vtfm , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " v(h)tfm3 " , & Jit : : Comp_Vtfm , Dis_Vtfm , Int_Vtfm , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " v(h)tfm3 " , & Jit : : Comp_Vtfm , Dis_Vtfm , Int_Vtfm , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " v(h)tfm4 " , & Jit : : Comp_Vtfm , Dis_Vtfm , Int_Vtfm , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " v(h)tfm4 " , & Jit : : Comp_Vtfm , Dis_Vtfm , Int_Vtfm , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " v(h)tfm4 " , & Jit : : Comp_Vtfm , Dis_Vtfm , Int_Vtfm , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " v(h)tfm4 " , & Jit : : Comp_Vtfm , Dis_Vtfm , Int_Vtfm , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2012-11-01 15:19:01 +00:00
//16
2013-08-12 03:40:21 +00:00
INSTR ( " vmscl " , & Jit : : Comp_Vmscl , Dis_Generic , Int_Vmscl , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vmscl " , & Jit : : Comp_Vmscl , Dis_Generic , Int_Vmscl , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vmscl " , & Jit : : Comp_Vmscl , Dis_Generic , Int_Vmscl , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vmscl " , & Jit : : Comp_Vmscl , Dis_Generic , Int_Vmscl , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vcrsp.t/vqmul.q " , & Jit : : Comp_VCrossQuat , Dis_CrossQuat , Int_CrossQuat , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vcrsp.t/vqmul.q " , & Jit : : Comp_VCrossQuat , Dis_CrossQuat , Int_CrossQuat , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vcrsp.t/vqmul.q " , & Jit : : Comp_VCrossQuat , Dis_CrossQuat , Int_CrossQuat , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vcrsp.t/vqmul.q " , & Jit : : Comp_VCrossQuat , Dis_CrossQuat , Int_CrossQuat , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
//24
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
INVALID ,
INVALID ,
2013-08-12 03:40:21 +00:00
//28
2013-08-12 00:12:54 +00:00
ENCODING ( VFPUMatrix1 ) ,
2013-08-12 03:40:21 +00:00
INSTR ( " vrot " , & Jit : : Comp_VRot , Dis_VRot , Int_Vrot , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 03:40:21 +00:00
// TODO: Should this only be when bit 20 is 0?
const MIPSInstruction tableVFPUMatrixSet1 [ 16 ] = // 111100 11100 .xxxx . ....... . ....... (rm x is 16)
2012-11-01 15:19:01 +00:00
{
2013-08-12 03:40:21 +00:00
INSTR ( " vmmov " , & Jit : : Comp_Vmmov , Dis_MatrixSet2 , Int_Vmmov , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
2013-08-12 03:40:21 +00:00
INSTR ( " vmidt " , & Jit : : Comp_VMatrixInit , Dis_MatrixSet1 , Int_VMatrixInit , OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2012-11-01 15:19:01 +00:00
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
2013-08-12 03:40:21 +00:00
INSTR ( " vmzero " , & Jit : : Comp_VMatrixInit , Dis_MatrixSet1 , Int_VMatrixInit , OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vmone " , & Jit : : Comp_VMatrixInit , Dis_MatrixSet1 , Int_VMatrixInit , OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2012-11-01 15:19:01 +00:00
2013-08-12 01:01:55 +00:00
INVALID_X_8 ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 03:40:21 +00:00
const MIPSInstruction tableVFPU9 [ 32 ] = // 110100 00010 xxxxx . ....... . .......
2012-11-01 15:19:01 +00:00
{
2013-08-12 03:40:21 +00:00
// TODO: Flags may not be correct (prefixes, etc.)
INSTR ( " vsrt1 " , & Jit : : Comp_Generic , Dis_Vbfy , Int_Vsrt1 , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
// TODO: Flags may not be correct (prefixes, etc.)
INSTR ( " vsrt2 " , & Jit : : Comp_Generic , Dis_Vbfy , Int_Vsrt2 , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
INSTR ( " vbfy1 " , & Jit : : Comp_Generic , Dis_Vbfy , Int_Vbfy , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vbfy2 " , & Jit : : Comp_Generic , Dis_Vbfy , Int_Vbfy , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2012-11-01 15:19:01 +00:00
//4
2013-08-12 03:40:21 +00:00
INSTR ( " vocp " , & Jit : : Comp_Generic , Dis_Vbfy , Int_Vocp , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) , // one's complement
INSTR ( " vsocp " , & Jit : : Comp_Generic , Dis_Vbfy , Int_Vsocp , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vfad " , & Jit : : Comp_Vhoriz , Dis_Vfad , Int_Vfad , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
// TODO: Flags may not be correct (prefixes, etc.)
INSTR ( " vavg " , & Jit : : Comp_Vhoriz , Dis_Vfad , Int_Vavg , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
2012-11-01 15:19:01 +00:00
//8
2013-08-12 03:40:21 +00:00
// TODO: Flags may not be correct (prefixes, etc.)
INSTR ( " vsrt3 " , & Jit : : Comp_Generic , Dis_Vbfy , Int_Vsrt3 , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
// TODO: Flags may not be correct (prefixes, etc.)
INSTR ( " vsrt4 " , & Jit : : Comp_Generic , Dis_Vbfy , Int_Vsrt4 , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
INSTR ( " vsgn " , & Jit : : Comp_Generic , Dis_Vbfy , Int_Vsgn , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
2012-11-01 15:19:01 +00:00
//12
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
INVALID ,
INVALID ,
2012-11-01 15:19:01 +00:00
//16
2013-08-12 03:40:21 +00:00
// TODO: Flags may not be correct (prefixes, etc.)
INSTR ( " vmfvc " , & Jit : : Comp_Generic , Dis_Generic , Int_Vmfvc , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
// TODO: Flags may not be correct (prefixes, etc.)
INSTR ( " vmtvc " , & Jit : : Comp_Generic , Dis_Generic , Int_Vmtvc , IN_OTHER | OUT_OTHER | IS_VFPU ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
2012-11-01 15:19:01 +00:00
//20
2013-08-12 00:12:54 +00:00
INVALID , INVALID , INVALID , INVALID ,
2012-11-01 15:19:01 +00:00
//24
2013-08-12 00:12:54 +00:00
INVALID ,
2013-08-12 03:40:21 +00:00
INSTR ( " vt4444 " , & Jit : : Comp_Generic , Dis_Generic , Int_ColorConv , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vt5551 " , & Jit : : Comp_Generic , Dis_Generic , Int_ColorConv , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
INSTR ( " vt5650 " , & Jit : : Comp_Generic , Dis_Generic , Int_ColorConv , IN_OTHER | OUT_OTHER | IS_VFPU | OUT_EAT_PREFIX ) ,
2013-08-12 00:12:54 +00:00
2012-11-01 15:19:01 +00:00
//28
2013-08-12 00:12:54 +00:00
INVALID , INVALID , INVALID , INVALID ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-12 03:40:21 +00:00
const MIPSInstruction tableALLEGREX0 [ 32 ] = // 011111 ..... ..... ..... xxxxx 100000 - or ending with 011000?
2012-11-01 15:19:01 +00:00
{
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
2013-08-12 03:40:21 +00:00
INSTR ( " wsbh " , & Jit : : Comp_Allegrex2 , Dis_Allegrex2 , Int_Allegrex2 , IN_RT | OUT_RD ) ,
INSTR ( " wsbw " , & Jit : : Comp_Allegrex2 , Dis_Allegrex2 , Int_Allegrex2 , IN_RT | OUT_RD ) ,
2013-08-12 00:12:54 +00:00
INVALID , INVALID , INVALID , INVALID ,
2012-11-01 15:19:01 +00:00
//8
2013-08-12 01:01:55 +00:00
INVALID_X_8 ,
2012-11-01 15:19:01 +00:00
//16
INSTR ( " seb " , & Jit : : Comp_Allegrex , Dis_Allegrex , Int_Allegrex , IN_RT | OUT_RD ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
INVALID ,
2012-11-01 15:19:01 +00:00
//20
2013-08-12 03:40:21 +00:00
INSTR ( " bitrev " , & Jit : : Comp_Allegrex , Dis_Allegrex , Int_Allegrex , IN_RT | OUT_RD ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
INVALID ,
2012-11-01 15:19:01 +00:00
//24
INSTR ( " seh " , & Jit : : Comp_Allegrex , Dis_Allegrex , Int_Allegrex , IN_RT | OUT_RD ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
INVALID ,
2012-11-01 15:19:01 +00:00
//28
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
INVALID ,
INVALID ,
2012-11-01 15:19:01 +00:00
} ;
2013-01-13 16:29:38 +00:00
const MIPSInstruction tableEMU [ 4 ] =
2012-11-01 15:19:01 +00:00
{
2013-08-12 03:40:21 +00:00
INSTR ( " RUNBLOCK " , & Jit : : Comp_RunBlock , Dis_Emuhack , Int_Emuhack , 0xFFFFFFFF ) ,
INSTR ( " RetKrnl " , 0 , Dis_Emuhack , Int_Emuhack , 0 ) ,
2013-08-12 00:12:54 +00:00
INVALID ,
INVALID ,
2012-11-01 15:19:01 +00:00
} ;
const int encodingBits [ NumEncodings ] [ 2 ] =
{
2013-08-12 00:12:54 +00:00
{ 26 , 6 } , //IMME
{ 0 , 6 } , //Special
{ 0 , 6 } , //special2
2012-11-01 15:19:01 +00:00
{ 0 , 6 } , //special3
{ 16 , 5 } , //RegImm
{ 21 , 5 } , //Cop0
{ 0 , 6 } , //Cop0CO
{ 21 , 5 } , //Cop1
{ 16 , 5 } , //Cop1BC
2013-08-12 01:17:03 +00:00
{ 0 , 6 } , //Cop1S
{ 0 , 6 } , //Cop1W
2012-11-01 15:19:01 +00:00
{ 21 , 5 } , //Cop2
{ 16 , 2 } , //Cop2BC2
{ 0 , 0 } , //Cop2Rese
{ 23 , 3 } , //VFPU0
{ 23 , 3 } , //VFPU1
2012-11-15 12:18:44 +00:00
{ 23 , 3 } , //VFPU3
2012-11-01 15:19:01 +00:00
{ 21 , 5 } , //VFPU4Jump
{ 16 , 5 } , //VFPU7
{ 16 , 5 } , //VFPU4
{ 23 , 3 } , //VFPU5
{ 21 , 5 } , //VFPU6
2012-11-22 17:12:56 +00:00
{ 16 , 4 } , //VFPUMatrix1
2012-11-01 15:19:01 +00:00
{ 16 , 5 } , //VFPU9
{ 6 , 5 } , //ALLEGREX0
{ 24 , 2 } , //EMUHACK
2013-08-12 00:12:54 +00:00
} ;
2012-11-01 15:19:01 +00:00
const MIPSInstruction * mipsTables [ NumEncodings ] =
{
tableImmediate ,
tableSpecial ,
tableSpecial2 ,
tableSpecial3 ,
tableRegImm ,
tableCop0 ,
tableCop0CO ,
tableCop1 ,
tableCop1BC ,
2013-08-12 01:17:03 +00:00
tableCop1S ,
tableCop1W ,
2012-11-01 15:19:01 +00:00
tableCop2 ,
tableCop2BC2 ,
0 ,
tableVFPU0 , //vfpu0
tableVFPU1 , //vfpu1
tableVFPU3 , //vfpu3
tableVFPU4Jump ,
tableVFPU7 , //vfpu4 110100 00001
tableVFPU4 , //vfpu4 110100 00000
tableVFPU5 , //vfpu5 110111
tableVFPU6 , //vfpu6 111100
tableVFPUMatrixSet1 ,
tableVFPU9 ,
tableALLEGREX0 ,
tableEMU
} ;
//arm encoding table
//const MIPSInstruction mipsinstructions[] =
//{
//{Comp_Unimpl,Dis_Unimpl, Info_NN, 0, 0x601, 0x1FE,0}, //could be used for drec hook :) bits 5-24 plus 0-3 are available, 19 bits are more than enough
// DATA PROCESSING INSTRUCTIONS
// S
// {Comp_AND, Dis_AND, Info_DP, 0, DATAP(0, 0), 0x20F, {0}},
//};
//Todo : generate dispatcher functions from above tables
//instead of this horribly slow abomination
const MIPSInstruction * MIPSGetInstruction ( u32 op )
{
MipsEncoding encoding = Imme ;
const MIPSInstruction * instr = & tableImmediate [ op > > 26 ] ;
2013-08-12 02:10:17 +00:00
while ( instr - > altEncoding ! = - 1 )
2012-11-01 15:19:01 +00:00
{
const MIPSInstruction * table = mipsTables [ encoding ] ;
int mask = ( ( 1 < < encodingBits [ encoding ] [ 1 ] ) - 1 ) ;
int shift = encodingBits [ encoding ] [ 0 ] ;
int subop = ( op > > shift ) & mask ;
instr = & table [ subop ] ;
if ( encoding = = Rese )
return 0 ; //invalid instruction
if ( ! instr )
return 0 ;
if ( instr - > altEncoding = = - 2 )
{
2012-11-07 14:42:34 +00:00
//ERROR_LOG(CPU, "Invalid instruction %08x in table %i, entry %i", op, (int)encoding, subop);
2012-11-01 15:19:01 +00:00
return 0 ; //invalid instruction
}
encoding = ( MipsEncoding ) instr - > altEncoding ;
2013-08-12 02:10:17 +00:00
}
2012-11-01 15:19:01 +00:00
//alright, we have a valid MIPS instruction!
return instr ;
}
void MIPSCompileOp ( u32 op )
{
if ( op = = 0 )
return ;
const MIPSInstruction * instr = MIPSGetInstruction ( op ) ;
2013-08-24 20:22:10 +00:00
const MIPSInfo info = MIPSGetInfo ( op ) ;
2012-11-01 15:19:01 +00:00
if ( instr )
{
if ( instr - > compile )
( MIPSComp : : jit - > * ( instr - > compile ) ) ( op ) ; // woohoo, member functions pointers!
2013-08-12 02:10:17 +00:00
else
2012-11-01 15:19:01 +00:00
{
2013-08-12 03:40:21 +00:00
ERROR_LOG_REPORT ( CPU , " MIPSCompileOp %08x failed " , op ) ;
2012-11-01 15:19:01 +00:00
//MessageBox(0,"ARGH2",0,0);//compile an interpreter call
}
2013-02-17 23:50:31 +00:00
if ( info & OUT_EAT_PREFIX )
MIPSComp : : jit - > EatPrefix ( ) ;
2012-11-01 15:19:01 +00:00
}
else
{
2013-08-12 03:40:21 +00:00
ERROR_LOG_REPORT ( CPU , " MIPSCompileOp: Invalid instruction %08x " , op ) ;
2012-11-01 15:19:01 +00:00
}
}
2013-01-08 12:49:52 +00:00
void MIPSDisAsm ( u32 op , u32 pc , char * out , bool tabsToSpaces )
2012-11-01 15:19:01 +00:00
{
if ( op = = 0 )
{
2013-06-25 21:52:56 +00:00
sprintf ( out , " nop " ) ;
2012-11-01 15:19:01 +00:00
}
else
{
disPC = pc ;
const MIPSInstruction * instr = MIPSGetInstruction ( op ) ;
2013-01-08 12:49:52 +00:00
if ( instr & & instr - > disasm ) {
2012-11-01 15:19:01 +00:00
instr - > disasm ( op , out ) ;
2013-01-08 12:49:52 +00:00
if ( tabsToSpaces ) {
while ( * out ) {
if ( * out = = ' \t ' )
* out = ' ' ;
out + + ;
}
}
} else {
2012-11-01 15:19:01 +00:00
strcpy ( out , " no instruction :( " ) ;
//__asm int 3
MIPSGetInstruction ( op ) ;
}
}
}
void MIPSInterpret ( u32 op ) //only for those rare ones
{
//if ((op&0xFFFFF000) == 0xd0110000)
// Crash();
//if (atable[CRUNCH_MIPS_OP(op)].interpret)
// atable[CRUNCH_MIPS_OP(op)].interpret(op);
// else
// _dbg_assert_msg_(MIPS,0,"Trying to interpret instruction that can't be interpreted");
const MIPSInstruction * instr = MIPSGetInstruction ( op ) ;
if ( instr & & instr - > interpret )
instr - > interpret ( op ) ;
else
2013-08-12 00:12:54 +00:00
{
2013-08-12 01:20:43 +00:00
ERROR_LOG_REPORT ( CPU , " Unknown instruction %08x at %08x " , op , currentMIPS - > pc ) ;
2013-08-12 00:12:54 +00:00
// Try to disassemble it
char disasm [ 256 ] ;
MIPSDisAsm ( op , currentMIPS - > pc , disasm ) ;
2013-01-07 14:57:19 +00:00
_dbg_assert_msg_ ( CPU , 0 , " %s " , disasm ) ;
2013-08-12 00:12:54 +00:00
currentMIPS - > pc + = 4 ;
}
2012-11-01 15:19:01 +00:00
}
# define _RS ((op>>21) & 0x1F)
# define _RT ((op>>16) & 0x1F)
# define _RD ((op>>11) & 0x1F)
2012-11-23 11:42:35 +00:00
# define R(i) (curMips->r[i])
2012-11-01 15:19:01 +00:00
2012-11-23 11:42:35 +00:00
int MIPSInterpret_RunUntil ( u64 globalTicks )
2012-11-01 15:19:01 +00:00
{
2012-11-23 11:42:35 +00:00
MIPSState * curMips = currentMIPS ;
while ( coreState = = CORE_RUNNING )
2012-11-01 15:19:01 +00:00
{
2013-01-22 07:16:23 +00:00
CoreTiming : : Advance ( ) ;
2012-11-23 11:42:35 +00:00
// NEVER stop in a delay slot!
2013-01-11 23:44:18 +00:00
while ( curMips - > downcount > = 0 & & coreState = = CORE_RUNNING )
2012-11-01 15:19:01 +00:00
{
2012-11-23 11:42:35 +00:00
// int cycles = 0;
{
again :
2012-11-30 20:49:59 +00:00
u32 op = Memory : : Read_U32 ( curMips - > pc ) ;
2012-11-23 11:42:35 +00:00
//u32 op = Memory::Read_Opcode_JIT(mipsr4k.pc);
/*
// Choke on VFPU
2013-08-24 20:22:10 +00:00
MIPSInfo info = MIPSGetInfo ( op ) ;
2012-11-23 11:42:35 +00:00
if ( info & IS_VFPU )
{
if ( ! Core_IsStepping ( ) & & ! GetAsyncKeyState ( VK_LSHIFT ) )
{
Core_EnableStepping ( true ) ;
return ;
}
} */
//2: check for breakpoint (VERY SLOW)
# if defined(_DEBUG)
if ( CBreakPoints : : IsAddressBreakPoint ( curMips - > pc ) )
{
2013-08-24 16:49:45 +00:00
auto cond = CBreakPoints : : GetBreakPointCondition ( currentMIPS - > pc ) ;
if ( ! cond | | cond - > Evaluate ( ) )
{
Core_EnableStepping ( true ) ;
if ( CBreakPoints : : IsTempBreakPoint ( curMips - > pc ) )
CBreakPoints : : RemoveBreakPoint ( curMips - > pc ) ;
break ;
}
2012-11-23 11:42:35 +00:00
}
# endif
2012-11-01 15:19:01 +00:00
2012-11-23 11:42:35 +00:00
bool wasInDelaySlot = curMips - > inDelaySlot ;
MIPSInterpret ( op ) ;
if ( curMips - > inDelaySlot )
{
// The reason we have to check this is the delay slot hack in Int_Syscall.
if ( wasInDelaySlot )
{
curMips - > pc = curMips - > nextPC ;
curMips - > inDelaySlot = false ;
}
2013-01-11 23:44:18 +00:00
curMips - > downcount - = 1 ;
2012-11-23 11:42:35 +00:00
goto again ;
}
}
2012-11-01 15:19:01 +00:00
2013-01-21 05:48:38 +00:00
curMips - > downcount - = 1 ;
2012-11-23 11:42:35 +00:00
if ( CoreTiming : : GetTicks ( ) > globalTicks )
{
// DEBUG_LOG(CPU, "Hit the max ticks, bailing 1 : %llu, %llu", globalTicks, CoreTiming::GetTicks());
return 1 ;
}
}
}
return 1 ;
}
static inline void DelayBranchTo ( MIPSState * curMips , u32 where )
{
curMips - > pc + = 4 ;
curMips - > nextPC = where ;
curMips - > inDelaySlot = true ;
}
2012-11-01 15:19:01 +00:00
const char * MIPSGetName ( u32 op )
{
static const char * noname = " unk " ;
const MIPSInstruction * instr = MIPSGetInstruction ( op ) ;
if ( ! instr )
return noname ;
else
return instr - > name ;
}
2013-08-24 20:22:10 +00:00
MIPSInfo MIPSGetInfo ( u32 op )
2012-11-01 15:19:01 +00:00
{
// int crunch = CRUNCH_MIPS_OP(op);
const MIPSInstruction * instr = MIPSGetInstruction ( op ) ;
if ( instr )
return instr - > flags ;
else
2013-08-24 20:22:10 +00:00
return MIPSInfo ( BAD_INSTRUCTION ) ;
2012-11-01 15:19:01 +00:00
}
MIPSInterpretFunc MIPSGetInterpretFunc ( u32 op )
{
const MIPSInstruction * instr = MIPSGetInstruction ( op ) ;
if ( instr - > interpret )
return instr - > interpret ;
else
return 0 ;
}
// TODO: Do something that makes sense here.
int MIPSGetInstructionCycleEstimate ( u32 op )
{
2013-08-24 20:22:10 +00:00
MIPSInfo info = MIPSGetInfo ( op ) ;
2013-08-12 00:12:54 +00:00
if ( info & DELAYSLOT )
return 2 ;
else
return 1 ;
2012-11-01 15:19:01 +00:00
}