changeset 397cbf4b11a6 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=397cbf4b11a6
description:
        X86: Clear out duplicate TLB entries when adding a new one.

        It's possible for two page table walks to overlap which will go in the 
same
        place in the TLB's trie. They would land on top of each other, so this 
change
        adds some code which detects if an address already matches an entry and 
if so
        throws away the new one.

diffstat:

 src/arch/x86/tlb.cc |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r ff4762285f99 -r 397cbf4b11a6 src/arch/x86/tlb.cc
--- a/src/arch/x86/tlb.cc       Mon Apr 23 12:00:41 2012 -0700
+++ b/src/arch/x86/tlb.cc       Tue Apr 24 00:48:41 2012 -0700
@@ -98,11 +98,16 @@
 TlbEntry *
 TLB::insert(Addr vpn, TlbEntry &entry)
 {
-    //TODO Deal with conflicting entries
+    // If somebody beat us to it, just use that existing entry.
+    TlbEntry *newEntry = trie.lookup(vpn);
+    if (newEntry) {
+        assert(newEntry->vaddr = vpn);
+        return newEntry;
+    }
 
-    TlbEntry *newEntry = NULL;
     if (freeList.empty())
         evictLRU();
+
     newEntry = freeList.front();
     freeList.pop_front();
 
@@ -110,7 +115,7 @@
     newEntry->lruSeq = nextSeq();
     newEntry->vaddr = vpn;
     newEntry->trieHandle =
-        trie.insert(vpn, TlbEntryTrie::MaxBits - entry.logBytes, newEntry);
+    trie.insert(vpn, TlbEntryTrie::MaxBits - entry.logBytes, newEntry);
     return newEntry;
 }
 
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to