mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-12-11 23:53:55 +00:00
Merge pull request #2625 from unknownbrackets/debugger
Fix some memcheck bugs
This commit is contained in:
commit
abc03520b4
@ -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 ✓
|
||||
}
|
||||
}
|
||||
|
@ -735,6 +735,10 @@ void JitMemCheck(u32 addr, int size, int isWrite)
|
||||
if (CBreakPoints::CheckSkipFirst() == currentMIPS->pc)
|
||||
return;
|
||||
|
||||
// Did we already hit one?
|
||||
if (coreState != CORE_RUNNING)
|
||||
return;
|
||||
|
||||
MemCheck *check = CBreakPoints::GetMemCheck(addr, size);
|
||||
if (check)
|
||||
check->Action(addr, isWrite == 1, size, currentMIPS->pc);
|
||||
@ -755,26 +759,29 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
void Jit::JitSafeMem::MemCheckAsm(ReadType type)
|
||||
{
|
||||
auto memchecks = CBreakPoints::GetMemChecks();
|
||||
const auto memchecks = CBreakPoints::GetMemChecks();
|
||||
bool possible = false;
|
||||
for (auto it = memchecks.begin(), end = memchecks.end(); it != end; ++it)
|
||||
{
|
||||
if (!(it->cond & MEMCHECK_READ) && type == MEM_READ)
|
||||
return;
|
||||
continue;
|
||||
if (!(it->cond & MEMCHECK_WRITE) && type == MEM_WRITE)
|
||||
return;
|
||||
continue;
|
||||
|
||||
possible = true;
|
||||
|
||||
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
|
||||
@ -789,14 +796,17 @@ void Jit::JitSafeMem::MemCheckAsm(ReadType type)
|
||||
jit_->ABI_CallFunctionACC(jit_->thunks.ProtectFunction((void *)&JitMemCheck, 3), R(xaddr_), size_, type == MEM_WRITE ? 1 : 0);
|
||||
jit_->POP(xaddr_);
|
||||
|
||||
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_->SetJumpTarget(skipNext);
|
||||
if (it->end != 0)
|
||||
jit_->SetJumpTarget(skipNextRange);
|
||||
}
|
||||
|
||||
if (possible)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
void Jit::Comp_DoNothing(u32 op) { }
|
||||
|
Loading…
Reference in New Issue
Block a user