mirror of
https://github.com/azahar-emu/dynarmic
synced 2025-11-14 11:00:00 +01:00
skyeye: Read-after-write in SMLA
In the case when RD === RN, RD was updated before AddOverflow was called to check for an overflow, resulting in an incorrect state of the Q flag. This is reapplying a patch from f12578b9ab21843b33a78ed6082b08f379230f45 that was lost during the 20e253ece2f2c110a28245f252ce184863432c88 update
This commit is contained in:
parent
843d29b5a9
commit
7a8dd9532d
@ -2794,10 +2794,12 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
|
|||||||
operand2 = (BIT(RS, 15)) ? (BITS(RS, 0, 15) | 0xffff0000) : BITS(RS, 0, 15);
|
operand2 = (BIT(RS, 15)) ? (BITS(RS, 0, 15) | 0xffff0000) : BITS(RS, 0, 15);
|
||||||
else
|
else
|
||||||
operand2 = (BIT(RS, 31)) ? (BITS(RS, 16, 31) | 0xffff0000) : BITS(RS, 16, 31);
|
operand2 = (BIT(RS, 31)) ? (BITS(RS, 16, 31) | 0xffff0000) : BITS(RS, 16, 31);
|
||||||
RD = operand1 * operand2 + RN;
|
|
||||||
|
|
||||||
if (AddOverflow(operand1 * operand2, RN, RD))
|
u32 product = operand1 * operand2;
|
||||||
|
u32 result = product + RN;
|
||||||
|
if (AddOverflow(product, RN, result))
|
||||||
cpu->Cpsr |= (1 << 27);
|
cpu->Cpsr |= (1 << 27);
|
||||||
|
RD = result;
|
||||||
}
|
}
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
INC_PC(sizeof(smla_inst));
|
INC_PC(sizeof(smla_inst));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user