CPU/Recompiler: Fix mid-block software interrupts not updating pc
Fixes Need for Speed: High Stakes hanging at boot.
This commit is contained in:
parent
223074b78f
commit
5b9db71b87
|
@ -141,8 +141,8 @@ void Execute()
|
|||
reexecute_block:
|
||||
|
||||
#if 0
|
||||
const u32 tick = g_system->GetGlobalTickCounter() + m_core->GetPendingTicks();
|
||||
if (tick == 61033207)
|
||||
const u32 tick = TimingEvents::GetGlobalTickCounter() + CPU::GetPendingTicks();
|
||||
if (tick == 4188233674)
|
||||
__debugbreak();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -987,10 +987,11 @@ void CodeGenerator::UpdateCurrentInstructionPC(bool commit)
|
|||
}
|
||||
}
|
||||
|
||||
void CodeGenerator::WriteNewPC(const Value& value)
|
||||
void CodeGenerator::WriteNewPC(const Value& value, bool commit)
|
||||
{
|
||||
// TODO: This _could_ be moved into the register cache, but would it gain anything?
|
||||
EmitStoreGuestRegister(Reg::pc, value);
|
||||
if (commit)
|
||||
m_next_pc_offset = 0;
|
||||
}
|
||||
|
||||
|
@ -1671,12 +1672,12 @@ bool CodeGenerator::Compile_Branch(const CodeBlockInstruction& cbi)
|
|||
|
||||
// converge point
|
||||
EmitBindLabel(&branch_not_taken);
|
||||
WriteNewPC(next_pc);
|
||||
WriteNewPC(next_pc, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// next_pc is not used for unconditional branches
|
||||
WriteNewPC(branch_target);
|
||||
WriteNewPC(branch_target, true);
|
||||
}
|
||||
|
||||
// now invalidate lr becuase it was possibly written in the branch
|
||||
|
@ -1917,6 +1918,7 @@ bool CodeGenerator::Compile_cop0(const CodeBlockInstruction& cbi)
|
|||
// we want to flush pc here
|
||||
m_register_cache.PushState();
|
||||
m_register_cache.FlushAllGuestRegisters(false, true);
|
||||
WriteNewPC(CalculatePC(), false);
|
||||
EmitExceptionExit();
|
||||
m_register_cache.PopState();
|
||||
|
||||
|
|
|
@ -171,10 +171,9 @@ private:
|
|||
void AddPendingCycles(bool commit);
|
||||
|
||||
Value CalculatePC(u32 offset = 0);
|
||||
void CalculatePC(Value* dest_value, u32 offset = 0);
|
||||
Value GetCurrentInstructionPC(u32 offset = 0);
|
||||
void UpdateCurrentInstructionPC(bool commit);
|
||||
void WriteNewPC(const Value& value);
|
||||
void WriteNewPC(const Value& value, bool commit);
|
||||
|
||||
Value DoGTERegisterRead(u32 index);
|
||||
void DoGTERegisterWrite(u32 index, const Value& value);
|
||||
|
|
Loading…
Reference in New Issue