Core: Add break op to recompiler

This commit is contained in:
zilmar 2022-10-10 12:07:04 +10:30
parent fc247fd953
commit 481f1c50c8
10 changed files with 39 additions and 11 deletions

View File

@ -309,6 +309,11 @@ void CAarch64RecompilerOps::SPECIAL_SYSCALL()
g_Notify->BreakPoint(__FILE__, __LINE__);
}
void CAarch64RecompilerOps::SPECIAL_BREAK()
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
void CAarch64RecompilerOps::SPECIAL_MFLO()
{
g_Notify->BreakPoint(__FILE__, __LINE__);

View File

@ -85,6 +85,7 @@ public:
void SPECIAL_JR();
void SPECIAL_JALR();
void SPECIAL_SYSCALL();
void SPECIAL_BREAK();
void SPECIAL_MFLO();
void SPECIAL_MTLO();
void SPECIAL_MFHI();

View File

@ -3170,6 +3170,11 @@ void CArmRecompilerOps::SPECIAL_SYSCALL()
m_PipelineStage = PIPELINE_STAGE_END_BLOCK;
}
void CArmRecompilerOps::SPECIAL_BREAK()
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
void CArmRecompilerOps::SPECIAL_MFLO()
{
UnMap_GPR(m_Opcode.rd, true);

View File

@ -92,6 +92,7 @@ public:
void SPECIAL_JR();
void SPECIAL_JALR();
void SPECIAL_SYSCALL();
void SPECIAL_BREAK();
void SPECIAL_MFLO();
void SPECIAL_MTLO();
void SPECIAL_MFHI();

View File

@ -396,6 +396,7 @@ bool CCodeSection::GenerateNativeCode(uint32_t Test)
case R4300i_SPECIAL_JALR: m_RecompilerOps->SPECIAL_JALR(); break;
case R4300i_SPECIAL_MFLO: m_RecompilerOps->SPECIAL_MFLO(); break;
case R4300i_SPECIAL_SYSCALL: m_RecompilerOps->SPECIAL_SYSCALL(); break;
case R4300i_SPECIAL_BREAK: m_RecompilerOps->SPECIAL_BREAK(); break;
case R4300i_SPECIAL_MTLO: m_RecompilerOps->SPECIAL_MTLO(); break;
case R4300i_SPECIAL_MFHI: m_RecompilerOps->SPECIAL_MFHI(); break;
case R4300i_SPECIAL_MTHI: m_RecompilerOps->SPECIAL_MTHI(); break;

View File

@ -12,6 +12,7 @@ enum ExitReason
ExitReason_DoCPUAction,
ExitReason_COP1Unuseable,
ExitReason_DoSysCall,
ExitReason_Break,
ExitReason_TLBReadMiss,
ExitReason_TLBWriteMiss,
ExitReason_ResetRecompCode,

View File

@ -308,6 +308,11 @@ void CX64RecompilerOps::SPECIAL_SYSCALL()
g_Notify->BreakPoint(__FILE__, __LINE__);
}
void CX64RecompilerOps::SPECIAL_BREAK()
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
void CX64RecompilerOps::SPECIAL_MFLO()
{
g_Notify->BreakPoint(__FILE__, __LINE__);

View File

@ -85,6 +85,7 @@ public:
void SPECIAL_JR();
void SPECIAL_JALR();
void SPECIAL_SYSCALL();
void SPECIAL_BREAK();
void SPECIAL_MFLO();
void SPECIAL_MTLO();
void SPECIAL_MFHI();

View File

@ -4515,6 +4515,13 @@ void CX86RecompilerOps::SPECIAL_SYSCALL()
m_PipelineStage = PIPELINE_STAGE_END_BLOCK;
}
void CX86RecompilerOps::SPECIAL_BREAK()
{
m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_System->CountPerOp());
CompileExit(m_CompilePC, m_CompilePC, m_RegWorkingSet, ExitReason_Break, true, nullptr);
m_PipelineStage = PIPELINE_STAGE_END_BLOCK;
}
void CX86RecompilerOps::SPECIAL_MFLO()
{
if (m_Opcode.rd == 0)
@ -9492,6 +9499,7 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
UpdateCounters(ExitRegSet, false, reason == ExitReason_Normal);
}
bool InDelaySlot = m_PipelineStage == PIPELINE_STAGE_JUMP || m_PipelineStage == PIPELINE_STAGE_DELAY_SLOT;
switch (reason)
{
case ExitReason_Normal:
@ -9616,22 +9624,21 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
ExitCodeBlock();
break;
case ExitReason_DoSysCall:
{
bool bDelay = m_PipelineStage == PIPELINE_STAGE_JUMP || m_PipelineStage == PIPELINE_STAGE_DELAY_SLOT;
m_Assembler.PushImm32(bDelay ? "true" : "false", bDelay);
m_Assembler.CallThis((uint32_t)g_Reg, AddressOf(&CRegisters::DoSysCallException), "CRegisters::DoSysCallException", 4);
m_Assembler.PushImm32(InDelaySlot ? "true" : "false", InDelaySlot);
m_Assembler.CallThis((uint32_t)g_Reg, AddressOf(&CRegisters::DoSysCallException), "CRegisters::DoSysCallException", 8);
ExitCodeBlock();
break;
case ExitReason_Break:
m_Assembler.PushImm32(InDelaySlot ? "true" : "false", InDelaySlot);
m_Assembler.CallThis((uint32_t)g_Reg, AddressOf(&CRegisters::DoBreakException), "CRegisters::DoBreakException", 8);
ExitCodeBlock();
break;
}
case ExitReason_COP1Unuseable:
{
bool bDelay = m_PipelineStage == PIPELINE_STAGE_JUMP || m_PipelineStage == PIPELINE_STAGE_DELAY_SLOT;
m_Assembler.PushImm32("1", 1);
m_Assembler.PushImm32(bDelay ? "true" : "false", bDelay);
m_Assembler.PushImm32(InDelaySlot ? "true" : "false", InDelaySlot);
m_Assembler.CallThis((uint32_t)g_Reg, AddressOf(&CRegisters::DoCopUnusableException), "CRegisters::DoCopUnusableException", 12);
ExitCodeBlock();
break;
}
case ExitReason_ResetRecompCode:
g_Notify->BreakPoint(__FILE__, __LINE__);
ExitCodeBlock();
@ -9639,7 +9646,7 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
case ExitReason_TLBReadMiss:
m_Assembler.MoveVariableToX86reg(g_TLBLoadAddress, "g_TLBLoadAddress", CX86Ops::x86_EDX);
m_Assembler.Push(CX86Ops::x86_EDX);
m_Assembler.PushImm32(m_PipelineStage == PIPELINE_STAGE_JUMP || m_PipelineStage == PIPELINE_STAGE_DELAY_SLOT);
m_Assembler.PushImm32(InDelaySlot ? "true" : "false", InDelaySlot);
m_Assembler.CallThis((uint32_t)g_Reg, AddressOf(&CRegisters::DoTLBReadMiss), "CRegisters::DoTLBReadMiss", 12);
ExitCodeBlock();
break;
@ -9648,7 +9655,7 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
ExitCodeBlock();
break;
case ExitReason_ExceptionOverflow:
m_Assembler.PushImm32(m_PipelineStage == PIPELINE_STAGE_JUMP || m_PipelineStage == PIPELINE_STAGE_DELAY_SLOT);
m_Assembler.PushImm32(InDelaySlot ? "true" : "false", InDelaySlot);
m_Assembler.CallThis((uint32_t)g_Reg, AddressOf(&CRegisters::DoOverflowException), "CRegisters::DoOverflowException", 12);
ExitCodeBlock();
break;

View File

@ -92,6 +92,7 @@ public:
void SPECIAL_JR();
void SPECIAL_JALR();
void SPECIAL_SYSCALL();
void SPECIAL_BREAK();
void SPECIAL_MFLO();
void SPECIAL_MTLO();
void SPECIAL_MFHI();