diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp index 345abe547a..2c002f9dc7 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp @@ -160,24 +160,14 @@ void JitArm64::WriteExit(u32 destination) linkData.exitPtrs = GetWritableCodePtr(); linkData.linkStatus = false; - // Link opportunity! - int block; - if (jo.enableBlocklink && (block = blocks.GetBlockNumberFromStartAddress(destination)) >= 0) - { - // It exists! Joy of joy! - B(blocks.GetBlock(block)->checkedEntry); - linkData.linkStatus = true; - } - else - { - ARM64Reg WA = gpr.GetReg(); - ARM64Reg XA = EncodeRegTo64(WA); - MOVI2R(WA, destination); - STR(INDEX_UNSIGNED, WA, X29, PPCSTATE_OFF(pc)); - MOVI2R(XA, (u64)asm_routines.dispatcher); - BR(XA); - gpr.Unlock(WA); - } + // the code generated in JitArm64BlockCache::WriteDestroyBlock must fit in this block + ARM64Reg WA = gpr.GetReg(); + ARM64Reg XA = EncodeRegTo64(WA); + MOVI2R(WA, destination); + STR(INDEX_UNSIGNED, WA, X29, PPCSTATE_OFF(pc)); + MOVI2R(XA, (u64)asm_routines.dispatcher); + BR(XA); + gpr.Unlock(WA); b->linkData.push_back(linkData); } diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp index 96f5d1aaf6..266941d1e6 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp @@ -9,12 +9,24 @@ void JitArm64BlockCache::WriteLinkBlock(u8* location, const u8* address) { ARM64XEmitter emit(location); - emit.B(address); + s64 offset = address - location; + + // different size of the dispatcher call, so they are still continuous + if (offset > 0 && offset <= 28 && offset % 4 == 0) + { + for (int i = 0; i < offset / 4; i++) + emit.HINT(HINT_NOP); + } + else + { + emit.B(address); + } emit.FlushIcache(); } void JitArm64BlockCache::WriteDestroyBlock(const u8* location, u32 address) { + // must fit within the code generated in JitArm64::WriteExit ARM64XEmitter emit((u8 *)location); emit.MOVI2R(W0, address); emit.MOVI2R(X30, (u64)jit->GetAsmRoutines()->dispatcher);