{
int removed = 0;
range_t range = equal_range(event);
- for (iterator i = range.first; i != range.second; ++i) {
+ iterator i = range.first;
+ while (i != range.second &&
+ i != pc_map.end()) {
if (*i == event) {
DPRINTF(PCEvent, "PC based event removed at %#x: %s\n",
event->pc(), event->descr());
- pc_map.erase(i);
+ i = pc_map.erase(i);
++removed;
+ } else {
+ i++;
}
+
}
return removed > 0;
pfRemovedMSHR++;
delete (*iter)->req;
delete (*iter);
- pf.erase(iter);
+ iter = pf.erase(iter);
if (pf.empty())
cache->deassertMemSideBusRequest(BaseCache::Request_PF);
}
// Needed for serial calculators like GHB
if (serialSquash) {
iter = pf.end();
- iter--;
+ if (iter != pf.begin())
+ iter--;
while (!pf.empty() && ((*iter)->time >= time)) {
pfSquashed++;
DPRINTF(HWPrefetch, "Squashing old prefetch addr: 0x%x\n",
(*iter)->getAddr());
delete (*iter)->req;
delete (*iter);
- pf.erase(iter);
- iter--;
+ iter = pf.erase(iter);
+ if (iter != pf.begin())
+ iter--;
}
if (pf.empty())
cache->deassertMemSideBusRequest(BaseCache::Request_PF);