From e85f0ff179d737169c2617a1d81d92b3839bee18 Mon Sep 17 00:00:00 2001 From: Fiora Date: Sun, 4 Jan 2015 21:15:50 -0800 Subject: [PATCH] MMU: fix problems with blocks that cross vmem page boundaries In rare cases, this can result in a violation of the JIT block cache constraint that blocks must end in the same place. This can cause instability, lockups, due to blocks not properly being invalidated properly. l Please enter the commit message for your changes. Lines starting --- Source/Core/Core/PowerPC/PPCAnalyst.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp index 5c6dd390c8..bc1da5a230 100644 --- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp +++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp @@ -670,6 +670,15 @@ u32 PPCAnalyzer::Analyze(u32 address, CodeBlock *block, CodeBuffer *buffer, u32 if (inst.hex != 0) { + // Slight hack: the JIT block cache currently assumes all blocks end at the same place, + // but broken blocks due to page faults break this assumption. Avoid this by just ending + // all virtual memory instruction blocks at page boundaries. + // FIXME: improve the JIT block cache so we don't need to do this. + if (virtualAddr && i > 0 && (address & 0xfff) == 0) + { + break; + } + num_inst++; memset(&code[i], 0, sizeof(CodeOp)); GekkoOPInfo *opinfo = GetOpInfo(inst);