This commit is contained in:
Jean-Philip Desjardins 2014-09-28 02:37:55 -04:00
parent d9cfed52ae
commit a7759ac711
3 changed files with 149 additions and 152 deletions

View File

@ -6,7 +6,7 @@
#include "offsetof_def.h"
#include "MemoryUtils.h"
uint32 CCOP_FPU::m_nCCMask[8] =
const uint32 CCOP_FPU::m_ccMask[8] =
{
0x00800000,
0x02000000,
@ -18,28 +18,25 @@ uint32 CCOP_FPU::m_nCCMask[8] =
0x80000000
};
CCOP_FPU::CCOP_FPU(MIPS_REGSIZE nRegSize) :
CMIPSCoprocessor(nRegSize),
m_nFT(0),
m_nFS(0),
m_nFD(0)
CCOP_FPU::CCOP_FPU(MIPS_REGSIZE regSize)
: CMIPSCoprocessor(regSize)
{
SetupReflectionTables();
}
void CCOP_FPU::CompileInstruction(uint32 nAddress, CMipsJitter* codeGen, CMIPS* pCtx)
void CCOP_FPU::CompileInstruction(uint32 address, CMipsJitter* codeGen, CMIPS* ctx)
{
SetupQuickVariables(nAddress, codeGen, pCtx);
SetupQuickVariables(address, codeGen, ctx);
m_nFT = (uint8)((m_nOpcode >> 16) & 0x1F);
m_nFS = (uint8)((m_nOpcode >> 11) & 0x1F);
m_nFD = (uint8)((m_nOpcode >> 6) & 0x1F);
m_ft = static_cast<uint8>((m_nOpcode >> 16) & 0x1F);
m_fs = static_cast<uint8>((m_nOpcode >> 11) & 0x1F);
m_fd = static_cast<uint8>((m_nOpcode >> 6) & 0x1F);
switch((m_nOpcode >> 26) & 0x3F)
{
case 0x11:
//COP1
((this)->*(m_pOpGeneral[(m_nOpcode >> 21) & 0x1F]))();
((this)->*(m_opGeneral[(m_nOpcode >> 21) & 0x1F]))();
break;
case 0x31:
LWC1();
@ -53,31 +50,31 @@ void CCOP_FPU::CompileInstruction(uint32 nAddress, CMipsJitter* codeGen, CMIPS*
}
}
void CCOP_FPU::SetCCBit(bool nCondition, uint32 nMask)
void CCOP_FPU::SetCCBit(bool condition, uint32 mask)
{
m_codeGen->PushCst(0);
m_codeGen->BeginIf(nCondition ? Jitter::CONDITION_NE : Jitter::CONDITION_EQ);
m_codeGen->BeginIf(condition ? Jitter::CONDITION_NE : Jitter::CONDITION_EQ);
{
m_codeGen->PushRel(offsetof(CMIPS, m_State.nFCSR));
m_codeGen->PushCst(nMask);
m_codeGen->PushCst(mask);
m_codeGen->Or();
m_codeGen->PullRel(offsetof(CMIPS, m_State.nFCSR));
}
m_codeGen->Else();
{
m_codeGen->PushRel(offsetof(CMIPS, m_State.nFCSR));
m_codeGen->PushCst(~nMask);
m_codeGen->PushCst(~mask);
m_codeGen->And();
m_codeGen->PullRel(offsetof(CMIPS, m_State.nFCSR));
}
m_codeGen->EndIf();
}
void CCOP_FPU::PushCCBit(uint32 nMask)
void CCOP_FPU::PushCCBit(uint32 mask)
{
m_codeGen->PushRel(offsetof(CMIPS, m_State.nFCSR));
m_codeGen->PushCst(nMask);
m_codeGen->PushCst(mask);
m_codeGen->And();
}
@ -88,25 +85,25 @@ void CCOP_FPU::PushCCBit(uint32 nMask)
//00
void CCOP_FPU::MFC1()
{
m_codeGen->PushRel(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->PushRel(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
if(m_regSize == MIPS_REGSIZE_64)
{
m_codeGen->PushTop();
m_codeGen->SignExt();
m_codeGen->PullRel(offsetof(CMIPS, m_State.nGPR[m_nFT].nV[1]));
m_codeGen->PullRel(offsetof(CMIPS, m_State.nGPR[m_ft].nV[1]));
}
m_codeGen->PullRel(offsetof(CMIPS, m_State.nGPR[m_nFT].nV[0]));
m_codeGen->PullRel(offsetof(CMIPS, m_State.nGPR[m_ft].nV[0]));
}
//02
void CCOP_FPU::CFC1()
{
if(m_nFS == 31)
if(m_fs == 31)
{
m_codeGen->PushRel(offsetof(CMIPS, m_State.nFCSR));
m_codeGen->SignExt();
m_codeGen->PullRel(offsetof(CMIPS, m_State.nGPR[m_nFT].nV[1]));
m_codeGen->PullRel(offsetof(CMIPS, m_State.nGPR[m_nFT].nV[0]));
m_codeGen->PullRel(offsetof(CMIPS, m_State.nGPR[m_ft].nV[1]));
m_codeGen->PullRel(offsetof(CMIPS, m_State.nGPR[m_ft].nV[0]));
}
else
{
@ -117,16 +114,16 @@ void CCOP_FPU::CFC1()
//04
void CCOP_FPU::MTC1()
{
m_codeGen->PushRel(offsetof(CMIPS, m_State.nGPR[m_nFT].nV[0]));
m_codeGen->PullRel(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->PushRel(offsetof(CMIPS, m_State.nGPR[m_ft].nV[0]));
m_codeGen->PullRel(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
}
//06
void CCOP_FPU::CTC1()
{
if(m_nFS == 31)
if(m_fs == 31)
{
m_codeGen->PushRel(offsetof(CMIPS, m_State.nGPR[m_nFT].nV[0]));
m_codeGen->PushRel(offsetof(CMIPS, m_State.nGPR[m_ft].nV[0]));
m_codeGen->PullRel(offsetof(CMIPS, m_State.nFCSR));
}
else
@ -161,13 +158,13 @@ void CCOP_FPU::BC1()
//10
void CCOP_FPU::S()
{
((this)->*(m_pOpSingle[(m_nOpcode & 0x3F)]))();
((this)->*(m_opSingle[(m_nOpcode & 0x3F)]))();
}
//14
void CCOP_FPU::W()
{
((this)->*(m_pOpWord[(m_nOpcode & 0x3F)]))();
((this)->*(m_opWord[(m_nOpcode & 0x3F)]))();
}
//////////////////////////////////////////////////
@ -177,7 +174,7 @@ void CCOP_FPU::W()
//00
void CCOP_FPU::BC1F()
{
PushCCBit(m_nCCMask[(m_nOpcode >> 18) & 0x07]);
PushCCBit(m_ccMask[(m_nOpcode >> 18) & 0x07]);
m_codeGen->PushCst(0);
Branch(Jitter::CONDITION_EQ);
}
@ -185,7 +182,7 @@ void CCOP_FPU::BC1F()
//01
void CCOP_FPU::BC1T()
{
PushCCBit(m_nCCMask[(m_nOpcode >> 18) & 0x07]);
PushCCBit(m_ccMask[(m_nOpcode >> 18) & 0x07]);
m_codeGen->PushCst(0);
Branch(Jitter::CONDITION_NE);
}
@ -193,7 +190,7 @@ void CCOP_FPU::BC1T()
//02
void CCOP_FPU::BC1FL()
{
PushCCBit(m_nCCMask[(m_nOpcode >> 18) & 0x07]);
PushCCBit(m_ccMask[(m_nOpcode >> 18) & 0x07]);
m_codeGen->PushCst(0);
BranchLikely(Jitter::CONDITION_EQ);
}
@ -201,7 +198,7 @@ void CCOP_FPU::BC1FL()
//03
void CCOP_FPU::BC1TL()
{
PushCCBit(m_nCCMask[(m_nOpcode >> 18) & 0x07]);
PushCCBit(m_ccMask[(m_nOpcode >> 18) & 0x07]);
m_codeGen->PushCst(0);
BranchLikely(Jitter::CONDITION_NE);
}
@ -213,48 +210,48 @@ void CCOP_FPU::BC1TL()
//00
void CCOP_FPU::ADD_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Add();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
//01
void CCOP_FPU::SUB_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Sub();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
//02
void CCOP_FPU::MUL_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Mul();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
//03
void CCOP_FPU::DIV_S()
{
//Check if FT equals to 0
m_codeGen->PushRel(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->PushRel(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->PushCst(0);
m_codeGen->BeginIf(Jitter::CONDITION_EQ);
{
m_codeGen->PushCst(0x7F7FFFFF);
m_codeGen->PullRel(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->PullRel(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
m_codeGen->Else();
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Div();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
m_codeGen->EndIf();
}
@ -262,56 +259,56 @@ void CCOP_FPU::DIV_S()
//04
void CCOP_FPU::SQRT_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Sqrt();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
//05
void CCOP_FPU::ABS_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_Abs();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
//06
void CCOP_FPU::MOV_S()
{
m_codeGen->PushRel(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->PullRel(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->PushRel(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->PullRel(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
//07
void CCOP_FPU::NEG_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_Neg();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
//0D
void CCOP_FPU::TRUNC_W_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PullWordTruncate(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PullWordTruncate(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
//16
void CCOP_FPU::RSQRT_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Rsqrt();
m_codeGen->FP_Mul();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
//18
void CCOP_FPU::ADDA_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Add();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP1A));
}
@ -319,8 +316,8 @@ void CCOP_FPU::ADDA_S()
//19
void CCOP_FPU::SUBA_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Sub();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP1A));
}
@ -328,8 +325,8 @@ void CCOP_FPU::SUBA_S()
//1A
void CCOP_FPU::MULA_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Mul();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP1A));
}
@ -338,30 +335,30 @@ void CCOP_FPU::MULA_S()
void CCOP_FPU::MADD_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP1A));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Mul();
m_codeGen->FP_Add();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
//1D
void CCOP_FPU::MSUB_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP1A));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Mul();
m_codeGen->FP_Sub();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
//1E
void CCOP_FPU::MADDA_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP1A));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Mul();
m_codeGen->FP_Add();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP1A));
@ -371,8 +368,8 @@ void CCOP_FPU::MADDA_S()
void CCOP_FPU::MSUBA_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP1A));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Mul();
m_codeGen->FP_Sub();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP1A));
@ -383,59 +380,59 @@ void CCOP_FPU::CVT_W_S()
{
//Load the rounding mode from FCSR?
//PS2 only supports truncate rounding mode
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PullWordTruncate(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PullWordTruncate(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
//28
void CCOP_FPU::MAX_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Max();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
//29
void CCOP_FPU::MIN_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Min();
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
//32
void CCOP_FPU::C_EQ_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Cmp(Jitter::CONDITION_EQ);
SetCCBit(true, m_nCCMask[((m_nOpcode >> 8) & 0x07)]);
SetCCBit(true, m_ccMask[((m_nOpcode >> 8) & 0x07)]);
}
//34
void CCOP_FPU::C_LT_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Cmp(Jitter::CONDITION_BL);
SetCCBit(true, m_nCCMask[((m_nOpcode >> 8) & 0x07)]);
SetCCBit(true, m_ccMask[((m_nOpcode >> 8) & 0x07)]);
}
//36
void CCOP_FPU::C_LE_S()
{
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PushSingle(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->FP_Cmp(Jitter::CONDITION_BE);
SetCCBit(true, m_nCCMask[((m_nOpcode >> 8) & 0x07)]);
SetCCBit(true, m_ccMask[((m_nOpcode >> 8) & 0x07)]);
}
//////////////////////////////////////////////////
@ -445,8 +442,8 @@ void CCOP_FPU::C_LE_S()
//20
void CCOP_FPU::CVT_S_W()
{
m_codeGen->FP_PushWord(offsetof(CMIPS, m_State.nCOP10[m_nFS * 2]));
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_nFD * 2]));
m_codeGen->FP_PushWord(offsetof(CMIPS, m_State.nCOP10[m_fs * 2]));
m_codeGen->FP_PullSingle(offsetof(CMIPS, m_State.nCOP10[m_fd * 2]));
}
//////////////////////////////////////////////////
@ -462,7 +459,7 @@ void CCOP_FPU::LWC1()
m_codeGen->PushIdx(1);
m_codeGen->Call(reinterpret_cast<void*>(&MemoryUtils_GetWordProxy), 2, true);
m_codeGen->PullRel(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->PullRel(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->PullTop();
}
@ -473,7 +470,7 @@ void CCOP_FPU::SWC1()
ComputeMemAccessAddr();
m_codeGen->PushCtx();
m_codeGen->PushRel(offsetof(CMIPS, m_State.nCOP10[m_nFT * 2]));
m_codeGen->PushRel(offsetof(CMIPS, m_State.nCOP10[m_ft * 2]));
m_codeGen->PushIdx(2);
m_codeGen->Call(reinterpret_cast<void*>(&MemoryUtils_SetWordProxy), 3, false);
@ -484,7 +481,7 @@ void CCOP_FPU::SWC1()
//Opcode Tables
//////////////////////////////////////////////////
CCOP_FPU::InstructionFuncConstant CCOP_FPU::m_pOpGeneral[0x20] =
CCOP_FPU::InstructionFuncConstant CCOP_FPU::m_opGeneral[0x20] =
{
//0x00
&CCOP_FPU::MFC1, &CCOP_FPU::Illegal, &CCOP_FPU::CFC1, &CCOP_FPU::Illegal, &CCOP_FPU::MTC1, &CCOP_FPU::Illegal, &CCOP_FPU::CTC1, &CCOP_FPU::Illegal,
@ -496,7 +493,7 @@ CCOP_FPU::InstructionFuncConstant CCOP_FPU::m_pOpGeneral[0x20] =
&CCOP_FPU::Illegal, &CCOP_FPU::Illegal, &CCOP_FPU::Illegal, &CCOP_FPU::Illegal, &CCOP_FPU::Illegal, &CCOP_FPU::Illegal, &CCOP_FPU::Illegal, &CCOP_FPU::Illegal,
};
CCOP_FPU::InstructionFuncConstant CCOP_FPU::m_pOpSingle[0x40] =
CCOP_FPU::InstructionFuncConstant CCOP_FPU::m_opSingle[0x40] =
{
//0x00
&CCOP_FPU::ADD_S, &CCOP_FPU::SUB_S, &CCOP_FPU::MUL_S, &CCOP_FPU::DIV_S, &CCOP_FPU::SQRT_S, &CCOP_FPU::ABS_S, &CCOP_FPU::MOV_S, &CCOP_FPU::NEG_S,
@ -516,7 +513,7 @@ CCOP_FPU::InstructionFuncConstant CCOP_FPU::m_pOpSingle[0x40] =
&CCOP_FPU::Illegal, &CCOP_FPU::Illegal, &CCOP_FPU::Illegal, &CCOP_FPU::Illegal, &CCOP_FPU::C_LT_S, &CCOP_FPU::Illegal, &CCOP_FPU::Illegal, &CCOP_FPU::Illegal,
};
CCOP_FPU::InstructionFuncConstant CCOP_FPU::m_pOpWord[0x40] =
CCOP_FPU::InstructionFuncConstant CCOP_FPU::m_opWord[0x40] =
{
//0x00
&CCOP_FPU::Illegal, &CCOP_FPU::Illegal, &CCOP_FPU::Illegal, &CCOP_FPU::Illegal, &CCOP_FPU::Illegal, &CCOP_FPU::Illegal, &CCOP_FPU::Illegal, &CCOP_FPU::Illegal,

View File

@ -28,33 +28,33 @@ protected:
static uint32 ReflEaOffset(MIPSReflection::INSTRUCTION*, CMIPS*, uint32, uint32);
MIPSReflection::INSTRUCTION m_ReflGeneral[64];
MIPSReflection::INSTRUCTION m_ReflCop1[32];
MIPSReflection::INSTRUCTION m_ReflBc1[4];
MIPSReflection::INSTRUCTION m_ReflS[64];
MIPSReflection::INSTRUCTION m_ReflW[64];
MIPSReflection::INSTRUCTION m_reflGeneral[64];
MIPSReflection::INSTRUCTION m_reflCop1[32];
MIPSReflection::INSTRUCTION m_reflBc1[4];
MIPSReflection::INSTRUCTION m_reflS[64];
MIPSReflection::INSTRUCTION m_reflW[64];
MIPSReflection::SUBTABLE m_ReflGeneralTable;
MIPSReflection::SUBTABLE m_ReflCop1Table;
MIPSReflection::SUBTABLE m_ReflBc1Table;
MIPSReflection::SUBTABLE m_ReflSTable;
MIPSReflection::SUBTABLE m_ReflWTable;
MIPSReflection::SUBTABLE m_reflGeneralTable;
MIPSReflection::SUBTABLE m_reflCop1Table;
MIPSReflection::SUBTABLE m_reflBc1Table;
MIPSReflection::SUBTABLE m_reflSTable;
MIPSReflection::SUBTABLE m_reflWTable;
private:
typedef void (CCOP_FPU::*InstructionFuncConstant)();
uint8 m_nFT;
uint8 m_nFS;
uint8 m_nFD;
uint8 m_ft = 0;
uint8 m_fs = 0;
uint8 m_fd = 0;
static uint32 m_nCCMask[8];
static const uint32 m_ccMask[8];
void SetCCBit(bool, uint32);
void PushCCBit(uint32);
static InstructionFuncConstant m_pOpGeneral[0x20];
static InstructionFuncConstant m_pOpSingle[0x40];
static InstructionFuncConstant m_pOpWord[0x40];
static InstructionFuncConstant m_opGeneral[0x20];
static InstructionFuncConstant m_opSingle[0x40];
static InstructionFuncConstant m_opWord[0x40];
//General
void MFC1();

View File

@ -365,43 +365,43 @@ INSTRUCTION CCOP_FPU::m_cReflW[64] =
void CCOP_FPU::SetupReflectionTables()
{
static_assert(sizeof(m_ReflGeneral) == sizeof(m_cReflGeneral), "Array sizes don't match");
static_assert(sizeof(m_ReflCop1) == sizeof(m_cReflCop1), "Array sizes don't match");
static_assert(sizeof(m_ReflBc1) == sizeof(m_cReflBc1), "Array sizes don't match");
static_assert(sizeof(m_ReflS) == sizeof(m_cReflS), "Array sizes don't match");
static_assert(sizeof(m_ReflW) == sizeof(m_cReflW), "Array sizes don't match");
static_assert(sizeof(m_reflGeneral) == sizeof(m_cReflGeneral), "Array sizes don't match");
static_assert(sizeof(m_reflCop1) == sizeof(m_cReflCop1), "Array sizes don't match");
static_assert(sizeof(m_reflBc1) == sizeof(m_cReflBc1), "Array sizes don't match");
static_assert(sizeof(m_reflS) == sizeof(m_cReflS), "Array sizes don't match");
static_assert(sizeof(m_reflW) == sizeof(m_cReflW), "Array sizes don't match");
memcpy(m_ReflGeneral, m_cReflGeneral, sizeof(m_cReflGeneral));
memcpy(m_ReflCop1, m_cReflCop1, sizeof(m_cReflCop1));
memcpy(m_ReflBc1, m_cReflBc1, sizeof(m_cReflBc1));
memcpy(m_ReflS, m_cReflS, sizeof(m_cReflS));
memcpy(m_ReflW, m_cReflW, sizeof(m_cReflW));
memcpy(m_reflGeneral, m_cReflGeneral, sizeof(m_cReflGeneral));
memcpy(m_reflCop1, m_cReflCop1, sizeof(m_cReflCop1));
memcpy(m_reflBc1, m_cReflBc1, sizeof(m_cReflBc1));
memcpy(m_reflS, m_cReflS, sizeof(m_cReflS));
memcpy(m_reflW, m_cReflW, sizeof(m_cReflW));
m_ReflGeneralTable.nShift = 26;
m_ReflGeneralTable.nMask = 0x3F;
m_ReflGeneralTable.pTable = m_ReflGeneral;
m_reflGeneralTable.nShift = 26;
m_reflGeneralTable.nMask = 0x3F;
m_reflGeneralTable.pTable = m_reflGeneral;
m_ReflCop1Table.nShift = 21;
m_ReflCop1Table.nMask = 0x1F;
m_ReflCop1Table.pTable = m_ReflCop1;
m_reflCop1Table.nShift = 21;
m_reflCop1Table.nMask = 0x1F;
m_reflCop1Table.pTable = m_reflCop1;
m_ReflBc1Table.nShift = 16;
m_ReflBc1Table.nMask = 0x03;
m_ReflBc1Table.pTable = m_ReflBc1;
m_reflBc1Table.nShift = 16;
m_reflBc1Table.nMask = 0x03;
m_reflBc1Table.pTable = m_reflBc1;
m_ReflSTable.nShift = 0;
m_ReflSTable.nMask = 0x3F;
m_ReflSTable.pTable = m_ReflS;
m_reflSTable.nShift = 0;
m_reflSTable.nMask = 0x3F;
m_reflSTable.pTable = m_reflS;
m_ReflWTable.nShift = 0;
m_ReflWTable.nMask = 0x3F;
m_ReflWTable.pTable = m_ReflW;
m_reflWTable.nShift = 0;
m_reflWTable.nMask = 0x3F;
m_reflWTable.pTable = m_reflW;
m_ReflGeneral[0x11].pSubTable = &m_ReflCop1Table;
m_reflGeneral[0x11].pSubTable = &m_reflCop1Table;
m_ReflCop1[0x08].pSubTable = &m_ReflBc1Table;
m_ReflCop1[0x10].pSubTable = &m_ReflSTable;
m_ReflCop1[0x14].pSubTable = &m_ReflWTable;
m_reflCop1[0x08].pSubTable = &m_reflBc1Table;
m_reflCop1[0x10].pSubTable = &m_reflSTable;
m_reflCop1[0x14].pSubTable = &m_reflWTable;
}
void CCOP_FPU::GetInstruction(uint32 nOpcode, char* sText)
@ -415,7 +415,7 @@ void CCOP_FPU::GetInstruction(uint32 nOpcode, char* sText)
INSTRUCTION Instr;
Instr.pGetMnemonic = SubTableMnemonic;
Instr.pSubTable = &m_ReflGeneralTable;
Instr.pSubTable = &m_reflGeneralTable;
Instr.pGetMnemonic(&Instr, NULL, nOpcode, sText, nCount);
}
@ -430,8 +430,8 @@ void CCOP_FPU::GetArguments(uint32 nAddress, uint32 nOpcode, char* sText)
INSTRUCTION Instr;
Instr.pGetOperands = SubTableOperands;
Instr.pSubTable = &m_ReflGeneralTable;
Instr.pGetOperands(&Instr, NULL, nAddress, nOpcode, sText, nCount);
Instr.pSubTable = &m_reflGeneralTable;
Instr.pGetOperands(&Instr, NULL, nAddress, nOpcode, sText, nCount);
}
MIPS_BRANCH_TYPE CCOP_FPU::IsBranch(uint32 nOpcode)
@ -440,7 +440,7 @@ MIPS_BRANCH_TYPE CCOP_FPU::IsBranch(uint32 nOpcode)
INSTRUCTION Instr;
Instr.pIsBranch = SubTableIsBranch;
Instr.pSubTable = &m_ReflGeneralTable;
Instr.pSubTable = &m_reflGeneralTable;
return Instr.pIsBranch(&Instr, NULL, nOpcode);
}
@ -450,6 +450,6 @@ uint32 CCOP_FPU::GetEffectiveAddress(uint32 nAddress, uint32 nOpcode)
INSTRUCTION Instr;
Instr.pGetEffectiveAddress = SubTableEffAddr;
Instr.pSubTable = &m_ReflGeneralTable;
Instr.pSubTable = &m_reflGeneralTable;
return Instr.pGetEffectiveAddress(&Instr, NULL, nAddress, nOpcode);
}