Refactor Cop0

This commit is contained in:
SimoneN64
2024-05-12 22:43:08 +02:00
committed by Simone
parent da8760c6df
commit f8e45819c8
13 changed files with 219 additions and 225 deletions

View File

@@ -28,22 +28,22 @@ int Interpreter::Step() {
regs.delaySlot = false;
if(check_address_error(0b11, u64(regs.pc))) [[unlikely]] {
HandleTLBException(regs, regs.pc);
FireException(regs, ExceptionCode::AddressErrorLoad, 0, regs.pc);
regs.cop0.HandleTLBException(regs.pc);
regs.cop0.FireException(ExceptionCode::AddressErrorLoad, 0, regs.pc);
return 1;
}
u32 paddr = 0;
if(!MapVAddr(regs, LOAD, regs.pc, paddr)) {
HandleTLBException(regs, regs.pc);
FireException(regs, GetTLBExceptionCode(regs.cop0.tlbError, LOAD), 0, regs.pc);
if(!regs.cop0.MapVAddr(Cop0::LOAD, regs.pc, paddr)) {
regs.cop0.HandleTLBException(regs.pc);
regs.cop0.FireException(regs.cop0.GetTLBExceptionCode(regs.cop0.tlbError, Cop0::LOAD), 0, regs.pc);
return 1;
}
u32 instruction = mem.Read<u32>(regs, paddr);
if(ShouldServiceInterrupt()) {
FireException(regs, ExceptionCode::Interrupt, 0, regs.pc);
regs.cop0.FireException(ExceptionCode::Interrupt, 0, regs.pc);
return 1;
}