From eaed080add176292239d6aa8029ac093dc329e9a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 10 Apr 2015 20:25:29 -0700 Subject: [PATCH] x86jit: Fix immediate kernel addresses. Using a signed add + a value with the top bit set = bad. Will have to live with losing the kernel bit here, should be fine. --- Core/MIPS/x86/JitSafeMem.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/MIPS/x86/JitSafeMem.cpp b/Core/MIPS/x86/JitSafeMem.cpp index 481f1524a0..d08ed74b8d 100644 --- a/Core/MIPS/x86/JitSafeMem.cpp +++ b/Core/MIPS/x86/JitSafeMem.cpp @@ -51,8 +51,9 @@ JitSafeMem::JitSafeMem(Jit *jit, MIPSGPReg raddr, s32 offset, u32 alignMask) { // This makes it more instructions, so let's play it safe and say we need a far jump. far_ = !g_Config.bIgnoreBadMemAccess || !CBreakPoints::GetMemChecks().empty(); + // Mask out the kernel RAM bit, because we'll end up with a negative offset to MEMBASEREG. if (jit_->gpr.IsImm(raddr_)) - iaddr_ = jit_->gpr.GetImm(raddr_) + offset_; + iaddr_ = (jit_->gpr.GetImm(raddr_) + offset_) & 0x7FFFFFFF; else iaddr_ = (u32) -1; @@ -123,9 +124,9 @@ bool JitSafeMem::PrepareRead(OpArg &src, int size) OpArg JitSafeMem::NextFastAddress(int suboffset) { - if (jit_->gpr.IsImm(raddr_)) + if (iaddr_ != (u32) -1) { - u32 addr = (jit_->gpr.GetImm(raddr_) + offset_ + suboffset) & alignMask_; + u32 addr = (iaddr_ + suboffset) & alignMask_; #ifdef _M_IX86 return M(Memory::base + (addr & Memory::MEMVIEW32_MASK));