summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cpu/pc_event.cc9
-rw-r--r--src/mem/cache/prefetch/base.cc10
2 files changed, 13 insertions, 6 deletions
diff --git a/src/cpu/pc_event.cc b/src/cpu/pc_event.cc
index 9cf63f7d3..2b54ee5fb 100644
--- a/src/cpu/pc_event.cc
+++ b/src/cpu/pc_event.cc
@@ -56,13 +56,18 @@ PCEventQueue::remove(PCEvent *event)
{
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;
diff --git a/src/mem/cache/prefetch/base.cc b/src/mem/cache/prefetch/base.cc
index 4d1f7c81c..f3ac5f046 100644
--- a/src/mem/cache/prefetch/base.cc
+++ b/src/mem/cache/prefetch/base.cc
@@ -182,7 +182,7 @@ BasePrefetcher::notify(PacketPtr &pkt, Tick time)
pfRemovedMSHR++;
delete (*iter)->req;
delete (*iter);
- pf.erase(iter);
+ iter = pf.erase(iter);
if (pf.empty())
cache->deassertMemSideBusRequest(BaseCache::Request_PF);
}
@@ -194,15 +194,17 @@ BasePrefetcher::notify(PacketPtr &pkt, Tick time)
// 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);