From 3151618cb38db1205cfa1043784b33ed29d8e3ef Mon Sep 17 00:00:00 2001 From: pierre Date: Mon, 7 Mar 2011 00:12:55 +0000 Subject: [PATCH] Core/DSP/Jit: Fix register cache state tracking in bloop and loop emitters Fixes dsp lle jit crashes with dkcr. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7312 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/DSP/Jit/DSPJitBranch.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/Src/DSP/Jit/DSPJitBranch.cpp b/Source/Core/Core/Src/DSP/Jit/DSPJitBranch.cpp index 6c4d5e0867..0ac1f2adb0 100644 --- a/Source/Core/Core/Src/DSP/Jit/DSPJitBranch.cpp +++ b/Source/Core/Core/Src/DSP/Jit/DSPJitBranch.cpp @@ -369,12 +369,14 @@ void DSPEmitter::loop(const UDSPInstruction opc) u16 loop_pc = compilePC + 1; CMP(16, R(EDX), Imm16(0)); + DSPJitRegCache c(gpr); FixupBranch cnt = J_CC(CC_Z, true); dsp_reg_store_stack(3); MOV(16, R(RDX), Imm16(compilePC + 1)); dsp_reg_store_stack(0); MOV(16, R(RDX), Imm16(loop_pc)); dsp_reg_store_stack(2); + gpr.flushRegs(c); SetJumpTarget(cnt); MOV(16, M(&(g_dsp.pc)), Imm16(compilePC + 1)); @@ -424,6 +426,7 @@ void DSPEmitter::bloop(const UDSPInstruction opc) u16 loop_pc = dsp_imem_read(compilePC + 1); CMP(16, R(EDX), Imm16(0)); + DSPJitRegCache c(gpr); FixupBranch cnt = J_CC(CC_Z, true); dsp_reg_store_stack(3); MOV(16, R(RDX), Imm16(compilePC + 2)); @@ -431,13 +434,13 @@ void DSPEmitter::bloop(const UDSPInstruction opc) MOV(16, R(RDX), Imm16(loop_pc)); dsp_reg_store_stack(2); MOV(16, M(&(g_dsp.pc)), Imm16(compilePC + 2)); + gpr.flushRegs(c,true); FixupBranch exit = J(true); SetJumpTarget(cnt); // g_dsp.pc = loop_pc; // dsp_skip_inst(); MOV(16, M(&g_dsp.pc), Imm16(loop_pc + opTable[loop_pc]->size)); - DSPJitRegCache c(gpr); WriteBranchExit(*this); gpr.flushRegs(c,false); SetJumpTarget(exit);