aboutsummaryrefslogtreecommitdiff
path: root/src/ARMJIT_x64
diff options
context:
space:
mode:
authorRSDuck <rsduck@users.noreply.github.com>2021-01-19 23:49:32 +0100
committerRSDuck <rsduck@users.noreply.github.com>2021-01-19 23:50:08 +0100
commit771dfaca2e3851217287aa73423eb6ec6d6b4360 (patch)
treee2917b8770e6cf9354bff9d89f3ae0455f4a15d4 /src/ARMJIT_x64
parent31c9d116bd9a1e16fccc2e7a974d4a7410f7da90 (diff)
JIT: handle STR post with rd == rn
fixes Zelda Four Swords
Diffstat (limited to 'src/ARMJIT_x64')
-rw-r--r--src/ARMJIT_x64/ARMJIT_Compiler.cpp10
-rw-r--r--src/ARMJIT_x64/ARMJIT_LoadStore.cpp12
2 files changed, 19 insertions, 3 deletions
diff --git a/src/ARMJIT_x64/ARMJIT_Compiler.cpp b/src/ARMJIT_x64/ARMJIT_Compiler.cpp
index cc4ad80..1eb5a2a 100644
--- a/src/ARMJIT_x64/ARMJIT_Compiler.cpp
+++ b/src/ARMJIT_x64/ARMJIT_Compiler.cpp
@@ -98,7 +98,9 @@ void Compiler::A_Comp_MRS()
MOV(32, rd, R(RSCRATCH3));
}
else
+ {
MOV(32, rd, R(RCPSR));
+ }
}
void UpdateModeTrampoline(ARM* arm, u32 oldmode, u32 newmode)
@@ -703,7 +705,9 @@ JitBlockEntry Compiler::CompileBlock(ARM* cpu, bool thumb, FetchedInstr instrs[]
ABI_CallFunction(InterpretTHUMB[CurInstr.Info.Kind]);
}
else
+ {
(this->*comp)();
+ }
}
else
{
@@ -724,7 +728,7 @@ JitBlockEntry Compiler::CompileBlock(ARM* cpu, bool thumb, FetchedInstr instrs[]
}
else
{
- IrregularCycles = false;
+ IrregularCycles = comp == NULL;
FixupBranch skipExecute;
if (cond < 0xE)
@@ -737,7 +741,9 @@ JitBlockEntry Compiler::CompileBlock(ARM* cpu, bool thumb, FetchedInstr instrs[]
ABI_CallFunction(InterpretARM[CurInstr.Info.Kind]);
}
else
+ {
(this->*comp)();
+ }
Comp_SpecialBranchBehaviour(true);
@@ -755,7 +761,9 @@ JitBlockEntry Compiler::CompileBlock(ARM* cpu, bool thumb, FetchedInstr instrs[]
SetJumpTarget(skipFailed);
}
else
+ {
SetJumpTarget(skipExecute);
+ }
}
}
diff --git a/src/ARMJIT_x64/ARMJIT_LoadStore.cpp b/src/ARMJIT_x64/ARMJIT_LoadStore.cpp
index d80b25b..c044e69 100644
--- a/src/ARMJIT_x64/ARMJIT_LoadStore.cpp
+++ b/src/ARMJIT_x64/ARMJIT_LoadStore.cpp
@@ -130,6 +130,12 @@ void Compiler::Comp_MemAccess(int rd, int rn, const Op2& op2, int size, int flag
if (Thumb && rn == 15)
rnMapped = Imm32(R15 & ~0x2);
+ if (flags & memop_Store && flags & (memop_Post|memop_Writeback) && rd == rn)
+ {
+ MOV(32, R(RSCRATCH4), rdMapped);
+ rdMapped = R(RSCRATCH4);
+ }
+
X64Reg finalAddr = RSCRATCH3;
if (flags & memop_Post)
{
@@ -282,13 +288,15 @@ void Compiler::Comp_MemAccess(int rd, int rn, const Op2& op2, int size, int flag
{
if (Num == 0)
{
+ // on Windows param 3 is R8 which is also scratch 4 which can be used for rd
+ if (flags & memop_Store)
+ MOV(32, R(ABI_PARAM3), rdMapped);
+
MOV(64, R(ABI_PARAM2), R(RCPU));
if (ABI_PARAM1 != RSCRATCH3)
MOV(32, R(ABI_PARAM1), R(RSCRATCH3));
if (flags & memop_Store)
{
- MOV(32, R(ABI_PARAM3), rdMapped);
-
switch (size | NDS::ConsoleType)
{
case 32: CALL((void*)&SlowWrite9<u32, 0>); break;