From e8cdbcc33f341655d00379fe85e21e1a5e1a372c Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 30 Aug 2014 16:46:43 -0700 Subject: [PATCH] x86jit: Fix some flags/EAX trashing in rounding. Fixes #6810. --- Core/MIPS/x86/Jit.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Core/MIPS/x86/Jit.cpp b/Core/MIPS/x86/Jit.cpp index 4f5cf98204..f6a968028e 100644 --- a/Core/MIPS/x86/Jit.cpp +++ b/Core/MIPS/x86/Jit.cpp @@ -487,8 +487,8 @@ bool Jit::ReplaceJalTo(u32 dest) { MOV(32, M(&mips_->pc), Imm32(js.compilerPC)); ClearRoundingMode(); ABI_CallFunction(entry->replaceFunc); - SetRoundingMode(); SUB(32, M(¤tMIPS->downcount), R(EAX)); + SetRoundingMode(); } js.compilerPC += 4; @@ -539,14 +539,16 @@ void Jit::Comp_ReplacementFunc(MIPSOpcode op) MOV(32, M(&mips_->pc), Imm32(js.compilerPC)); ClearRoundingMode(); ABI_CallFunction(entry->replaceFunc); - SetRoundingMode(); if (entry->flags & (REPFLAG_HOOKENTER | REPFLAG_HOOKEXIT)) { // Compile the original instruction at this address. We ignore cycles for hooks. + SetRoundingMode(); MIPSCompileOp(Memory::Read_Instruction(js.compilerPC, true)); } else { MOV(32, R(ECX), M(¤tMIPS->r[MIPS_REG_RA])); SUB(32, M(¤tMIPS->downcount), R(EAX)); + SetRoundingMode(); + SUB(32, M(¤tMIPS->downcount), Imm8(0)); WriteExitDestInReg(ECX); js.compiling = false; } @@ -694,17 +696,18 @@ bool Jit::CheckJitBreakpoint(u32 addr, int downcountOffset) MOV(32, M(&mips_->pc), Imm32(js.compilerPC)); ClearRoundingMode(); ABI_CallFunction(&JitBreakpoint); - SetRoundingMode(); // If 0, the conditional breakpoint wasn't taken. CMP(32, R(EAX), Imm32(0)); FixupBranch skip = J_CC(CC_Z); WriteDowncount(downcountOffset); // Just to fix the stack. + SetRoundingMode(); LOAD_FLAGS; JMP(asm_.dispatcherCheckCoreState, true); SetJumpTarget(skip); + SetRoundingMode(); LOAD_FLAGS; return true;