From 540bd13222af85d08929a065edfa61765a36ae41 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 5 Jul 2013 01:13:05 -0700 Subject: [PATCH] Correctly match ranges in memchecks with ends. --- Core/Debugger/Breakpoints.cpp | 4 ++-- Core/MIPS/x86/Jit.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Core/Debugger/Breakpoints.cpp b/Core/Debugger/Breakpoints.cpp index 557a41d4b3..548241000b 100644 --- a/Core/Debugger/Breakpoints.cpp +++ b/Core/Debugger/Breakpoints.cpp @@ -248,12 +248,12 @@ MemCheck *CBreakPoints::GetMemCheck(u32 address, int size) MemCheck &check = *iter; if (check.end != 0) { - if (address >= check.start && address + size < check.end) + if (address + size >= check.start && address < check.end) return ✓ } else { - if (check.start==address) + if (check.start == address) return ✓ } } diff --git a/Core/MIPS/x86/Jit.cpp b/Core/MIPS/x86/Jit.cpp index acb3d73fdc..60164e4b2e 100644 --- a/Core/MIPS/x86/Jit.cpp +++ b/Core/MIPS/x86/Jit.cpp @@ -732,7 +732,7 @@ void Jit::JitSafeMem::MemCheckImm(ReadType type) jit_->CMP(32, M((void*)&coreState), Imm32(0)); skipChecks_.push_back(jit_->J_CC(CC_NE, true)); - jit_->js.afterOp = JitState::AFTER_CORE_STATE | JitState::AFTER_REWIND_PC_BAD_STATE; + jit_->js.afterOp |= JitState::AFTER_CORE_STATE | JitState::AFTER_REWIND_PC_BAD_STATE; } } @@ -749,9 +749,9 @@ void Jit::JitSafeMem::MemCheckAsm(ReadType type) FixupBranch skipNext, skipNextRange; if (it->end != 0) { - jit_->CMP(32, R(xaddr_), Imm32(it->start - offset_)); + jit_->CMP(32, R(xaddr_), Imm32(it->start - offset_ - size_)); skipNext = jit_->J_CC(CC_B); - jit_->CMP(32, R(xaddr_), Imm32(it->end - offset_ - size_)); + jit_->CMP(32, R(xaddr_), Imm32(it->end - offset_)); skipNextRange = jit_->J_CC(CC_AE); } else @@ -768,7 +768,7 @@ void Jit::JitSafeMem::MemCheckAsm(ReadType type) jit_->CMP(32, M((void*)&coreState), Imm32(0)); skipChecks_.push_back(jit_->J_CC(CC_NE, true)); - jit_->js.afterOp = JitState::AFTER_CORE_STATE | JitState::AFTER_REWIND_PC_BAD_STATE; + jit_->js.afterOp |= JitState::AFTER_CORE_STATE | JitState::AFTER_REWIND_PC_BAD_STATE; jit_->SetJumpTarget(skipNext); if (it->end != 0)