gem5  v20.1.0.0
tlb.cc
Go to the documentation of this file.
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
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #include "arch/x86/tlb.hh"
39 
40 #include <cstring>
41 #include <memory>
42 
43 #include "arch/x86/faults.hh"
47 #include "arch/x86/regs/misc.hh"
48 #include "arch/x86/regs/msr.hh"
49 #include "arch/x86/x86_traits.hh"
50 #include "base/trace.hh"
51 #include "cpu/thread_context.hh"
52 #include "debug/TLB.hh"
53 #include "mem/packet_access.hh"
54 #include "mem/page_table.hh"
55 #include "mem/request.hh"
56 #include "sim/full_system.hh"
57 #include "sim/process.hh"
58 #include "sim/pseudo_inst.hh"
59 
60 namespace X86ISA {
61 
62 TLB::TLB(const Params *p)
63  : BaseTLB(p), configAddress(0), size(p->size),
64  tlb(size), lruSeq(0), m5opRange(p->system->m5opRange()), stats(this)
65 {
66  if (!size)
67  fatal("TLBs must have a non-zero size.\n");
68 
69  for (int x = 0; x < size; x++) {
70  tlb[x].trieHandle = NULL;
71  freeList.push_back(&tlb[x]);
72  }
73 
74  walker = p->walker;
75  walker->setTLB(this);
76 }
77 
78 void
80 {
81  // Find the entry with the lowest (and hence least recently updated)
82  // sequence number.
83 
84  unsigned lru = 0;
85  for (unsigned i = 1; i < size; i++) {
86  if (tlb[i].lruSeq < tlb[lru].lruSeq)
87  lru = i;
88  }
89 
90  assert(tlb[lru].trieHandle);
91  trie.remove(tlb[lru].trieHandle);
92  tlb[lru].trieHandle = NULL;
93  freeList.push_back(&tlb[lru]);
94 }
95 
96 TlbEntry *
97 TLB::insert(Addr vpn, const TlbEntry &entry)
98 {
99  // If somebody beat us to it, just use that existing entry.
100  TlbEntry *newEntry = trie.lookup(vpn);
101  if (newEntry) {
102  assert(newEntry->vaddr == vpn);
103  return newEntry;
104  }
105 
106  if (freeList.empty())
107  evictLRU();
108 
109  newEntry = freeList.front();
110  freeList.pop_front();
111 
112  *newEntry = entry;
113  newEntry->lruSeq = nextSeq();
114  newEntry->vaddr = vpn;
115  newEntry->trieHandle =
116  trie.insert(vpn, TlbEntryTrie::MaxBits - entry.logBytes, newEntry);
117  return newEntry;
118 }
119 
120 TlbEntry *
121 TLB::lookup(Addr va, bool update_lru)
122 {
123  TlbEntry *entry = trie.lookup(va);
124  if (entry && update_lru)
125  entry->lruSeq = nextSeq();
126  return entry;
127 }
128 
129 void
131 {
132  DPRINTF(TLB, "Invalidating all entries.\n");
133  for (unsigned i = 0; i < size; i++) {
134  if (tlb[i].trieHandle) {
135  trie.remove(tlb[i].trieHandle);
136  tlb[i].trieHandle = NULL;
137  freeList.push_back(&tlb[i]);
138  }
139  }
140 }
141 
142 void
144 {
146 }
147 
148 void
150 {
151  DPRINTF(TLB, "Invalidating all non global entries.\n");
152  for (unsigned i = 0; i < size; i++) {
153  if (tlb[i].trieHandle && !tlb[i].global) {
154  trie.remove(tlb[i].trieHandle);
155  tlb[i].trieHandle = NULL;
156  freeList.push_back(&tlb[i]);
157  }
158  }
159 }
160 
161 void
162 TLB::demapPage(Addr va, uint64_t asn)
163 {
164  TlbEntry *entry = trie.lookup(va);
165  if (entry) {
166  trie.remove(entry->trieHandle);
167  entry->trieHandle = NULL;
168  freeList.push_back(entry);
169  }
170 }
171 
172 namespace
173 {
174 
175 Cycles
176 localMiscRegAccess(bool read, MiscRegIndex regNum,
177  ThreadContext *tc, PacketPtr pkt)
178 {
179  if (read) {
180  RegVal data = htole(tc->readMiscReg(regNum));
181  assert(pkt->getSize() <= sizeof(RegVal));
182  pkt->setData((uint8_t *)&data);
183  } else {
184  RegVal data = htole(tc->readMiscRegNoEffect(regNum));
185  assert(pkt->getSize() <= sizeof(RegVal));
186  pkt->writeData((uint8_t *)&data);
187  tc->setMiscReg(regNum, letoh(data));
188  }
189  return Cycles(1);
190 }
191 
192 } // anonymous namespace
193 
194 Fault
196 {
197  DPRINTF(TLB, "Addresses references internal memory.\n");
198  Addr vaddr = req->getVaddr();
199  Addr prefix = (vaddr >> 3) & IntAddrPrefixMask;
200  if (prefix == IntAddrPrefixCPUID) {
201  panic("CPUID memory space not yet implemented!\n");
202  } else if (prefix == IntAddrPrefixMSR) {
203  vaddr = (vaddr >> 3) & ~IntAddrPrefixMask;
204 
205  MiscRegIndex regNum;
206  if (!msrAddrToIndex(regNum, vaddr))
207  return std::make_shared<GeneralProtection>(0);
208 
209  req->setPaddr(req->getVaddr());
210  req->setLocalAccessor(
211  [read,regNum](ThreadContext *tc, PacketPtr pkt)
212  {
213  return localMiscRegAccess(read, regNum, tc, pkt);
214  }
215  );
216 
217  return NoFault;
218  } else if (prefix == IntAddrPrefixIO) {
219  // TODO If CPL > IOPL or in virtual mode, check the I/O permission
220  // bitmap in the TSS.
221 
222  Addr IOPort = vaddr & ~IntAddrPrefixMask;
223  // Make sure the address fits in the expected 16 bit IO address
224  // space.
225  assert(!(IOPort & ~0xFFFF));
226  if (IOPort == 0xCF8 && req->getSize() == 4) {
227  req->setPaddr(req->getVaddr());
228  req->setLocalAccessor(
229  [read](ThreadContext *tc, PacketPtr pkt)
230  {
231  return localMiscRegAccess(
232  read, MISCREG_PCI_CONFIG_ADDRESS, tc, pkt);
233  }
234  );
235  } else if ((IOPort & ~mask(2)) == 0xCFC) {
239  if (bits(configAddress, 31, 31)) {
240  req->setPaddr(PhysAddrPrefixPciConfig |
241  mbits(configAddress, 30, 2) |
242  (IOPort & mask(2)));
243  } else {
244  req->setPaddr(PhysAddrPrefixIO | IOPort);
245  }
246  } else {
248  req->setPaddr(PhysAddrPrefixIO | IOPort);
249  }
250  return NoFault;
251  } else {
252  panic("Access to unrecognized internal address space %#x.\n",
253  prefix);
254  }
255 }
256 
257 Fault
259  ThreadContext *tc, Mode mode) const
260 {
261  Addr paddr = req->getPaddr();
262 
263  if (m5opRange.contains(paddr)) {
264  req->setFlags(Request::STRICT_ORDER);
265  uint8_t func;
267  req->setLocalAccessor(
268  [func, mode](ThreadContext *tc, PacketPtr pkt) -> Cycles
269  {
270  uint64_t ret;
271  PseudoInst::pseudoInst<X86PseudoInstABI, true>(tc, func, ret);
272  if (mode == Read)
273  pkt->setLE(ret);
274  return Cycles(1);
275  }
276  );
277  } else if (FullSystem) {
278  // Check for an access to the local APIC
279  LocalApicBase localApicBase =
281  AddrRange apicRange(localApicBase.base * PageBytes,
282  (localApicBase.base + 1) * PageBytes);
283 
284  if (apicRange.contains(paddr)) {
285  // The Intel developer's manuals say the below restrictions apply,
286  // but the linux kernel, because of a compiler optimization, breaks
287  // them.
288  /*
289  // Check alignment
290  if (paddr & ((32/8) - 1))
291  return new GeneralProtection(0);
292  // Check access size
293  if (req->getSize() != (32/8))
294  return new GeneralProtection(0);
295  */
296  // Force the access to be uncacheable.
298  req->setPaddr(x86LocalAPICAddress(tc->contextId(),
299  paddr - apicRange.start()));
300  }
301  }
302 
303  return NoFault;
304 }
305 
306 Fault
308  ThreadContext *tc, Translation *translation,
309  Mode mode, bool &delayedResponse, bool timing)
310 {
311  Request::Flags flags = req->getFlags();
312  int seg = flags & SegmentFlagMask;
313  bool storeCheck = flags & (StoreCheck << FlagShift);
314 
315  delayedResponse = false;
316 
317  // If this is true, we're dealing with a request to a non-memory address
318  // space.
319  if (seg == SEGMENT_REG_MS) {
320  return translateInt(mode == Read, req, tc);
321  }
322 
323  Addr vaddr = req->getVaddr();
324  DPRINTF(TLB, "Translating vaddr %#x.\n", vaddr);
325 
326  HandyM5Reg m5Reg = tc->readMiscRegNoEffect(MISCREG_M5_REG);
327 
328  // If protected mode has been enabled...
329  if (m5Reg.prot) {
330  DPRINTF(TLB, "In protected mode.\n");
331  // If we're not in 64-bit mode, do protection/limit checks
332  if (m5Reg.mode != LongMode) {
333  DPRINTF(TLB, "Not in long mode. Checking segment protection.\n");
334  // Check for a NULL segment selector.
335  if (!(seg == SEGMENT_REG_TSG || seg == SYS_SEGMENT_REG_IDTR ||
338  return std::make_shared<GeneralProtection>(0);
339  bool expandDown = false;
341  if (seg >= SEGMENT_REG_ES && seg <= SEGMENT_REG_HS) {
342  if (!attr.writable && (mode == Write || storeCheck))
343  return std::make_shared<GeneralProtection>(0);
344  if (!attr.readable && mode == Read)
345  return std::make_shared<GeneralProtection>(0);
346  expandDown = attr.expandDown;
347 
348  }
351  bool sizeOverride = (flags & (AddrSizeFlagBit << FlagShift));
352  unsigned logSize = sizeOverride ? (unsigned)m5Reg.altAddr
353  : (unsigned)m5Reg.defAddr;
354  int size = (1 << logSize) * 8;
355  Addr offset = bits(vaddr - base, size - 1, 0);
356  Addr endOffset = offset + req->getSize() - 1;
357  if (expandDown) {
358  DPRINTF(TLB, "Checking an expand down segment.\n");
359  warn_once("Expand down segments are untested.\n");
360  if (offset <= limit || endOffset <= limit)
361  return std::make_shared<GeneralProtection>(0);
362  } else {
363  if (offset > limit || endOffset > limit)
364  return std::make_shared<GeneralProtection>(0);
365  }
366  }
367  if (m5Reg.submode != SixtyFourBitMode ||
368  (flags & (AddrSizeFlagBit << FlagShift)))
369  vaddr &= mask(32);
370  // If paging is enabled, do the translation.
371  if (m5Reg.paging) {
372  DPRINTF(TLB, "Paging enabled.\n");
373  // The vaddr already has the segment base applied.
374  TlbEntry *entry = lookup(vaddr);
375  if (mode == Read) {
376  stats.rdAccesses++;
377  } else {
378  stats.wrAccesses++;
379  }
380  if (!entry) {
381  DPRINTF(TLB, "Handling a TLB miss for "
382  "address %#x at pc %#x.\n",
383  vaddr, tc->instAddr());
384  if (mode == Read) {
385  stats.rdMisses++;
386  } else {
387  stats.wrMisses++;
388  }
389  if (FullSystem) {
390  Fault fault = walker->start(tc, translation, req, mode);
391  if (timing || fault != NoFault) {
392  // This gets ignored in atomic mode.
393  delayedResponse = true;
394  return fault;
395  }
396  entry = lookup(vaddr);
397  assert(entry);
398  } else {
399  Process *p = tc->getProcessPtr();
400  const EmulationPageTable::Entry *pte =
401  p->pTable->lookup(vaddr);
402  if (!pte) {
403  return std::make_shared<PageFault>(vaddr, true, mode,
404  true, false);
405  } else {
406  Addr alignedVaddr = p->pTable->pageAlign(vaddr);
407  DPRINTF(TLB, "Mapping %#x to %#x\n", alignedVaddr,
408  pte->paddr);
409  entry = insert(alignedVaddr, TlbEntry(
410  p->pTable->pid(), alignedVaddr, pte->paddr,
413  }
414  DPRINTF(TLB, "Miss was serviced.\n");
415  }
416  }
417 
418  DPRINTF(TLB, "Entry found with paddr %#x, "
419  "doing protection checks.\n", entry->paddr);
420  // Do paging protection checks.
421  bool inUser = (m5Reg.cpl == 3 &&
422  !(flags & (CPL0FlagBit << FlagShift)));
423  CR0 cr0 = tc->readMiscRegNoEffect(MISCREG_CR0);
424  bool badWrite = (!entry->writable && (inUser || cr0.wp));
425  if ((inUser && !entry->user) || (mode == Write && badWrite)) {
426  // The page must have been present to get into the TLB in
427  // the first place. We'll assume the reserved bits are
428  // fine even though we're not checking them.
429  return std::make_shared<PageFault>(vaddr, true, mode, inUser,
430  false);
431  }
432  if (storeCheck && badWrite) {
433  // This would fault if this were a write, so return a page
434  // fault that reflects that happening.
435  return std::make_shared<PageFault>(vaddr, true, Write, inUser,
436  false);
437  }
438 
439  Addr paddr = entry->paddr | (vaddr & mask(entry->logBytes));
440  DPRINTF(TLB, "Translated %#x -> %#x.\n", vaddr, paddr);
441  req->setPaddr(paddr);
442  if (entry->uncacheable)
444  } else {
445  //Use the address which already has segmentation applied.
446  DPRINTF(TLB, "Paging disabled.\n");
447  DPRINTF(TLB, "Translated %#x -> %#x.\n", vaddr, vaddr);
448  req->setPaddr(vaddr);
449  }
450  } else {
451  // Real mode
452  DPRINTF(TLB, "In real mode.\n");
453  DPRINTF(TLB, "Translated %#x -> %#x.\n", vaddr, vaddr);
454  req->setPaddr(vaddr);
455  }
456 
457  return finalizePhysical(req, tc, mode);
458 }
459 
460 Fault
462 {
463  bool delayedResponse;
464  return TLB::translate(req, tc, NULL, mode, delayedResponse, false);
465 }
466 
467 Fault
469 {
470  unsigned logBytes;
471  const Addr vaddr = req->getVaddr();
472  Addr addr = vaddr;
473  Addr paddr = 0;
474  if (FullSystem) {
475  Fault fault = walker->startFunctional(tc, addr, logBytes, mode);
476  if (fault != NoFault)
477  return fault;
478  paddr = insertBits(addr, logBytes - 1, 0, vaddr);
479  } else {
480  Process *process = tc->getProcessPtr();
481  const auto *pte = process->pTable->lookup(vaddr);
482 
483  if (!pte && mode != Execute) {
484  // Check if we just need to grow the stack.
485  if (process->fixupFault(vaddr)) {
486  // If we did, lookup the entry for the new page.
487  pte = process->pTable->lookup(vaddr);
488  }
489  }
490 
491  if (!pte)
492  return std::make_shared<PageFault>(vaddr, true, mode, true, false);
493 
494  paddr = pte->paddr | process->pTable->pageOffset(vaddr);
495  }
496  DPRINTF(TLB, "Translated (functional) %#x -> %#x.\n", vaddr, paddr);
497  req->setPaddr(paddr);
498  return NoFault;
499 }
500 
501 void
503  Translation *translation, Mode mode)
504 {
505  bool delayedResponse;
506  assert(translation);
507  Fault fault =
508  TLB::translate(req, tc, translation, mode, delayedResponse, true);
509  if (!delayedResponse)
510  translation->finish(fault, req, tc, mode);
511  else
512  translation->markDelayed();
513 }
514 
515 Walker *
517 {
518  return walker;
519 }
520 
522  : Stats::Group(parent),
523  ADD_STAT(rdAccesses, "TLB accesses on read requests"),
524  ADD_STAT(wrAccesses, "TLB accesses on write requests"),
525  ADD_STAT(rdMisses, "TLB misses on read requests"),
526  ADD_STAT(wrMisses, "TLB misses on write requests")
527 {
528 }
529 
530 void
532 {
533  // Only store the entries in use.
534  uint32_t _size = size - freeList.size();
535  SERIALIZE_SCALAR(_size);
537 
538  uint32_t _count = 0;
539  for (uint32_t x = 0; x < size; x++) {
540  if (tlb[x].trieHandle != NULL)
541  tlb[x].serializeSection(cp, csprintf("Entry%d", _count++));
542  }
543 }
544 
545 void
547 {
548  // Do not allow to restore with a smaller tlb.
549  uint32_t _size;
550  UNSERIALIZE_SCALAR(_size);
551  if (_size > size) {
552  fatal("TLB size less than the one in checkpoint!");
553  }
554 
556 
557  for (uint32_t x = 0; x < _size; x++) {
558  TlbEntry *newEntry = freeList.front();
559  freeList.pop_front();
560 
561  newEntry->unserializeSection(cp, csprintf("Entry%d", x));
562  newEntry->trieHandle = trie.insert(newEntry->vaddr,
563  TlbEntryTrie::MaxBits - newEntry->logBytes, newEntry);
564  }
565 }
566 
567 Port *
569 {
570  return &walker->getPort("port");
571 }
572 
573 } // namespace X86ISA
574 
575 X86ISA::TLB *
576 X86TLBParams::create()
577 {
578  return new X86ISA::TLB(this);
579 }
X86ISA::MISCREG_M5_REG
@ MISCREG_M5_REG
Definition: misc.hh:137
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:183
ThreadContext::readMiscRegNoEffect
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
BaseTLB::Translation::finish
virtual void finish(const Fault &fault, const RequestPtr &req, ThreadContext *tc, Mode mode)=0
X86ISA::TLB::tlb
std::vector< TlbEntry > tlb
Definition: tlb.hh:95
X86ISA::FlagShift
const int FlagShift
Definition: ldstflags.hh:50
X86ISA::TLB::walker
Walker * walker
Definition: tlb.hh:81
x86_traits.hh
Serializable::unserializeSection
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
Definition: serialize.cc:178
X86ISA::TLB::getWalker
Walker * getWalker()
Definition: tlb.cc:516
EmulationPageTable::Entry
Definition: page_table.hh:51
X86ISA::MISCREG_APIC_BASE
@ MISCREG_APIC_BASE
Definition: misc.hh:393
BaseTLB::Read
@ Read
Definition: tlb.hh:57
data
const char data[]
Definition: circlebuf.test.cc:42
UNSERIALIZE_SCALAR
#define UNSERIALIZE_SCALAR(scalar)
Definition: serialize.hh:797
Packet::writeData
void writeData(uint8_t *p) const
Copy data from the packet to the memory at the provided pointer.
Definition: packet.hh:1254
microldstop.hh
X86ISA::TLB::TlbStats::rdMisses
Stats::Scalar rdMisses
Definition: tlb.hh:109
EmulationPageTable::Uncacheable
@ Uncacheable
Definition: page_table.hh:93
warn_once
#define warn_once(...)
Definition: logging.hh:243
ArmISA::i
Bitfield< 7 > i
Definition: miscregs_types.hh:63
Process
Definition: process.hh:65
X86ISA::PhysAddrPrefixPciConfig
const Addr PhysAddrPrefixPciConfig
Definition: x86_traits.hh:73
X86ISA::Walker::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: pagetable_walker.cc:169
X86ISA::SEGMENT_REG_TSG
@ SEGMENT_REG_TSG
Definition: segment.hh:53
Flags< FlagsType >
Trie::remove
Value * remove(Handle handle)
Method to delete a value from the trie.
Definition: trie.hh:315
X86ISA::TLB::flushAll
void flushAll() override
Remove all entries from the TLB.
Definition: tlb.cc:130
X86ISA::TLB::trie
TlbEntryTrie trie
Definition: tlb.hh:99
X86ISA::TlbEntry
Definition: pagetable.hh:65
htole
T htole(T value)
Definition: byteswap.hh:140
X86ISA::TLB::lruSeq
uint64_t lruSeq
Definition: tlb.hh:100
Trie::insert
Handle insert(Key key, unsigned width, Value *val)
Method which inserts a key/value pair into the trie.
Definition: trie.hh:210
X86ISA::MISCREG_SEG_LIMIT
static MiscRegIndex MISCREG_SEG_LIMIT(int index)
Definition: misc.hh:526
BaseTLB::Mode
Mode
Definition: tlb.hh:57
X86ISA::PhysAddrPrefixIO
const Addr PhysAddrPrefixIO
Definition: x86_traits.hh:72
Process::pTable
EmulationPageTable * pTable
Definition: process.hh:174
pagetable_walker.hh
AddrRange::contains
bool contains(const Addr &a) const
Determine if the range contains an address.
Definition: addr_range.hh:435
RequestPtr
std::shared_ptr< Request > RequestPtr
Definition: request.hh:82
X86ISA::TlbEntry::logBytes
unsigned logBytes
Definition: pagetable.hh:73
X86ISA::base
Bitfield< 51, 12 > base
Definition: pagetable.hh:141
X86ISA::TlbEntry::vaddr
Addr vaddr
Definition: pagetable.hh:71
X86ISA::TLB
Definition: tlb.hh:57
X86ISA::TLB::getTableWalkerPort
Port * getTableWalkerPort() override
Get the table walker port.
Definition: tlb.cc:568
PseudoInst::decodeAddrOffset
static void decodeAddrOffset(Addr offset, uint8_t &func)
Definition: pseudo_inst.hh:81
X86ISA::SYS_SEGMENT_REG_IDTR
@ SYS_SEGMENT_REG_IDTR
Definition: segment.hh:60
FullSystem
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
Definition: root.cc:132
Packet::getSize
unsigned getSize() const
Definition: packet.hh:764
ThreadContext::getProcessPtr
virtual Process * getProcessPtr()=0
X86ISA::TLB::translateInt
Fault translateInt(bool read, RequestPtr req, ThreadContext *tc)
Definition: tlb.cc:195
mbits
T mbits(T val, int first, int last)
Mask off the given bits in place like bits() but without shifting.
Definition: bitfield.hh:104
X86ISA::TlbEntry::uncacheable
bool uncacheable
Definition: pagetable.hh:84
X86ISA::x
Bitfield< 1 > x
Definition: types.hh:103
EmulationPageTable::Entry::flags
uint64_t flags
Definition: page_table.hh:54
faults.hh
Trie::lookup
Value * lookup(Key key)
Method which looks up the Value corresponding to a particular key.
Definition: trie.hh:298
X86ISA::msrAddrToIndex
bool msrAddrToIndex(MiscRegIndex &regNum, Addr addr)
Find and return the misc reg corresponding to an MSR address.
Definition: msr.cc:147
X86ISA::IntAddrPrefixIO
const Addr IntAddrPrefixIO
Definition: x86_traits.hh:70
X86ISA::SEGMENT_REG_LS
@ SEGMENT_REG_LS
Definition: segment.hh:54
request.hh
X86ISA::IntAddrPrefixMask
const Addr IntAddrPrefixMask
Definition: x86_traits.hh:67
BaseTLB
Definition: tlb.hh:50
EmulationPageTable::lookup
const Entry * lookup(Addr vaddr)
Lookup function.
Definition: page_table.cc:130
Packet::setData
void setData(const uint8_t *p)
Copy data into the packet from the provided pointer.
Definition: packet.hh:1225
X86ISA::SEGMENT_REG_HS
@ SEGMENT_REG_HS
Definition: segment.hh:51
X86ISA::MISCREG_SEG_SEL
static MiscRegIndex MISCREG_SEG_SEL(int index)
Definition: misc.hh:505
X86ISA::TLB::translate
Fault translate(const RequestPtr &req, ThreadContext *tc, Translation *translation, Mode mode, bool &delayedResponse, bool timing)
Definition: tlb.cc:307
X86ISA::TlbEntry::trieHandle
TlbEntryTrie::Handle trieHandle
Definition: pagetable.hh:94
X86ISA::system
Bitfield< 15 > system
Definition: misc.hh:997
pseudo_inst.hh
Request::STRICT_ORDER
@ STRICT_ORDER
The request is required to be strictly ordered by CPU models and is non-speculative.
Definition: request.hh:124
X86ISA::TlbEntry::paddr
Addr paddr
Definition: pagetable.hh:68
X86ISA::TLB::flushNonGlobal
void flushNonGlobal()
Definition: tlb.cc:149
X86ISA::TLB::m5opRange
AddrRange m5opRange
Definition: tlb.hh:102
letoh
T letoh(T value)
Definition: byteswap.hh:141
X86ISA::expandDown
Bitfield< 14 > expandDown
Definition: misc.hh:996
cp
Definition: cprintf.cc:40
Trie< Addr, X86ISA::TlbEntry >::MaxBits
static const unsigned MaxBits
Definition: trie.hh:133
X86ISA::Walker::startFunctional
Fault startFunctional(ThreadContext *_tc, Addr &addr, unsigned &logBytes, BaseTLB::Mode mode)
Definition: pagetable_walker.cc:93
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
X86ISA::SEGMENT_REG_MS
@ SEGMENT_REG_MS
Definition: segment.hh:55
AddrRange
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
Definition: addr_range.hh:68
X86ISA::Walker::start
Fault start(ThreadContext *_tc, BaseTLB::Translation *translation, const RequestPtr &req, BaseTLB::Mode mode)
Definition: pagetable_walker.cc:68
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:234
ADD_STAT
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
Definition: group.hh:67
X86ISA::TLB::insert
TlbEntry * insert(Addr vpn, const TlbEntry &entry)
Definition: tlb.cc:97
Fault
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
MipsISA::vaddr
vaddr
Definition: pra_constants.hh:275
msr.hh
X86ISA::SegmentFlagMask
const Request::FlagsType M5_VAR_USED SegmentFlagMask
Definition: ldstflags.hh:49
X86ISA::TLB::TLB
TLB(const Params *p)
Definition: tlb.cc:62
Port
Ports are used to interface objects to each other.
Definition: port.hh:56
X86ISA::TLB::TlbStats::wrAccesses
Stats::Scalar wrAccesses
Definition: tlb.hh:108
process.hh
X86ISA::TlbEntry::writable
bool writable
Definition: pagetable.hh:77
X86ISA::PageBytes
const Addr PageBytes
Definition: isa_traits.hh:48
ArmISA::mode
Bitfield< 4, 0 > mode
Definition: miscregs_types.hh:70
X86ISA::Walker
Definition: pagetable_walker.hh:56
X86ISA::TLB::configAddress
uint32_t configAddress
Definition: tlb.hh:64
ArmISA::attr
attr
Definition: miscregs_types.hh:649
X86ISA::TLB::translateTiming
void translateTiming(const RequestPtr &req, ThreadContext *tc, Translation *translation, Mode mode) override
Definition: tlb.cc:502
X86ISA::TlbEntry::lruSeq
uint64_t lruSeq
Definition: pagetable.hh:92
BaseTLB::Translation
Definition: tlb.hh:59
X86ISA::TLB::TlbStats::rdAccesses
Stats::Scalar rdAccesses
Definition: tlb.hh:107
ThreadContext::contextId
virtual ContextID contextId() const =0
X86ISA::TLB::Params
X86TLBParams Params
Definition: tlb.hh:68
X86ISA::MISCREG_SEG_ATTR
static MiscRegIndex MISCREG_SEG_ATTR(int index)
Definition: misc.hh:533
X86ISA::TLB::evictLRU
void evictLRU()
Definition: tlb.cc:79
X86ISA::TLB::lookup
TlbEntry * lookup(Addr va, bool update_lru=true)
Definition: tlb.cc:121
Request::UNCACHEABLE
@ UNCACHEABLE
The request is to an uncacheable address.
Definition: request.hh:114
X86ISA::TLB::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: tlb.cc:546
NoFault
constexpr decltype(nullptr) NoFault
Definition: types.hh:245
X86ISA::MISCREG_PCI_CONFIG_ADDRESS
@ MISCREG_PCI_CONFIG_ADDRESS
Definition: misc.hh:396
EmulationPageTable::pageOffset
Addr pageOffset(Addr a)
Definition: page_table.hh:106
X86ISA
This is exposed globally, independent of the ISA.
Definition: acpi.hh:55
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
X86ISA::TLB::demapPage
void demapPage(Addr va, uint64_t asn) override
Definition: tlb.cc:162
X86ISA::TLB::setConfigAddress
void setConfigAddress(uint32_t addr)
Definition: tlb.cc:143
SERIALIZE_SCALAR
#define SERIALIZE_SCALAR(scalar)
Definition: serialize.hh:790
packet_access.hh
full_system.hh
X86ISA::x86LocalAPICAddress
static Addr x86LocalAPICAddress(const uint8_t id, const uint16_t addr)
Definition: x86_traits.hh:93
X86ISA::offset
offset
Definition: misc.hh:1024
X86ISA::IntAddrPrefixMSR
const Addr IntAddrPrefixMSR
Definition: x86_traits.hh:69
pseudo_inst_abi.hh
X86ISA::TLB::stats
X86ISA::TLB::TlbStats stats
X86ISA::TLB::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: tlb.cc:531
X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:79
BaseTLB::Write
@ Write
Definition: tlb.hh:57
X86ISA::Walker::setTLB
void setTLB(TLB *_tlb)
Definition: pagetable_walker.hh:191
EmulationPageTable::ReadOnly
@ ReadOnly
Definition: page_table.hh:94
X86ISA::TLB::finalizePhysical
Fault finalizePhysical(const RequestPtr &req, ThreadContext *tc, Mode mode) const override
Do post-translation physical address finalization.
Definition: tlb.cc:258
BaseTLB::Translation::markDelayed
virtual void markDelayed()=0
Signal that the translation has been delayed due to a hw page table walk.
X86ISA::StoreCheck
@ StoreCheck
Definition: ldstflags.hh:54
AddrRange::start
Addr start() const
Get the start address of the range.
Definition: addr_range.hh:314
X86ISA::p
Bitfield< 0 > p
Definition: pagetable.hh:151
X86ISA::TLB::nextSeq
uint64_t nextSeq()
Definition: tlb.hh:124
insertBits
T insertBits(T val, int first, int last, B bit_val)
Returns val with bits first to last set to the LSBs of bit_val.
Definition: bitfield.hh:147
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
Stats::Group
Statistics container.
Definition: group.hh:83
ThreadContext::readMiscReg
virtual RegVal readMiscReg(RegIndex misc_reg)=0
EmulationPageTable::Entry::paddr
Addr paddr
Definition: page_table.hh:53
X86ISA::MISCREG_CR0
@ MISCREG_CR0
Definition: misc.hh:105
ThreadContext::setMiscReg
virtual void setMiscReg(RegIndex misc_reg, RegVal val)=0
X86ISA::TLB::translateFunctional
Fault translateFunctional(const RequestPtr &req, ThreadContext *tc, Mode mode) override
Definition: tlb.cc:468
X86ISA::SEGMENT_REG_ES
@ SEGMENT_REG_ES
Definition: segment.hh:45
Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
X86ISA::limit
BitfieldType< SegDescriptorLimit > limit
Definition: misc.hh:924
Packet::setLE
void setLE(T v)
Set the value in the data pointer to v as little endian.
Definition: packet_access.hh:105
X86ISA::TLB::freeList
EntryList freeList
Definition: tlb.hh:97
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:63
X86ISA::mask
mask
Definition: misc.hh:796
X86ISA::AddrSizeFlagBit
@ AddrSizeFlagBit
Definition: ldstflags.hh:53
Stats
Definition: statistics.cc:61
X86ISA::MISCREG_SEG_BASE
static MiscRegIndex MISCREG_SEG_BASE(int index)
Definition: misc.hh:512
Process::fixupFault
bool fixupFault(Addr vaddr)
Attempt to fix up a fault at vaddr by allocating a page on the stack.
Definition: process.cc:348
trace.hh
X86ISA::SixtyFourBitMode
@ SixtyFourBitMode
Definition: types.hh:190
tlb.hh
X86ISA::TLB::TlbStats::TlbStats
TlbStats(Stats::Group *parent)
Definition: tlb.cc:521
page_table.hh
X86ISA::TLB::TlbStats::wrMisses
Stats::Scalar wrMisses
Definition: tlb.hh:110
CheckpointIn
Definition: serialize.hh:67
BaseTLB::Execute
@ Execute
Definition: tlb.hh:57
ThreadContext::instAddr
virtual Addr instAddr() const =0
X86ISA::TLB::size
uint32_t size
Definition: tlb.hh:93
ArmISA::tlb
Bitfield< 59, 56 > tlb
Definition: miscregs_types.hh:88
misc.hh
csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:158
X86ISA::TLB::translateAtomic
Fault translateAtomic(const RequestPtr &req, ThreadContext *tc, Mode mode) override
Definition: tlb.cc:461
thread_context.hh
X86ISA::CPL0FlagBit
@ CPL0FlagBit
Definition: ldstflags.hh:52
X86ISA::seg
Bitfield< 2, 0 > seg
Definition: types.hh:82
RegVal
uint64_t RegVal
Definition: types.hh:168
ArmISA::va
Bitfield< 8 > va
Definition: miscregs_types.hh:272
X86ISA::MiscRegIndex
MiscRegIndex
Definition: misc.hh:100
X86ISA::TlbEntry::user
bool user
Definition: pagetable.hh:79
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:171
X86ISA::IntAddrPrefixCPUID
const Addr IntAddrPrefixCPUID
Definition: x86_traits.hh:68
bits
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition: bitfield.hh:75

Generated on Wed Sep 30 2020 14:01:59 for gem5 by doxygen 1.8.17