gem5  v22.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 gem5
61 {
62 
63 namespace X86ISA {
64 
65 TLB::TLB(const Params &p)
66  : BaseTLB(p), configAddress(0), size(p.size),
67  tlb(size), lruSeq(0), m5opRange(p.system->m5opRange()), stats(this)
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);
79 }
80 
81 void
83 {
84  // Find the entry with the lowest (and hence least recently updated)
85  // sequence number.
86 
87  unsigned lru = 0;
88  for (unsigned i = 1; i < size; i++) {
89  if (tlb[i].lruSeq < tlb[lru].lruSeq)
90  lru = i;
91  }
92 
93  assert(tlb[lru].trieHandle);
94  trie.remove(tlb[lru].trieHandle);
95  tlb[lru].trieHandle = NULL;
96  freeList.push_back(&tlb[lru]);
97 }
98 
99 TlbEntry *
100 TLB::insert(Addr vpn, const TlbEntry &entry, uint64_t pcid)
101 {
102  //Adding pcid to the page address so
103  //that multiple processes using the same
104  //tlb do not conflict when using the same
105  //virtual addresses
106  vpn = concAddrPcid(vpn, pcid);
107 
108  // If somebody beat us to it, just use that existing entry.
109  TlbEntry *newEntry = trie.lookup(vpn);
110  if (newEntry) {
111  assert(newEntry->vaddr == vpn);
112  return newEntry;
113  }
114 
115  if (freeList.empty())
116  evictLRU();
117 
118  newEntry = freeList.front();
119  freeList.pop_front();
120 
121  *newEntry = entry;
122  newEntry->lruSeq = nextSeq();
123  newEntry->vaddr = vpn;
124  if (FullSystem) {
125  newEntry->trieHandle =
126  trie.insert(vpn, TlbEntryTrie::MaxBits-entry.logBytes, newEntry);
127  }
128  else {
129  newEntry->trieHandle =
130  trie.insert(vpn, TlbEntryTrie::MaxBits, newEntry);
131  }
132  return newEntry;
133 }
134 
135 TlbEntry *
136 TLB::lookup(Addr va, bool update_lru)
137 {
138  TlbEntry *entry = trie.lookup(va);
139  if (entry && update_lru)
140  entry->lruSeq = nextSeq();
141  return entry;
142 }
143 
144 void
146 {
147  DPRINTF(TLB, "Invalidating all entries.\n");
148  for (unsigned i = 0; i < size; i++) {
149  if (tlb[i].trieHandle) {
150  trie.remove(tlb[i].trieHandle);
151  tlb[i].trieHandle = NULL;
152  freeList.push_back(&tlb[i]);
153  }
154  }
155 }
156 
157 void
159 {
161 }
162 
163 void
165 {
166  DPRINTF(TLB, "Invalidating all non global entries.\n");
167  for (unsigned i = 0; i < size; i++) {
168  if (tlb[i].trieHandle && !tlb[i].global) {
169  trie.remove(tlb[i].trieHandle);
170  tlb[i].trieHandle = NULL;
171  freeList.push_back(&tlb[i]);
172  }
173  }
174 }
175 
176 void
177 TLB::demapPage(Addr va, uint64_t asn)
178 {
179  TlbEntry *entry = trie.lookup(va);
180  if (entry) {
181  trie.remove(entry->trieHandle);
182  entry->trieHandle = NULL;
183  freeList.push_back(entry);
184  }
185 }
186 
187 namespace
188 {
189 
190 Cycles
191 localMiscRegAccess(bool read, RegIndex regNum,
192  ThreadContext *tc, PacketPtr pkt)
193 {
194  if (read) {
195  RegVal data = htole(tc->readMiscReg(regNum));
196  assert(pkt->getSize() <= sizeof(RegVal));
197  pkt->setData((uint8_t *)&data);
198  } else {
199  RegVal data = htole(tc->readMiscRegNoEffect(regNum));
200  assert(pkt->getSize() <= sizeof(RegVal));
201  pkt->writeData((uint8_t *)&data);
202  tc->setMiscReg(regNum, letoh(data));
203  }
204  return Cycles(1);
205 }
206 
207 } // anonymous namespace
208 
209 Fault
211 {
212  DPRINTF(TLB, "Addresses references internal memory.\n");
213  Addr vaddr = req->getVaddr();
214  Addr prefix = (vaddr >> 3) & IntAddrPrefixMask;
215  if (prefix == IntAddrPrefixCPUID) {
216  panic("CPUID memory space not yet implemented!\n");
217  } else if (prefix == IntAddrPrefixMSR) {
218  vaddr = (vaddr >> 3) & ~IntAddrPrefixMask;
219 
220  RegIndex regNum;
221  if (!msrAddrToIndex(regNum, vaddr))
222  return std::make_shared<GeneralProtection>(0);
223 
224  req->setPaddr(req->getVaddr());
225  req->setLocalAccessor(
226  [read,regNum](ThreadContext *tc, PacketPtr pkt)
227  {
228  return localMiscRegAccess(read, regNum, tc, pkt);
229  }
230  );
231 
232  return NoFault;
233  } else if (prefix == IntAddrPrefixIO) {
234  // TODO If CPL > IOPL or in virtual mode, check the I/O permission
235  // bitmap in the TSS.
236 
237  Addr IOPort = vaddr & ~IntAddrPrefixMask;
238  // Make sure the address fits in the expected 16 bit IO address
239  // space.
240  assert(!(IOPort & ~0xFFFF));
241  if (IOPort == 0xCF8 && req->getSize() == 4) {
242  req->setPaddr(req->getVaddr());
243  req->setLocalAccessor(
244  [read](ThreadContext *tc, PacketPtr pkt)
245  {
246  return localMiscRegAccess(
247  read, misc_reg::PciConfigAddress, tc, pkt);
248  }
249  );
250  } else if ((IOPort & ~mask(2)) == 0xCFC) {
254  if (bits(configAddress, 31, 31)) {
255  req->setPaddr(PhysAddrPrefixPciConfig |
256  mbits(configAddress, 30, 2) |
257  (IOPort & mask(2)));
258  } else {
259  req->setPaddr(PhysAddrPrefixIO | IOPort);
260  }
261  } else {
263  req->setPaddr(PhysAddrPrefixIO | IOPort);
264  }
265  return NoFault;
266  } else {
267  panic("Access to unrecognized internal address space %#x.\n",
268  prefix);
269  }
270 }
271 
272 Fault
274  ThreadContext *tc, BaseMMU::Mode mode) const
275 {
276  Addr paddr = req->getPaddr();
277 
278  if (m5opRange.contains(paddr)) {
279  req->setFlags(Request::STRICT_ORDER);
280  uint8_t func;
282  req->setLocalAccessor(
283  [func, mode](ThreadContext *tc, PacketPtr pkt) -> Cycles
284  {
285  uint64_t ret;
286  pseudo_inst::pseudoInst<X86PseudoInstABI, true>(tc, func, ret);
287  if (mode == BaseMMU::Read)
288  pkt->setLE(ret);
289  return Cycles(1);
290  }
291  );
292  } else if (FullSystem) {
293  // Check for an access to the local APIC
294  LocalApicBase localApicBase =
296  AddrRange apicRange(localApicBase.base * PageBytes,
297  (localApicBase.base + 1) * PageBytes);
298 
299  if (apicRange.contains(paddr)) {
300  // The Intel developer's manuals say the below restrictions apply,
301  // but the linux kernel, because of a compiler optimization, breaks
302  // them.
303  /*
304  // Check alignment
305  if (paddr & ((32/8) - 1))
306  return new GeneralProtection(0);
307  // Check access size
308  if (req->getSize() != (32/8))
309  return new GeneralProtection(0);
310  */
311  // Force the access to be uncacheable.
313  req->setPaddr(x86LocalAPICAddress(tc->contextId(),
314  paddr - apicRange.start()));
315  }
316  }
317 
318  return NoFault;
319 }
320 
321 Fault
323  ThreadContext *tc, BaseMMU::Translation *translation,
324  BaseMMU::Mode mode, bool &delayedResponse, bool timing)
325 {
326  Request::Flags flags = req->getFlags();
327  int seg = flags & SegmentFlagMask;
328  bool storeCheck = flags & Request::READ_MODIFY_WRITE;
329 
330  delayedResponse = false;
331 
332  // If this is true, we're dealing with a request to a non-memory address
333  // space.
334  if (seg == segment_idx::Ms) {
335  return translateInt(mode == BaseMMU::Read, req, tc);
336  }
337 
338  Addr vaddr = req->getVaddr();
339  DPRINTF(TLB, "Translating vaddr %#x.\n", vaddr);
340 
341  HandyM5Reg m5Reg = tc->readMiscRegNoEffect(misc_reg::M5Reg);
342 
343  const Addr logAddrSize = (flags >> AddrSizeFlagShift) & AddrSizeFlagMask;
344  const int addrSize = 8 << logAddrSize;
345  const Addr addrMask = mask(addrSize);
346 
347  // If protected mode has been enabled...
348  if (m5Reg.prot) {
349  DPRINTF(TLB, "In protected mode.\n");
350  // If we're not in 64-bit mode, do protection/limit checks
351  if (m5Reg.mode != LongMode) {
352  DPRINTF(TLB, "Not in long mode. Checking segment protection.\n");
353 
354  // CPUs won't know to use CS when building fetch requests, so we
355  // need to override the value of "seg" here if this is a fetch.
356  if (mode == BaseMMU::Execute)
358 
360  // Check for an unusable segment.
361  if (attr.unusable) {
362  DPRINTF(TLB, "Unusable segment.\n");
363  return std::make_shared<GeneralProtection>(0);
364  }
365  bool expandDown = false;
366  if (seg >= segment_idx::Es && seg <= segment_idx::Hs) {
367  if (!attr.writable && (mode == BaseMMU::Write || storeCheck)) {
368  DPRINTF(TLB, "Tried to write to unwritable segment.\n");
369  return std::make_shared<GeneralProtection>(0);
370  }
371  if (!attr.readable && mode == BaseMMU::Read) {
372  DPRINTF(TLB, "Tried to read from unreadble segment.\n");
373  return std::make_shared<GeneralProtection>(0);
374  }
375  expandDown = attr.expandDown;
376 
377  }
380  Addr offset;
381  if (mode == BaseMMU::Execute)
382  offset = vaddr - base;
383  else
384  offset = (vaddr - base) & addrMask;
385  Addr endOffset = offset + req->getSize() - 1;
386  if (expandDown) {
387  DPRINTF(TLB, "Checking an expand down segment.\n");
388  warn_once("Expand down segments are untested.\n");
389  if (offset <= limit || endOffset <= limit)
390  return std::make_shared<GeneralProtection>(0);
391  } else {
392  if (offset > limit || endOffset > limit) {
393  DPRINTF(TLB, "Segment limit check failed, "
394  "offset = %#x limit = %#x.\n", offset, limit);
395  return std::make_shared<GeneralProtection>(0);
396  }
397  }
398  }
399  if (m5Reg.submode != SixtyFourBitMode && addrSize != 64)
400  vaddr &= mask(32);
401  // If paging is enabled, do the translation.
402  if (m5Reg.paging) {
403  DPRINTF(TLB, "Paging enabled.\n");
404  // The vaddr already has the segment base applied.
405 
406  //Appending the pcid (last 12 bits of CR3) to the
407  //page aligned vaddr if pcide is set
408  CR4 cr4 = tc->readMiscRegNoEffect(misc_reg::Cr4);
409  Addr pageAlignedVaddr = vaddr & (~mask(X86ISA::PageShift));
410  CR3 cr3 = tc->readMiscRegNoEffect(misc_reg::Cr3);
411  uint64_t pcid;
412 
413  if (cr4.pcide)
414  pcid = cr3.pcid;
415  else
416  pcid = 0x000;
417 
418  pageAlignedVaddr = concAddrPcid(pageAlignedVaddr, pcid);
419  TlbEntry *entry = lookup(pageAlignedVaddr);
420 
421  if (mode == BaseMMU::Read) {
422  stats.rdAccesses++;
423  } else {
424  stats.wrAccesses++;
425  }
426  if (!entry) {
427  DPRINTF(TLB, "Handling a TLB miss for "
428  "address %#x at pc %#x.\n",
429  vaddr, tc->pcState().instAddr());
430  if (mode == BaseMMU::Read) {
431  stats.rdMisses++;
432  } else {
433  stats.wrMisses++;
434  }
435  if (FullSystem) {
436  Fault fault = walker->start(tc, translation, req, mode);
437  if (timing || fault != NoFault) {
438  // This gets ignored in atomic mode.
439  delayedResponse = true;
440  return fault;
441  }
442  entry = lookup(pageAlignedVaddr);
443  assert(entry);
444  } else {
445  Process *p = tc->getProcessPtr();
446  const EmulationPageTable::Entry *pte =
447  p->pTable->lookup(vaddr);
448  if (!pte) {
449  return std::make_shared<PageFault>(vaddr, true, mode,
450  true, false);
451  } else {
452  Addr alignedVaddr = p->pTable->pageAlign(vaddr);
453  DPRINTF(TLB, "Mapping %#x to %#x\n", alignedVaddr,
454  pte->paddr);
455  entry = insert(alignedVaddr, TlbEntry(
456  p->pTable->pid(), alignedVaddr, pte->paddr,
459  pcid);
460  }
461  DPRINTF(TLB, "Miss was serviced.\n");
462  }
463  }
464 
465  DPRINTF(TLB, "Entry found with paddr %#x, "
466  "doing protection checks.\n", entry->paddr);
467  // Do paging protection checks.
468  bool inUser = m5Reg.cpl == 3 && !(flags & CPL0FlagBit);
469  CR0 cr0 = tc->readMiscRegNoEffect(misc_reg::Cr0);
470  bool badWrite = (!entry->writable && (inUser || cr0.wp));
471  if ((inUser && !entry->user) ||
472  (mode == BaseMMU::Write && badWrite)) {
473  // The page must have been present to get into the TLB in
474  // the first place. We'll assume the reserved bits are
475  // fine even though we're not checking them.
476  return std::make_shared<PageFault>(vaddr, true, mode, inUser,
477  false);
478  }
479  if (storeCheck && badWrite) {
480  // This would fault if this were a write, so return a page
481  // fault that reflects that happening.
482  return std::make_shared<PageFault>(
483  vaddr, true, BaseMMU::Write, inUser, false);
484  }
485 
486  Addr paddr = entry->paddr | (vaddr & mask(entry->logBytes));
487  DPRINTF(TLB, "Translated %#x -> %#x.\n", vaddr, paddr);
488  req->setPaddr(paddr);
489  if (entry->uncacheable)
491  } else {
492  //Use the address which already has segmentation applied.
493  DPRINTF(TLB, "Paging disabled.\n");
494  DPRINTF(TLB, "Translated %#x -> %#x.\n", vaddr, vaddr);
495  req->setPaddr(vaddr);
496  }
497  } else {
498  // Real mode
499  DPRINTF(TLB, "In real mode.\n");
500  DPRINTF(TLB, "Translated %#x -> %#x.\n", vaddr, vaddr);
501  req->setPaddr(vaddr);
502  }
503 
504  return finalizePhysical(req, tc, mode);
505 }
506 
507 Fault
510 {
511  bool delayedResponse;
512  return TLB::translate(req, tc, NULL, mode, delayedResponse, false);
513 }
514 
515 Fault
518 {
519  unsigned logBytes;
520  const Addr vaddr = req->getVaddr();
521  Addr addr = vaddr;
522  Addr paddr = 0;
523  if (FullSystem) {
524  Fault fault = walker->startFunctional(tc, addr, logBytes, mode);
525  if (fault != NoFault)
526  return fault;
527  paddr = insertBits(addr, logBytes - 1, 0, vaddr);
528  } else {
529  Process *process = tc->getProcessPtr();
530  const auto *pte = process->pTable->lookup(vaddr);
531 
532  if (!pte && mode != BaseMMU::Execute) {
533  // Check if we just need to grow the stack.
534  if (process->fixupFault(vaddr)) {
535  // If we did, lookup the entry for the new page.
536  pte = process->pTable->lookup(vaddr);
537  }
538  }
539 
540  if (!pte)
541  return std::make_shared<PageFault>(vaddr, true, mode, true, false);
542 
543  paddr = pte->paddr | process->pTable->pageOffset(vaddr);
544  }
545  DPRINTF(TLB, "Translated (functional) %#x -> %#x.\n", vaddr, paddr);
546  req->setPaddr(paddr);
547  return NoFault;
548 }
549 
550 void
553 {
554  bool delayedResponse;
555  assert(translation);
556  Fault fault =
557  TLB::translate(req, tc, translation, mode, delayedResponse, true);
558  if (!delayedResponse)
559  translation->finish(fault, req, tc, mode);
560  else
561  translation->markDelayed();
562 }
563 
564 Walker *
566 {
567  return walker;
568 }
569 
571  : statistics::Group(parent),
572  ADD_STAT(rdAccesses, statistics::units::Count::get(),
573  "TLB accesses on read requests"),
574  ADD_STAT(wrAccesses, statistics::units::Count::get(),
575  "TLB accesses on write requests"),
576  ADD_STAT(rdMisses, statistics::units::Count::get(),
577  "TLB misses on read requests"),
578  ADD_STAT(wrMisses, statistics::units::Count::get(),
579  "TLB misses on write requests")
580 {
581 }
582 
583 void
585 {
586  // Only store the entries in use.
587  uint32_t _size = size - freeList.size();
588  SERIALIZE_SCALAR(_size);
590 
591  uint32_t _count = 0;
592  for (uint32_t x = 0; x < size; x++) {
593  if (tlb[x].trieHandle != NULL)
594  tlb[x].serializeSection(cp, csprintf("Entry%d", _count++));
595  }
596 }
597 
598 void
600 {
601  // Do not allow to restore with a smaller tlb.
602  uint32_t _size;
603  UNSERIALIZE_SCALAR(_size);
604  if (_size > size) {
605  fatal("TLB size less than the one in checkpoint!");
606  }
607 
609 
610  for (uint32_t x = 0; x < _size; x++) {
611  TlbEntry *newEntry = freeList.front();
612  freeList.pop_front();
613 
614  newEntry->unserializeSection(cp, csprintf("Entry%d", x));
615  newEntry->trieHandle = trie.insert(newEntry->vaddr,
616  TlbEntryTrie::MaxBits - newEntry->logBytes, newEntry);
617  }
618 }
619 
620 Port *
622 {
623  return &walker->getPort("port");
624 }
625 
626 } // namespace X86ISA
627 } // namespace gem5
#define DPRINTF(x,...)
Definition: trace.hh:186
const char data[]
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
Definition: addr_range.hh:82
virtual void finish(const Fault &fault, const RequestPtr &req, ThreadContext *tc, BaseMMU::Mode mode)=0
virtual void markDelayed()=0
Signal that the translation has been delayed due to a hw page table walk.
@ Execute
Definition: mmu.hh:56
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:79
const Entry * lookup(Addr vaddr)
Lookup function.
Definition: page_table.cc:133
Addr instAddr() const
Returns the memory address of the instruction this PC points to.
Definition: pcstate.hh:107
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
void setLE(T v)
Set the value in the data pointer to v as little endian.
void setData(const uint8_t *p)
Copy data into the packet from the provided pointer.
Definition: packet.hh:1280
unsigned getSize() const
Definition: packet.hh:815
void writeData(uint8_t *p) const
Copy data from the packet to the memory at the provided pointer.
Definition: packet.hh:1309
Ports are used to interface objects to each other.
Definition: port.hh:62
bool fixupFault(Addr vaddr)
Attempt to fix up a fault at vaddr by allocating a page on the stack.
Definition: process.cc:365
EmulationPageTable * pTable
Definition: process.hh:185
@ STRICT_ORDER
The request is required to be strictly ordered by CPU models and is non-speculative.
Definition: request.hh:135
@ UNCACHEABLE
The request is to an uncacheable address.
Definition: request.hh:125
@ READ_MODIFY_WRITE
This request is a read which will be followed by a write.
Definition: request.hh:161
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual RegVal readMiscReg(RegIndex misc_reg)=0
virtual void setMiscReg(RegIndex misc_reg, RegVal val)=0
virtual const PCStateBase & pcState() const =0
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
virtual ContextID contextId() const =0
virtual Process * getProcessPtr()=0
TlbEntry * lookup(Addr va, bool update_lru=true)
Definition: tlb.cc:136
Walker * walker
Definition: tlb.hh:89
Fault finalizePhysical(const RequestPtr &req, ThreadContext *tc, BaseMMU::Mode mode) const override
Do post-translation physical address finalization.
Definition: tlb.cc:273
void flushAll() override
Remove all entries from the TLB.
Definition: tlb.cc:145
uint32_t size
Definition: tlb.hh:101
TlbEntryTrie trie
Definition: tlb.hh:107
uint64_t lruSeq
Definition: tlb.hh:108
uint32_t configAddress
Definition: tlb.hh:67
void evictLRU()
Definition: tlb.cc:94
void translateTiming(const RequestPtr &req, ThreadContext *tc, BaseMMU::Translation *translation, BaseMMU::Mode mode) override
Definition: tlb.cc:551
Fault translateAtomic(const RequestPtr &req, ThreadContext *tc, BaseMMU::Mode mode) override
Definition: tlb.cc:508
void setConfigAddress(uint32_t addr)
Definition: tlb.cc:158
Addr concAddrPcid(Addr vpn, uint64_t pcid)
Definition: tlb.hh:80
Fault translateInt(bool read, RequestPtr req, ThreadContext *tc)
Definition: tlb.cc:210
void flushNonGlobal()
Definition: tlb.cc:164
TLB(const Params &p)
Definition: tlb.cc:65
gem5::X86ISA::TLB::TlbStats stats
TlbEntry * insert(Addr vpn, const TlbEntry &entry, uint64_t pcid)
Definition: tlb.cc:100
Walker * getWalker()
Definition: tlb.cc:88
AddrRange m5opRange
Definition: tlb.hh:110
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: tlb.cc:584
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: tlb.cc:599
X86TLBParams Params
Definition: tlb.hh:71
Port * getTableWalkerPort() override
Get the table walker port.
Definition: tlb.cc:621
std::vector< TlbEntry > tlb
Definition: tlb.hh:103
void demapPage(Addr va, uint64_t asn) override
Definition: tlb.cc:177
Fault translate(const RequestPtr &req, ThreadContext *tc, BaseMMU::Translation *translation, BaseMMU::Mode mode, bool &delayedResponse, bool timing)
Definition: tlb.cc:322
EntryList freeList
Definition: tlb.hh:105
Fault translateFunctional(const RequestPtr &req, ThreadContext *tc, BaseMMU::Mode mode) override
Definition: tlb.cc:516
uint64_t nextSeq()
Definition: tlb.hh:133
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Fault start(ThreadContext *_tc, BaseMMU::Translation *translation, const RequestPtr &req, BaseMMU::Mode mode)
Fault startFunctional(ThreadContext *_tc, Addr &addr, unsigned &logBytes, BaseMMU::Mode mode)
void setTLB(TLB *_tlb)
Statistics container.
Definition: group.hh:94
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
Definition: group.hh:75
bool contains(const Addr &a) const
Determine if the range contains an address.
Definition: addr_range.hh:471
Addr start() const
Get the start address of the range.
Definition: addr_range.hh:343
static const unsigned MaxBits
Definition: trie.hh:135
Handle insert(Key key, unsigned width, Value *val)
Method which inserts a key/value pair into the trie.
Definition: trie.hh:212
Value * lookup(Key key)
Method which looks up the Value corresponding to a particular key.
Definition: trie.hh:300
Value * remove(Handle handle)
Method to delete a value from the trie.
Definition: trie.hh:317
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition: bitfield.hh:76
constexpr T mbits(T val, unsigned first, unsigned last)
Mask off the given bits in place like bits() but without shifting.
Definition: bitfield.hh:103
constexpr T insertBits(T val, unsigned first, unsigned last, B bit_val)
Returns val with bits first to last set to the LSBs of bit_val.
Definition: bitfield.hh:166
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:178
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:190
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
Definition: serialize.cc:81
uint8_t flags
Definition: helpers.cc:66
#define warn_once(...)
Definition: logging.hh:250
Bitfield< 7 > i
Definition: misc_types.hh:67
Bitfield< 8 > va
Definition: misc_types.hh:282
Bitfield< 59, 56 > tlb
Definition: misc_types.hh:92
static RegIndex segAttr(int index)
Definition: misc.hh:533
static RegIndex segBase(int index)
Definition: misc.hh:512
static RegIndex segLimit(int index)
Definition: misc.hh:526
constexpr auto AddrSizeFlagMask
Definition: ldstflags.hh:58
Bitfield< 15 > system
Definition: misc.hh:1004
const Addr PhysAddrPrefixPciConfig
Definition: x86_traits.hh:68
Bitfield< 51, 12 > base
Definition: pagetable.hh:141
Bitfield< 14 > expandDown
Definition: misc.hh:1003
const Addr IntAddrPrefixIO
Definition: x86_traits.hh:65
constexpr auto AddrSizeFlagShift
Definition: ldstflags.hh:57
constexpr Request::FlagsType SegmentFlagMask
Definition: ldstflags.hh:54
BitfieldType< SegDescriptorLimit > limit
Definition: misc.hh:931
const Addr PageShift
Definition: page_size.hh:48
Bitfield< 3 > addr
Definition: types.hh:84
Bitfield< 2, 0 > seg
Definition: types.hh:87
const Addr PhysAddrPrefixIO
Definition: x86_traits.hh:67
constexpr auto CPL0FlagBit
Definition: ldstflags.hh:56
Bitfield< 3 > mode
Definition: types.hh:192
Bitfield< 0 > p
Definition: pagetable.hh:151
const Addr IntAddrPrefixCPUID
Definition: x86_traits.hh:63
@ SixtyFourBitMode
Definition: types.hh:204
const Addr IntAddrPrefixMSR
Definition: x86_traits.hh:64
Bitfield< 11, 0 > pcid
Definition: misc.hh:624
const Addr IntAddrPrefixMask
Definition: x86_traits.hh:62
Bitfield< 1 > x
Definition: types.hh:108
bool msrAddrToIndex(RegIndex &reg_num, Addr addr)
Find and return the misc reg corresponding to an MSR address.
Definition: msr.cc:150
static Addr x86LocalAPICAddress(const uint8_t id, const uint16_t addr)
Definition: x86_traits.hh:91
const Addr PageBytes
Definition: page_size.hh:49
static void decodeAddrOffset(Addr offset, uint8_t &func)
Definition: pseudo_inst.hh:63
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::shared_ptr< FaultBase > Fault
Definition: types.hh:248
T letoh(T value)
Definition: byteswap.hh:173
std::shared_ptr< Request > RequestPtr
Definition: request.hh:92
uint16_t RegIndex
Definition: types.hh:176
std::ostream CheckpointOut
Definition: serialize.hh:66
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
Definition: root.cc:220
T htole(T value)
Definition: byteswap.hh:172
uint64_t RegVal
Definition: types.hh:173
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:161
constexpr decltype(nullptr) NoFault
Definition: types.hh:253
Declarations of a non-full system Page Table.
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
#define UNSERIALIZE_SCALAR(scalar)
Definition: serialize.hh:575
#define SERIALIZE_SCALAR(scalar)
Definition: serialize.hh:568
statistics::Scalar rdMisses
Definition: tlb.hh:118
statistics::Scalar wrAccesses
Definition: tlb.hh:117
statistics::Scalar rdAccesses
Definition: tlb.hh:116
TlbStats(statistics::Group *parent)
Definition: tlb.cc:519
statistics::Scalar wrMisses
Definition: tlb.hh:119
TlbEntryTrie::Handle trieHandle
Definition: pagetable.hh:94

Generated on Wed Dec 21 2022 10:22:15 for gem5 by doxygen 1.9.1