CPU: HLE implementation of PCDrv (host file access)

This commit is contained in:
Stenzek
2023-04-29 20:45:39 +10:00
parent 5439718ec3
commit 84e5fbe0c6
13 changed files with 430 additions and 5 deletions

View File

@ -11,6 +11,7 @@
#include "cpu_recompiler_thunks.h"
#include "gte.h"
#include "host.h"
#include "pcdrv.h"
#include "pgxp.h"
#include "settings.h"
#include "system.h"
@ -293,6 +294,20 @@ void RaiseException(Exception excode)
g_state.current_instruction_pc, GetExceptionVector());
}
void RaiseBreakException(u32 CAUSE_bits, u32 EPC, u32 instruction_bits)
{
if (PCDrv::HandleSyscall(instruction_bits, g_state.regs))
{
// immediately return
g_state.regs.npc = EPC + 4;
FlushPipeline();
return;
}
// normal exception
RaiseException(CAUSE_bits, EPC, GetExceptionVector());
}
void SetExternalInterrupt(u8 bit)
{
g_state.cop0_regs.cause.Ip |= static_cast<u8>(1u << bit);
@ -1109,7 +1124,10 @@ restart_instruction:
case InstructionFunct::break_:
{
RaiseException(Exception::BP);
RaiseBreakException(Cop0Registers::CAUSE::MakeValueForException(
Exception::BP, g_state.current_instruction_in_branch_delay_slot,
g_state.current_instruction_was_branch_taken, g_state.current_instruction.cop.cop_n),
g_state.current_instruction_pc, g_state.current_instruction.bits);
}
break;