diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp b/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp index da7f7c1c27..4e9bb512de 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp +++ b/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp @@ -177,15 +177,23 @@ const u8 *Jitx86Base::BackPatch(u8 *codePtr, u32 emAddress, void *ctx_void) InstructionInfo info; if (!DisassembleMov(codePtr, &info)) { BackPatchError("BackPatch - failed to disassemble MOV instruction", codePtr, emAddress); + return 0; } if (info.otherReg != RBX) + { PanicAlert("BackPatch : Base reg not RBX." "\n\nAttempted to access %08x.", emAddress); + return 0; + } auto it = registersInUseAtLoc.find(codePtr); if (it == registersInUseAtLoc.end()) + { PanicAlert("BackPatch: no register use entry for address %p", codePtr); + return 0; + } + u32 registersInUse = it->second; if (!info.isMemoryWrite) @@ -235,7 +243,6 @@ const u8 *Jitx86Base::BackPatch(u8 *codePtr, u32 emAddress, void *ctx_void) emitter.NOP(codePtr + info.instructionSize - emitter.GetCodePtr()); return start; } - return 0; #else return 0; #endif diff --git a/Source/Core/Core/Src/x64MemTools.cpp b/Source/Core/Core/Src/x64MemTools.cpp index a0c79aaed5..62ca755385 100644 --- a/Source/Core/Core/Src/x64MemTools.cpp +++ b/Source/Core/Core/Src/x64MemTools.cpp @@ -65,6 +65,11 @@ bool DoFault(u64 bad_address, SContext *ctx) { ctx->CTX_PC = (u64) new_pc; } + else + { + // there was an error, give the debugger a chance + return false; + } return true; }