diff options
Diffstat (limited to 'src/arch/x86/tlb.cc')
-rw-r--r-- | src/arch/x86/tlb.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/arch/x86/tlb.cc b/src/arch/x86/tlb.cc index 52cc3e0ee..087cfbadf 100644 --- a/src/arch/x86/tlb.cc +++ b/src/arch/x86/tlb.cc @@ -439,11 +439,42 @@ TLB::getWalker() void TLB::serialize(std::ostream &os) { + // Only store the entries in use. + uint32_t _size = size - freeList.size(); + SERIALIZE_SCALAR(_size); + SERIALIZE_SCALAR(lruSeq); + + uint32_t _count = 0; + + for (uint32_t x = 0; x < size; x++) { + if (tlb[x].trieHandle != NULL) { + os << "\n[" << csprintf("%s.Entry%d", name(), _count) << "]\n"; + tlb[x].serialize(os); + _count++; + } + } } void TLB::unserialize(Checkpoint *cp, const std::string §ion) { + // Do not allow to restore with a smaller tlb. + uint32_t _size; + UNSERIALIZE_SCALAR(_size); + if (_size > size) { + fatal("TLB size less than the one in checkpoint!"); + } + + UNSERIALIZE_SCALAR(lruSeq); + + for (uint32_t x = 0; x < _size; x++) { + TlbEntry *newEntry = freeList.front(); + freeList.pop_front(); + + newEntry->unserialize(cp, csprintf("%s.Entry%d", name(), x)); + newEntry->trieHandle = trie.insert(newEntry->vaddr, + TlbEntryTrie::MaxBits - newEntry->logBytes, newEntry); + } } BaseMasterPort * |