Address mask for breakpoints, always clear whole instruction cache (until there's a better solution)

This commit is contained in:
Kingcom 2014-02-24 11:04:07 +01:00
parent 8cd45189c3
commit 8ee14a8039
1 changed files with 15 additions and 6 deletions

View File

@ -12,6 +12,8 @@ u64 CBreakPoints::breakSkipFirstTicks_ = 0;
std::vector<MemCheck> CBreakPoints::memChecks_;
std::vector<MemCheck *> CBreakPoints::cleanupMemChecks_;
int addressMask = 0x1FFFFFFF;
MemCheck::MemCheck()
{
numHits = 0;
@ -82,9 +84,11 @@ void MemCheck::JitCleanup()
size_t CBreakPoints::FindBreakpoint(u32 addr, bool matchTemp, bool temp)
{
addr &= addressMask;
for (size_t i = 0; i < breakPoints_.size(); ++i)
{
if (breakPoints_[i].addr == addr && (!matchTemp || breakPoints_[i].temporary == temp))
if ((breakPoints_[i].addr & addressMask) == addr && (!matchTemp || breakPoints_[i].temporary == temp))
return i;
}
@ -93,9 +97,11 @@ size_t CBreakPoints::FindBreakpoint(u32 addr, bool matchTemp, bool temp)
size_t CBreakPoints::FindMemCheck(u32 start, u32 end)
{
start &= addressMask;
end &= addressMask;
for (size_t i = 0; i < memChecks_.size(); ++i)
{
if (memChecks_[i].start == start && memChecks_[i].end == end)
if ((memChecks_[i].start & addressMask) == start && (memChecks_[i].end & addressMask) == end)
return i;
}
@ -291,6 +297,8 @@ static inline u32 NotCached(u32 val)
MemCheck *CBreakPoints::GetMemCheck(u32 address, int size)
{
address &= addressMask;
std::vector<MemCheck>::iterator iter;
for (iter = memChecks_.begin(); iter != memChecks_.end(); ++iter)
{
@ -338,11 +346,12 @@ void CBreakPoints::ExecMemCheckJitCleanup()
void CBreakPoints::SetSkipFirst(u32 pc)
{
breakSkipFirstAt_ = pc;
breakSkipFirstAt_ = pc & addressMask;
// breakSkipFirstTicks_ = CoreTiming::GetTicks();
}
u32 CBreakPoints::CheckSkipFirst(u32 cmpPc)
{
cmpPc &= addressMask;
u32 pc = breakSkipFirstAt_;
if (pc == cmpPc)
return 1;
@ -384,9 +393,9 @@ void CBreakPoints::Update(u32 addr)
resume = true;
}
if (addr != 0)
Cpu->Clear(addr-4,8);
else
// if (addr != 0)
// Cpu->Clear(addr-4,8);
// else
SysClearExecutionCache();
if (resume)