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 --- 48 unchanged lines hidden (view full) --- 57#include "mem/packet_access.hh" 58#include "mem/page_table.hh" 59#include "mem/request.hh" 60#include "sim/full_system.hh" 61#include "sim/process.hh" 62 63namespace X86ISA { 64 |
65TLB::TLB(const Params *p) 66 : BaseTLB(p), configAddress(0), size(p->size), 67 tlb(size), lruSeq(0) |
68{ 69 if (!size) 70 fatal("TLBs must have a non-zero size.\n"); |
71 72 for (int x = 0; x < size; x++) { 73 tlb[x].trieHandle = NULL; 74 freeList.push_back(&tlb[x]); 75 } 76 77 walker = p->walker; 78 walker->setTLB(this); --- 366 unchanged lines hidden (view full) --- 445 446Walker * 447TLB::getWalker() 448{ 449 return walker; 450} 451 452void |
453TLB::serialize(CheckpointOut &cp) const |
454{ 455 // Only store the entries in use. 456 uint32_t _size = size - freeList.size(); 457 SERIALIZE_SCALAR(_size); 458 SERIALIZE_SCALAR(lruSeq); 459 460 uint32_t _count = 0; |
461 for (uint32_t x = 0; x < size; x++) { |
462 if (tlb[x].trieHandle != NULL) 463 tlb[x].serializeSection(cp, csprintf("Entry%d", _count++)); |
464 } 465} 466 467void |
468TLB::unserialize(CheckpointIn &cp) |
469{ 470 // Do not allow to restore with a smaller tlb. 471 uint32_t _size; 472 UNSERIALIZE_SCALAR(_size); 473 if (_size > size) { 474 fatal("TLB size less than the one in checkpoint!"); 475 } 476 477 UNSERIALIZE_SCALAR(lruSeq); 478 479 for (uint32_t x = 0; x < _size; x++) { 480 TlbEntry *newEntry = freeList.front(); 481 freeList.pop_front(); 482 |
483 newEntry->unserializeSection(cp, csprintf("Entry%d", x)); |
484 newEntry->trieHandle = trie.insert(newEntry->vaddr, 485 TlbEntryTrie::MaxBits - newEntry->logBytes, newEntry); 486 } 487} 488 489BaseMasterPort * 490TLB::getMasterPort() 491{ 492 return &walker->getMasterPort("port"); 493} 494 495} // namespace X86ISA 496 497X86ISA::TLB * 498X86TLBParams::create() 499{ 500 return new X86ISA::TLB(this); 501} |