mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-29 09:05:41 +00:00
CPU: Fix load delay register reads for same register in delay slot
This commit is contained in:
parent
1bb794dd39
commit
d58dbe04c0
|
@ -179,13 +179,18 @@ void Core::RaiseException(Exception excode)
|
||||||
FlushPipeline();
|
FlushPipeline();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::FlushPipeline()
|
void Core::FlushLoadDelay()
|
||||||
{
|
{
|
||||||
// loads are flushed
|
|
||||||
m_load_delay_reg = Reg::count;
|
m_load_delay_reg = Reg::count;
|
||||||
m_load_delay_old_value = 0;
|
m_load_delay_old_value = 0;
|
||||||
m_next_load_delay_reg = Reg::count;
|
m_next_load_delay_reg = Reg::count;
|
||||||
m_next_load_delay_old_value = 0;
|
m_next_load_delay_old_value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::FlushPipeline()
|
||||||
|
{
|
||||||
|
// loads are flushed
|
||||||
|
FlushLoadDelay();
|
||||||
|
|
||||||
// not in a branch delay slot
|
// not in a branch delay slot
|
||||||
m_branched = false;
|
m_branched = false;
|
||||||
|
@ -214,7 +219,7 @@ void Core::WriteRegDelayed(Reg rd, u32 value)
|
||||||
|
|
||||||
// save the old value, this will be returned if the register is read in the next instruction
|
// save the old value, this will be returned if the register is read in the next instruction
|
||||||
m_next_load_delay_reg = rd;
|
m_next_load_delay_reg = rd;
|
||||||
m_next_load_delay_old_value = m_regs.r[static_cast<u8>(rd)];
|
m_next_load_delay_old_value = ReadReg(rd);
|
||||||
m_regs.r[static_cast<u8>(rd)] = value;
|
m_regs.r[static_cast<u8>(rd)] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,9 @@ private:
|
||||||
void Branch(u32 target);
|
void Branch(u32 target);
|
||||||
void RaiseException(Exception excode);
|
void RaiseException(Exception excode);
|
||||||
|
|
||||||
|
// flushes any load delays if present
|
||||||
|
void FlushLoadDelay();
|
||||||
|
|
||||||
// clears pipeline of load/branch delays
|
// clears pipeline of load/branch delays
|
||||||
void FlushPipeline();
|
void FlushPipeline();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue