summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2005-09-02 14:38:11 -0400
committerSteve Reinhardt <stever@eecs.umich.edu>2005-09-02 14:38:11 -0400
commit39ce4fbaf964403696a31919ce705426e7d82e11 (patch)
tree506ed3c0c504dc63c4b336f75832ef251225e051
parent809230bbde6efc6106d0aefb696b69150bb66541 (diff)
downloadgem5-39ce4fbaf964403696a31919ce705426e7d82e11.tar.xz
Bug fix: can't increment an iterator after you erase
the thing it points to. Somehow Linux doesn't care, but Cygwin sure does. --HG-- extra : convert_revision : 1209a75831f080f17a95433e546d7074f9f07332
-rw-r--r--arch/alpha/alpha_memory.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/alpha/alpha_memory.cc b/arch/alpha/alpha_memory.cc
index 39c9397ea..8dda4d9c4 100644
--- a/arch/alpha/alpha_memory.cc
+++ b/arch/alpha/alpha_memory.cc
@@ -177,6 +177,7 @@ AlphaTLB::insert(Addr addr, AlphaISA::PTE &pte)
void
AlphaTLB::flushAll()
{
+ DPRINTF(TLB, "flushAll\n");
memset(table, 0, sizeof(AlphaISA::PTE[size]));
lookupTable.clear();
nlu = 0;
@@ -192,13 +193,16 @@ AlphaTLB::flushProcesses()
AlphaISA::PTE *pte = &table[index];
assert(pte->valid);
+ // we can't increment i after we erase it, so save a copy and
+ // increment it to get the next entry now
+ PageTable::iterator cur = i;
+ ++i;
+
if (!pte->asma) {
DPRINTF(TLB, "flush @%d: %#x -> %#x\n", index, pte->tag, pte->ppn);
pte->valid = false;
- lookupTable.erase(i);
+ lookupTable.erase(cur);
}
-
- ++i;
}
}