mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
handle swp instruction aborts
This commit is contained in:
parent
1871c48849
commit
7c3108e20f
@ -382,13 +382,16 @@ void A_SWP(ARM* cpu)
|
||||
u32 rm = cpu->R[cpu->CurInstr & 0xF];
|
||||
|
||||
u32 val;
|
||||
cpu->DataRead32(base, &val);
|
||||
cpu->R[(cpu->CurInstr >> 12) & 0xF] = ROR(val, 8*(base&0x3));
|
||||
|
||||
if (cpu->DataRead32(base, &val))
|
||||
{
|
||||
u32 numD = cpu->DataCycles;
|
||||
cpu->DataWrite32(base, rm);
|
||||
if (cpu->DataWrite32(base, rm))
|
||||
{
|
||||
// rd only gets updated if both read and write succeed
|
||||
cpu->R[(cpu->CurInstr >> 12) & 0xF] = ROR(val, 8*(base&0x3));
|
||||
}
|
||||
cpu->DataCycles += numD;
|
||||
|
||||
}
|
||||
cpu->AddCycles_CDI();
|
||||
}
|
||||
|
||||
@ -397,12 +400,17 @@ void A_SWPB(ARM* cpu)
|
||||
u32 base = cpu->R[(cpu->CurInstr >> 16) & 0xF];
|
||||
u32 rm = cpu->R[cpu->CurInstr & 0xF] & 0xFF;
|
||||
|
||||
cpu->DataRead8(base, &cpu->R[(cpu->CurInstr >> 12) & 0xF]);
|
||||
|
||||
u32 val;
|
||||
if (cpu->DataRead8(base, &val))
|
||||
{
|
||||
u32 numD = cpu->DataCycles;
|
||||
cpu->DataWrite8(base, rm);
|
||||
if (cpu->DataWrite8(base, rm))
|
||||
{
|
||||
// rd only gets updated if both read and write succeed
|
||||
cpu->R[(cpu->CurInstr >> 12) & 0xF] = val;
|
||||
}
|
||||
cpu->DataCycles += numD;
|
||||
|
||||
}
|
||||
cpu->AddCycles_CDI();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user