Core: Update how exceptions are handled with the recompiler
This commit is contained in:
parent
18a712ce6a
commit
187bd64915
|
@ -14,18 +14,6 @@
|
|||
#include <float.h>
|
||||
#include <math.h>
|
||||
|
||||
#if (defined(_MSC_VER) && (_MSC_VER < 1800))
|
||||
double trunc(double num)
|
||||
{
|
||||
return (num < 0) ? ceil(num) : floor(num);
|
||||
}
|
||||
|
||||
float truncf(float num)
|
||||
{
|
||||
return (num < 0) ? ceilf(num) : floorf(num);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool R4300iOp::m_TestTimer = false;
|
||||
R4300iOpcode R4300iOp::m_Opcode;
|
||||
|
||||
|
|
|
@ -709,7 +709,6 @@ void CRegisters::TriggerException(uint32_t ExceptionCode, uint32_t Coprocessor)
|
|||
CAUSE_REGISTER.BranchDelay = m_System->m_PipelineStage == PIPELINE_STAGE_JUMP;
|
||||
EPC_REGISTER = (int64_t)((int32_t)m_PROGRAM_COUNTER - (CAUSE_REGISTER.BranchDelay ? 4 : 0));
|
||||
STATUS_REGISTER |= STATUS_EXL;
|
||||
m_PROGRAM_COUNTER = 0x80000180;
|
||||
m_System->m_PipelineStage = PIPELINE_STAGE_JUMP;
|
||||
m_System->m_JumpToLocation = (*_PROGRAM_COUNTER);
|
||||
m_System->m_JumpToLocation = 0x80000180;
|
||||
}
|
||||
|
|
|
@ -114,7 +114,11 @@ void CSystemEvents::ExecuteEvents()
|
|||
m_System->Reset(true, true);
|
||||
break;
|
||||
case SysEvent_ExecuteInterrupt:
|
||||
g_Reg->DoIntrException();
|
||||
if (g_Reg->DoIntrException())
|
||||
{
|
||||
g_Reg->m_PROGRAM_COUNTER = m_System->JumpToLocation();
|
||||
m_System->m_PipelineStage = PIPELINE_STAGE_NORMAL;
|
||||
}
|
||||
break;
|
||||
case SysEvent_Interrupt_SP:
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_SP;
|
||||
|
|
|
@ -146,6 +146,7 @@ private:
|
|||
friend class CInterpreterCPU;
|
||||
friend class R4300iOp32;
|
||||
friend class R4300iOp;
|
||||
friend class CSystemEvents;
|
||||
|
||||
friend class VideoInterfaceHandler;
|
||||
friend class PifRamHandler;
|
||||
|
|
|
@ -9476,6 +9476,9 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
|
|||
m_Assembler.push(0);
|
||||
m_Assembler.PushImm32("EXC_SYSCALL", EXC_SYSCALL);
|
||||
m_Assembler.CallThis((uint32_t)g_Reg, AddressOf(&CRegisters::TriggerException), "CRegisters::TriggerException", 12);
|
||||
m_Assembler.MoveVariableToX86reg(asmjit::x86::edx, &g_System->m_JumpToLocation, "System->m_JumpToLocation");
|
||||
m_Assembler.MoveX86regToVariable(&g_Reg->m_PROGRAM_COUNTER, "PROGRAM_COUNTER", asmjit::x86::edx);
|
||||
m_Assembler.MoveConstToVariable(&g_System->m_PipelineStage, "g_System->m_PipelineStage", PIPELINE_STAGE_NORMAL);
|
||||
ExitCodeBlock();
|
||||
break;
|
||||
case ExitReason_Break:
|
||||
|
@ -9483,6 +9486,9 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
|
|||
m_Assembler.push(0);
|
||||
m_Assembler.PushImm32("EXC_BREAK", EXC_BREAK);
|
||||
m_Assembler.CallThis((uint32_t)g_Reg, AddressOf(&CRegisters::TriggerException), "CRegisters::TriggerException", 12);
|
||||
m_Assembler.MoveVariableToX86reg(asmjit::x86::edx, &g_System->m_JumpToLocation, "System->m_JumpToLocation");
|
||||
m_Assembler.MoveX86regToVariable(&g_Reg->m_PROGRAM_COUNTER, "PROGRAM_COUNTER", asmjit::x86::edx);
|
||||
m_Assembler.MoveConstToVariable(&g_System->m_PipelineStage, "g_System->m_PipelineStage", PIPELINE_STAGE_NORMAL);
|
||||
ExitCodeBlock();
|
||||
break;
|
||||
case ExitReason_COP1Unuseable:
|
||||
|
@ -9490,6 +9496,9 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
|
|||
m_Assembler.push(1);
|
||||
m_Assembler.PushImm32("EXC_CPU", EXC_CPU);
|
||||
m_Assembler.CallThis((uint32_t)g_Reg, AddressOf(&CRegisters::TriggerException), "CRegisters::TriggerException", 12);
|
||||
m_Assembler.MoveVariableToX86reg(asmjit::x86::edx, &g_System->m_JumpToLocation, "System->m_JumpToLocation");
|
||||
m_Assembler.MoveX86regToVariable(&g_Reg->m_PROGRAM_COUNTER, "PROGRAM_COUNTER", asmjit::x86::edx);
|
||||
m_Assembler.MoveConstToVariable(&g_System->m_PipelineStage, "g_System->m_PipelineStage", PIPELINE_STAGE_NORMAL);
|
||||
ExitCodeBlock();
|
||||
break;
|
||||
case ExitReason_ResetRecompCode:
|
||||
|
@ -9512,6 +9521,9 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
|
|||
m_Assembler.push(0);
|
||||
m_Assembler.PushImm32("EXC_OV", EXC_OV);
|
||||
m_Assembler.CallThis((uint32_t)g_Reg, AddressOf(&CRegisters::TriggerException), "CRegisters::TriggerException", 12);
|
||||
m_Assembler.MoveVariableToX86reg(asmjit::x86::edx, &g_System->m_JumpToLocation, "System->m_JumpToLocation");
|
||||
m_Assembler.MoveX86regToVariable(&g_Reg->m_PROGRAM_COUNTER, "PROGRAM_COUNTER", asmjit::x86::edx);
|
||||
m_Assembler.MoveConstToVariable(&g_System->m_PipelineStage, "g_System->m_PipelineStage", PIPELINE_STAGE_NORMAL);
|
||||
ExitCodeBlock();
|
||||
break;
|
||||
case ExitReason_AddressErrorExceptionRead32:
|
||||
|
@ -9540,6 +9552,9 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
|
|||
m_Assembler.push(0);
|
||||
m_Assembler.PushImm32("EXC_II", EXC_II);
|
||||
m_Assembler.CallThis((uint32_t)g_Reg, AddressOf(&CRegisters::TriggerException), "CRegisters::TriggerException", 12);
|
||||
m_Assembler.MoveVariableToX86reg(asmjit::x86::edx, &g_System->m_JumpToLocation, "System->m_JumpToLocation");
|
||||
m_Assembler.MoveX86regToVariable(&g_Reg->m_PROGRAM_COUNTER, "PROGRAM_COUNTER", asmjit::x86::edx);
|
||||
m_Assembler.MoveConstToVariable(&g_System->m_PipelineStage, "g_System->m_PipelineStage", PIPELINE_STAGE_NORMAL);
|
||||
ExitCodeBlock();
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue