mirror of
https://github.com/stenzek/duckstation.git
synced 2025-02-17 04:58:50 +00:00
CPU: Fix overflowed register written back in add instruction
This commit is contained in:
parent
459db392e7
commit
1afa02d475
@ -342,7 +342,10 @@ void Core::ExecuteInstruction(Instruction inst, u32 inst_pc)
|
||||
const u32 add_value = ReadReg(inst.r.rt);
|
||||
const u32 new_value = old_value + add_value;
|
||||
if (AddOverflow(old_value, add_value, new_value))
|
||||
{
|
||||
RaiseException(inst_pc, Exception::Ov);
|
||||
return;
|
||||
}
|
||||
|
||||
WriteReg(inst.r.rd, new_value);
|
||||
}
|
||||
@ -525,7 +528,10 @@ void Core::ExecuteInstruction(Instruction inst, u32 inst_pc)
|
||||
const u32 add_value = inst.i.imm_sext32();
|
||||
const u32 new_value = old_value + add_value;
|
||||
if (AddOverflow(old_value, add_value, new_value))
|
||||
{
|
||||
RaiseException(inst_pc, Exception::Ov);
|
||||
return;
|
||||
}
|
||||
|
||||
WriteReg(inst.i.rt, new_value);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user