Make memchecks ignore cached/uncached memory.

You usually want both.
This commit is contained in:
Unknown W. Brackets committed 2013-10-27 13:15:12 -07:00
1 parent f9e4cae3c0
commit da20bda729
3 files changed
+37 -6

No files matched your search

+31 -2
View File
@@ -248,6 +248,12 @@ void CBreakPoints::ClearAllMemChecks()
}
}
static inline u32 NotCached(u32 val)
{
// Remove the cached part of the address.
return val & ~0x40000000;
}
MemCheck *CBreakPoints::GetMemCheck(u32 address, int size)
{
std::vector<MemCheck>::iterator iter;
@@ -256,12 +262,12 @@ MemCheck *CBreakPoints::GetMemCheck(u32 address, int size)
MemCheck &check = *iter;
if (check.end != 0)
{
if (address + size > check.start && address < check.end)
if (NotCached(address + size) > NotCached(check.start) && NotCached(address) < NotCached(check.end))
return &check;
}
else
{
if (check.start == address)
if (NotCached(check.start) == NotCached(address))
return &check;
}
}
@@ -270,6 +276,13 @@ MemCheck *CBreakPoints::GetMemCheck(u32 address, int size)
return 0;
}
void CBreakPoints::ExecMemCheck(u32 address, bool write, int size, u32 pc)
{
auto check = GetMemCheck(address, size);
if (check)
check->Action(address, write, size, pc);
}
void CBreakPoints::SetSkipFirst(u32 pc)
{
breakSkipFirstAt_ = pc;
@@ -283,6 +296,22 @@ u32 CBreakPoints::CheckSkipFirst()
return 0;
}
const std::vector<MemCheck> CBreakPoints::GetMemCheckRanges()
{
std::vector<MemCheck> ranges = memChecks_;
for (auto it = memChecks_.begin(), end = memChecks_.end(); it != end; ++it)
{
MemCheck check = *it;
// Toggle the cached part of the address.
check.start ^= 0x40000000;
if (check.end != 0)
check.end ^= 0x40000000;
ranges.push_back(check);
}
return ranges;
}
const std::vector<MemCheck> CBreakPoints::GetMemChecks()
{
return memChecks_;