1/* 2 * Copyright (c) 2007-2008 The Hewlett-Packard Development Company 3 * All rights reserved. 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 84 unchanged lines hidden (view full) --- 93 trie.remove(tlb[lru].trieHandle); 94 tlb[lru].trieHandle = NULL; 95 freeList.push_back(&tlb[lru]); 96} 97 98TlbEntry * 99TLB::insert(Addr vpn, TlbEntry &entry) 100{ |
101 // If somebody beat us to it, just use that existing entry. 102 TlbEntry *newEntry = trie.lookup(vpn); 103 if (newEntry) { 104 assert(newEntry->vaddr = vpn); 105 return newEntry; 106 } |
107 |
108 if (freeList.empty()) 109 evictLRU(); |
110 |
111 newEntry = freeList.front(); 112 freeList.pop_front(); 113 114 *newEntry = entry; 115 newEntry->lruSeq = nextSeq(); 116 newEntry->vaddr = vpn; 117 newEntry->trieHandle = |
118 trie.insert(vpn, TlbEntryTrie::MaxBits - entry.logBytes, newEntry); |
119 return newEntry; 120} 121 122TlbEntry * 123TLB::lookup(Addr va, bool update_lru) 124{ 125 TlbEntry *entry = trie.lookup(va); 126 if (entry && update_lru) --- 328 unchanged lines hidden --- |