Skip to content

Commit

Permalink
Core: Add exit reason exception
Browse files Browse the repository at this point in the history
  • Loading branch information
project64 committed Aug 30, 2023
1 parent 703ad40 commit e49438c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions Source/Project64-core/N64System/Recompiler/ExitInfo.h
Expand Up @@ -21,6 +21,7 @@ enum ExitReason
ExitReason_AddressErrorExceptionRead32,
ExitReason_AddressErrorExceptionRead64,
ExitReason_IllegalInstruction,
ExitReason_Exception,
};

struct CExitInfo
Expand Down
Expand Up @@ -9559,6 +9559,17 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
m_Assembler.MoveConstToVariable(&g_System->m_PipelineStage, "g_System->m_PipelineStage", PIPELINE_STAGE_NORMAL);
ExitCodeBlock();
break;
case ExitReason_Exception:
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);
if (TargetPC == (uint32_t)-1)
{
ExitRegSet.SetBlockCycleCount(0);
UpdateCounters(ExitRegSet, true, false, false);
}
ExitCodeBlock();
break;
default:
WriteTrace(TraceRecompiler, TraceError, "How did you want to exit on reason (%d) ???", reason);
g_Notify->BreakPoint(__FILE__, __LINE__);
Expand Down

0 comments on commit e49438c

Please sign in to comment.