gem5  v20.1.0.0
tlb.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001-2005 The Regents of The University of Michigan
3  * Copyright (c) 2007 MIPS Technologies, Inc.
4  * Copyright (c) 2020 Barkhausen Institut
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are
9  * met: redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer;
11  * redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution;
14  * neither the name of the copyright holders nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #include "arch/riscv/tlb.hh"
32 
33 #include <string>
34 #include <vector>
35 
36 #include "arch/riscv/faults.hh"
38 #include "arch/riscv/pagetable.hh"
41 #include "arch/riscv/utility.hh"
42 #include "base/inifile.hh"
43 #include "base/str.hh"
44 #include "base/trace.hh"
45 #include "cpu/thread_context.hh"
46 #include "debug/TLB.hh"
47 #include "debug/TLBVerbose.hh"
48 #include "mem/page_table.hh"
49 #include "params/RiscvTLB.hh"
50 #include "sim/full_system.hh"
51 #include "sim/process.hh"
52 #include "sim/system.hh"
53 
54 using namespace std;
55 using namespace RiscvISA;
56 
58 //
59 // RISC-V TLB
60 //
61 
62 static Addr
63 buildKey(Addr vpn, uint16_t asid)
64 {
65  return (static_cast<Addr>(asid) << 48) | vpn;
66 }
67 
68 TLB::TLB(const Params *p)
69  : BaseTLB(p), size(p->size), tlb(size), lruSeq(0), stats(this)
70 {
71  for (size_t x = 0; x < size; x++) {
72  tlb[x].trieHandle = NULL;
73  freeList.push_back(&tlb[x]);
74  }
75 
76  walker = p->walker;
77  walker->setTLB(this);
78 }
79 
80 Walker *
82 {
83  return walker;
84 }
85 
86 void
88 {
89  // Find the entry with the lowest (and hence least recently updated)
90  // sequence number.
91 
92  size_t lru = 0;
93  for (size_t i = 1; i < size; i++) {
94  if (tlb[i].lruSeq < tlb[lru].lruSeq)
95  lru = i;
96  }
97 
98  remove(lru);
99 }
100 
101 TlbEntry *
102 TLB::lookup(Addr vpn, uint16_t asid, Mode mode, bool hidden)
103 {
104  TlbEntry *entry = trie.lookup(buildKey(vpn, asid));
105 
106  if (!hidden) {
107  if (entry)
108  entry->lruSeq = nextSeq();
109 
110  if (mode == Write)
112  else
114 
115  if (!entry) {
116  if (mode == Write)
118  else
119  stats.read_misses++;
120  }
121  else {
122  if (mode == Write)
123  stats.write_hits++;
124  else
125  stats.read_hits++;
126  }
127 
128  DPRINTF(TLBVerbose, "lookup(vpn=%#x, asid=%#x): %s ppn %#x\n",
129  vpn, asid, entry ? "hit" : "miss", entry ? entry->paddr : 0);
130  }
131 
132  return entry;
133 }
134 
135 TlbEntry *
136 TLB::insert(Addr vpn, const TlbEntry &entry)
137 {
138  DPRINTF(TLB, "insert(vpn=%#x, asid=%#x): ppn=%#x pte=%#x size=%#x\n",
139  vpn, entry.asid, entry.paddr, entry.pte, entry.size());
140 
141  // If somebody beat us to it, just use that existing entry.
142  TlbEntry *newEntry = lookup(vpn, entry.asid, Mode::Read, true);
143  if (newEntry) {
144  // update PTE flags (maybe we set the dirty/writable flag)
145  newEntry->pte = entry.pte;
146  assert(newEntry->vaddr == vpn);
147  return newEntry;
148  }
149 
150  if (freeList.empty())
151  evictLRU();
152 
153  newEntry = freeList.front();
154  freeList.pop_front();
155 
156  Addr key = buildKey(vpn, entry.asid);
157  *newEntry = entry;
158  newEntry->lruSeq = nextSeq();
159  newEntry->vaddr = vpn;
160  newEntry->trieHandle =
161  trie.insert(key, TlbEntryTrie::MaxBits - entry.logBytes, newEntry);
162  return newEntry;
163 }
164 
165 void
166 TLB::demapPage(Addr vpn, uint64_t asid)
167 {
168  asid &= 0xFFFF;
169 
170  if (vpn == 0 && asid == 0)
171  flushAll();
172  else {
173  DPRINTF(TLB, "flush(vpn=%#x, asid=%#x)\n", vpn, asid);
174  if (vpn != 0 && asid != 0) {
175  TlbEntry *newEntry = lookup(vpn, asid, Mode::Read, true);
176  if (newEntry)
177  remove(newEntry - tlb.data());
178  }
179  else {
180  for (size_t i = 0; i < size; i++) {
181  if (tlb[i].trieHandle) {
182  Addr mask = ~(tlb[i].size() - 1);
183  if ((vpn == 0 || (vpn & mask) == tlb[i].vaddr) &&
184  (asid == 0 || tlb[i].asid == asid))
185  remove(i);
186  }
187  }
188  }
189  }
190 }
191 
192 void
194 {
195  DPRINTF(TLB, "flushAll()\n");
196  for (size_t i = 0; i < size; i++) {
197  if (tlb[i].trieHandle)
198  remove(i);
199  }
200 }
201 
202 void
203 TLB::remove(size_t idx)
204 {
205  DPRINTF(TLB, "remove(vpn=%#x, asid=%#x): ppn=%#x pte=%#x size=%#x\n",
206  tlb[idx].vaddr, tlb[idx].asid, tlb[idx].paddr, tlb[idx].pte,
207  tlb[idx].size());
208 
209  assert(tlb[idx].trieHandle);
210  trie.remove(tlb[idx].trieHandle);
211  tlb[idx].trieHandle = NULL;
212  freeList.push_back(&tlb[idx]);
213 }
214 
215 Fault
217  Mode mode, PTESv39 pte)
218 {
219  Fault fault = NoFault;
220 
221  if (mode == TLB::Read && !pte.r) {
222  DPRINTF(TLB, "PTE has no read perm, raising PF\n");
223  fault = createPagefault(vaddr, mode);
224  }
225  else if (mode == TLB::Write && !pte.w) {
226  DPRINTF(TLB, "PTE has no write perm, raising PF\n");
227  fault = createPagefault(vaddr, mode);
228  }
229  else if (mode == TLB::Execute && !pte.x) {
230  DPRINTF(TLB, "PTE has no exec perm, raising PF\n");
231  fault = createPagefault(vaddr, mode);
232  }
233 
234  if (fault == NoFault) {
235  // check pte.u
236  if (pmode == PrivilegeMode::PRV_U && !pte.u) {
237  DPRINTF(TLB, "PTE is not user accessible, raising PF\n");
238  fault = createPagefault(vaddr, mode);
239  }
240  else if (pmode == PrivilegeMode::PRV_S && pte.u && status.sum == 0) {
241  DPRINTF(TLB, "PTE is only user accessible, raising PF\n");
242  fault = createPagefault(vaddr, mode);
243  }
244  }
245 
246  return fault;
247 }
248 
249 Fault
251 {
252  ExceptionCode code;
253  if (mode == TLB::Read)
255  else if (mode == TLB::Write)
257  else
259  return std::make_shared<AddressFault>(vaddr, code);
260 }
261 
262 Addr
264 {
265  TlbEntry *e = lookup(vaddr, asid, mode, false);
266  assert(e != nullptr);
267  return e->paddr << PageShift | (vaddr & mask(e->logBytes));
268 }
269 
270 Fault
272  Translation *translation, Mode mode, bool &delayed)
273 {
274  delayed = false;
275 
276  Addr vaddr = req->getVaddr() & ((static_cast<Addr>(1) << VADDR_BITS) - 1);
277  SATP satp = tc->readMiscReg(MISCREG_SATP);
278 
279  TlbEntry *e = lookup(vaddr, satp.asid, mode, false);
280  if (!e) {
281  Fault fault = walker->start(tc, translation, req, mode);
282  if (translation != nullptr || fault != NoFault) {
283  // This gets ignored in atomic mode.
284  delayed = true;
285  return fault;
286  }
287  e = lookup(vaddr, satp.asid, mode, false);
288  assert(e != nullptr);
289  }
290 
291  STATUS status = tc->readMiscReg(MISCREG_STATUS);
292  PrivilegeMode pmode = getMemPriv(tc, mode);
293  Fault fault = checkPermissions(status, pmode, vaddr, mode, e->pte);
294  if (fault != NoFault) {
295  // if we want to write and it isn't writable, do a page table walk
296  // again to update the dirty flag.
297  if (mode == TLB::Write && !e->pte.w) {
298  DPRINTF(TLB, "Dirty bit not set, repeating PT walk\n");
299  fault = walker->start(tc, translation, req, mode);
300  if (translation != nullptr || fault != NoFault) {
301  delayed = true;
302  return fault;
303  }
304  }
305  if (fault != NoFault)
306  return fault;
307  }
308 
309  Addr paddr = e->paddr << PageShift | (vaddr & mask(e->logBytes));
310  DPRINTF(TLBVerbose, "translate(vpn=%#x, asid=%#x): %#x\n",
311  vaddr, satp.asid, paddr);
312  req->setPaddr(paddr);
313 
314  return NoFault;
315 }
316 
319 {
320  STATUS status = (STATUS)tc->readMiscReg(MISCREG_STATUS);
322  if (mode != Mode::Execute && status.mprv == 1)
323  pmode = (PrivilegeMode)(RegVal)status.mpp;
324  return pmode;
325 }
326 
327 Fault
329  Translation *translation, Mode mode, bool &delayed)
330 {
331  delayed = false;
332 
333  if (FullSystem) {
334  PrivilegeMode pmode = getMemPriv(tc, mode);
335  SATP satp = tc->readMiscReg(MISCREG_SATP);
336  if (pmode == PrivilegeMode::PRV_M || satp.mode == AddrXlateMode::BARE)
337  req->setFlags(Request::PHYSICAL);
338 
339  Fault fault;
340  if (req->getFlags() & Request::PHYSICAL) {
344  req->setPaddr(req->getVaddr());
345  fault = NoFault;
346  } else {
347  fault = doTranslate(req, tc, translation, mode, delayed);
348  }
349 
350  // according to the RISC-V tests, negative physical addresses trigger
351  // an illegal address exception.
352  // TODO where is that written in the manual?
353  if (!delayed && fault == NoFault && bits(req->getPaddr(), 63)) {
354  ExceptionCode code;
355  if (mode == TLB::Read)
357  else if (mode == TLB::Write)
359  else
361  fault = make_shared<AddressFault>(req->getVaddr(), code);
362  }
363 
364  return fault;
365  } else {
366  // In the O3 CPU model, sometimes a memory access will be speculatively
367  // executed along a branch that will end up not being taken where the
368  // address is invalid. In that case, return a fault rather than trying
369  // to translate it (which will cause a panic). Since RISC-V allows
370  // unaligned memory accesses, this should only happen if the request's
371  // length is long enough to wrap around from the end of the memory to
372  // the start.
373  assert(req->getSize() > 0);
374  if (req->getVaddr() + req->getSize() - 1 < req->getVaddr())
375  return make_shared<GenericPageTableFault>(req->getVaddr());
376 
377  Process * p = tc->getProcessPtr();
378 
379  Fault fault = p->pTable->translate(req);
380  if (fault != NoFault)
381  return fault;
382 
383  return NoFault;
384  }
385 }
386 
387 Fault
389 {
390  bool delayed;
391  return translate(req, tc, nullptr, mode, delayed);
392 }
393 
394 void
396  Translation *translation, Mode mode)
397 {
398  bool delayed;
399  assert(translation);
400  Fault fault = translate(req, tc, translation, mode, delayed);
401  if (!delayed)
402  translation->finish(fault, req, tc, mode);
403  else
404  translation->markDelayed();
405 }
406 
407 Fault
409 {
410  const Addr vaddr = req->getVaddr();
411  Addr paddr = vaddr;
412 
413  if (FullSystem) {
414  TLB *tlb = dynamic_cast<TLB *>(tc->getDTBPtr());
415 
416  PrivilegeMode pmode = tlb->getMemPriv(tc, mode);
417  SATP satp = tc->readMiscReg(MISCREG_SATP);
418  if (pmode != PrivilegeMode::PRV_M &&
419  satp.mode != AddrXlateMode::BARE) {
420  Walker *walker = tlb->getWalker();
421  unsigned logBytes;
422  Fault fault = walker->startFunctional(
423  tc, paddr, logBytes, mode);
424  if (fault != NoFault)
425  return fault;
426 
427  Addr masked_addr = vaddr & mask(logBytes);
428  paddr |= masked_addr;
429  }
430  }
431  else {
432  Process *process = tc->getProcessPtr();
433  const auto *pte = process->pTable->lookup(vaddr);
434 
435  if (!pte && mode != Execute) {
436  // Check if we just need to grow the stack.
437  if (process->fixupFault(vaddr)) {
438  // If we did, lookup the entry for the new page.
439  pte = process->pTable->lookup(vaddr);
440  }
441  }
442 
443  if (!pte)
444  return std::make_shared<GenericPageTableFault>(req->getVaddr());
445 
446  paddr = pte->paddr | process->pTable->pageOffset(vaddr);
447  }
448 
449  DPRINTF(TLB, "Translated (functional) %#x -> %#x.\n", vaddr, paddr);
450  req->setPaddr(paddr);
451  return NoFault;
452 }
453 
454 Fault
456  ThreadContext *tc, Mode mode) const
457 {
458  return NoFault;
459 }
460 
461 void
463 {
464  // Only store the entries in use.
465  uint32_t _size = size - freeList.size();
466  SERIALIZE_SCALAR(_size);
468 
469  uint32_t _count = 0;
470  for (uint32_t x = 0; x < size; x++) {
471  if (tlb[x].trieHandle != NULL)
472  tlb[x].serializeSection(cp, csprintf("Entry%d", _count++));
473  }
474 }
475 
476 void
478 {
479  // Do not allow to restore with a smaller tlb.
480  uint32_t _size;
481  UNSERIALIZE_SCALAR(_size);
482  if (_size > size) {
483  fatal("TLB size less than the one in checkpoint!");
484  }
485 
487 
488  for (uint32_t x = 0; x < _size; x++) {
489  TlbEntry *newEntry = freeList.front();
490  freeList.pop_front();
491 
492  newEntry->unserializeSection(cp, csprintf("Entry%d", x));
493  Addr key = buildKey(newEntry->vaddr, newEntry->asid);
494  newEntry->trieHandle = trie.insert(key,
495  TlbEntryTrie::MaxBits - newEntry->logBytes, newEntry);
496  }
497 }
498 
500  : Stats::Group(parent),
501  ADD_STAT(read_hits, "read hits"),
502  ADD_STAT(read_misses, "read misses"),
503  ADD_STAT(read_accesses, "read accesses"),
504  ADD_STAT(write_hits, "write hits"),
505  ADD_STAT(write_misses, "write misses"),
506  ADD_STAT(write_accesses, "write accesses"),
507  ADD_STAT(hits, "Total TLB (read and write) hits", read_hits + write_hits),
508  ADD_STAT(misses, "Total TLB (read and write) misses",
509  read_misses + write_misses),
510  ADD_STAT(accesses, "Total TLB (read and write) accesses",
511  read_accesses + write_accesses)
512 {
513 }
514 
516 RiscvTLBParams::create()
517 {
518  return new TLB(this);
519 }
RiscvISA::MISCREG_PRV
@ MISCREG_PRV
Definition: registers.hh:129
RiscvISA::TlbEntry
Definition: pagetable.hh:78
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:183
RiscvISA::TLB::getMemPriv
PrivilegeMode getMemPriv(ThreadContext *tc, Mode mode)
Definition: tlb.cc:318
ArmISA::status
Bitfield< 5, 0 > status
Definition: miscregs_types.hh:417
BaseTLB::Translation::finish
virtual void finish(const Fault &fault, const RequestPtr &req, ThreadContext *tc, Mode mode)=0
Serializable::unserializeSection
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
Definition: serialize.cc:178
RiscvISA::STORE_PAGE
@ STORE_PAGE
Definition: faults.hh:77
RiscvISA::TLB::demapPage
void demapPage(Addr vaddr, uint64_t asn) override
Definition: tlb.cc:166
RiscvISA::mode
mode
Definition: pagetable.hh:42
RiscvISA::TLB::translate
Fault translate(const RequestPtr &req, ThreadContext *tc, Translation *translation, Mode mode, bool &delayed)
Definition: tlb.cc:328
RiscvISA::TLB::freeList
EntryList freeList
Definition: tlb.hh:62
faults.hh
system.hh
BaseTLB::Read
@ Read
Definition: tlb.hh:57
UNSERIALIZE_SCALAR
#define UNSERIALIZE_SCALAR(scalar)
Definition: serialize.hh:797
Process
Definition: process.hh:65
RiscvISA::TLB::insert
TlbEntry * insert(Addr vpn, const TlbEntry &entry)
Definition: tlb.cc:136
RiscvISA::TlbEntry::size
Addr size() const
Definition: pagetable.hh:102
RiscvISA::PageShift
const Addr PageShift
Definition: isa_traits.hh:52
Trie::remove
Value * remove(Handle handle)
Method to delete a value from the trie.
Definition: trie.hh:315
Trie::insert
Handle insert(Key key, unsigned width, Value *val)
Method which inserts a key/value pair into the trie.
Definition: trie.hh:210
RiscvISA::TLB::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: tlb.cc:462
RiscvISA::PRV_S
@ PRV_S
Definition: isa.hh:59
BaseTLB::Mode
Mode
Definition: tlb.hh:57
Process::pTable
EmulationPageTable * pTable
Definition: process.hh:174
RiscvISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
RiscvISA::TLB::TlbStats::write_hits
Stats::Scalar write_hits
Definition: tlb.hh:74
RiscvISA::TLB::lruSeq
uint64_t lruSeq
Definition: tlb.hh:63
RiscvISA::TlbEntry::logBytes
unsigned logBytes
Definition: pagetable.hh:86
RequestPtr
std::shared_ptr< Request > RequestPtr
Definition: request.hh:82
RiscvISA::asid
Bitfield< 59, 44 > asid
Definition: pagetable.hh:43
RiscvISA::TLB::Params
RiscvTLBParams Params
Definition: tlb.hh:85
FullSystem
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
Definition: root.cc:132
ThreadContext::getProcessPtr
virtual Process * getProcessPtr()=0
RiscvISA::TlbEntry::lruSeq
uint64_t lruSeq
Definition: pagetable.hh:95
RiscvISA::TLB::translateFunctional
Fault translateFunctional(const RequestPtr &req, ThreadContext *tc, Mode mode) override
Definition: tlb.cc:408
RiscvISA::TLB::TlbStats::read_accesses
Stats::Scalar read_accesses
Definition: tlb.hh:73
RiscvISA::LOAD_ACCESS
@ LOAD_ACCESS
Definition: faults.hh:67
RiscvISA::TLB
Definition: tlb.hh:54
RiscvISA::TLB::translateWithTLB
Addr translateWithTLB(Addr vaddr, uint16_t asid, Mode mode)
Definition: tlb.cc:263
RiscvISA::LOAD_PAGE
@ LOAD_PAGE
Definition: faults.hh:76
RiscvISA::MISCREG_STATUS
@ MISCREG_STATUS
Definition: registers.hh:135
Trie::lookup
Value * lookup(Key key)
Method which looks up the Value corresponding to a particular key.
Definition: trie.hh:298
RiscvISA::TLB::evictLRU
void evictLRU()
Definition: tlb.cc:87
BaseTLB
Definition: tlb.hh:50
EmulationPageTable::lookup
const Entry * lookup(Addr vaddr)
Lookup function.
Definition: page_table.cc:130
RiscvISA
Definition: fs_workload.cc:36
RiscvISA::VADDR_BITS
const Addr VADDR_BITS
Definition: pagetable.hh:55
str.hh
RiscvISA::Walker::start
Fault start(ThreadContext *_tc, BaseTLB::Translation *translation, const RequestPtr &req, BaseTLB::Mode mode)
Definition: pagetable_walker.cc:69
RiscvISA::vaddr
vaddr
Definition: pra_constants.hh:275
Request::PHYSICAL
@ PHYSICAL
The virtual address is also the physical address.
Definition: request.hh:106
cp
Definition: cprintf.cc:40
RiscvISA::TLB::remove
void remove(size_t idx)
Definition: tlb.cc:203
Trie< Addr, TlbEntry >::MaxBits
static const unsigned MaxBits
Definition: trie.hh:133
RiscvISA::TLB::createPagefault
Fault createPagefault(Addr vaddr, Mode mode)
Definition: tlb.cc:250
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
buildKey
static Addr buildKey(Addr vpn, uint16_t asid)
Definition: tlb.cc:63
tlb.hh
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
Fault
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
RiscvISA::Walker::setTLB
void setTLB(TLB *_tlb)
Definition: pagetable_walker.hh:189
RiscvISA::TlbEntry::pte
PTESv39 pte
Definition: pagetable.hh:90
RiscvISA::STORE_ACCESS
@ STORE_ACCESS
Definition: faults.hh:70
RiscvISA::INST_ACCESS
@ INST_ACCESS
Definition: faults.hh:63
process.hh
RiscvISA::Walker
Definition: pagetable_walker.hh:57
RiscvISA::PrivilegeMode
PrivilegeMode
Definition: isa.hh:56
BaseTLB::Translation
Definition: tlb.hh:59
RiscvISA::TLB::translateTiming
void translateTiming(const RequestPtr &req, ThreadContext *tc, Translation *translation, Mode mode) override
Definition: tlb.cc:395
RiscvISA::TLB::TlbStats::read_misses
Stats::Scalar read_misses
Definition: tlb.hh:71
RiscvISA::PRV_U
@ PRV_U
Definition: isa.hh:58
pra_constants.hh
inifile.hh
RiscvISA::x
Bitfield< 3 > x
Definition: pagetable.hh:69
RiscvISA::TLB::lookup
TlbEntry * lookup(Addr vpn, uint16_t asid, Mode mode, bool hidden)
Definition: tlb.cc:102
RiscvISA::TLB::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: tlb.cc:477
RiscvISA::TLB::trie
TlbEntryTrie trie
Definition: tlb.hh:61
RiscvISA::TLB::finalizePhysical
Fault finalizePhysical(const RequestPtr &req, ThreadContext *tc, Mode mode) const override
Do post-translation physical address finalization.
Definition: tlb.cc:455
RiscvISA::TLB::flushAll
void flushAll() override
Remove all entries from the TLB.
Definition: tlb.cc:193
NoFault
constexpr decltype(nullptr) NoFault
Definition: types.hh:245
RiscvISA::TLB::TlbStats::TlbStats
TlbStats(Stats::Group *parent)
Definition: tlb.cc:499
EmulationPageTable::pageOffset
Addr pageOffset(Addr a)
Definition: page_table.hh:106
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
SERIALIZE_SCALAR
#define SERIALIZE_SCALAR(scalar)
Definition: serialize.hh:790
RiscvISA::TLB::doTranslate
Fault doTranslate(const RequestPtr &req, ThreadContext *tc, Translation *translation, Mode mode, bool &delayed)
Definition: tlb.cc:271
full_system.hh
ArmISA::e
Bitfield< 9 > e
Definition: miscregs_types.hh:61
fs_workload.hh
ArmISA::asid
asid
Definition: miscregs_types.hh:611
BaseTLB::Write
@ Write
Definition: tlb.hh:57
RiscvISA::mask
mask
Definition: pra_constants.hh:70
RiscvISA::i
Bitfield< 2 > i
Definition: pra_constants.hh:276
RiscvISA::TLB::TlbStats::write_misses
Stats::Scalar write_misses
Definition: tlb.hh:75
BaseTLB::Translation::markDelayed
virtual void markDelayed()=0
Signal that the translation has been delayed due to a hw page table walk.
RiscvISA::TLB::walker
Walker * walker
Definition: tlb.hh:65
std
Overload hash function for BasicBlockRange type.
Definition: vec_reg.hh:587
RiscvISA::TLB::TlbStats::write_accesses
Stats::Scalar write_accesses
Definition: tlb.hh:77
RiscvISA::TLB::translateAtomic
Fault translateAtomic(const RequestPtr &req, ThreadContext *tc, Mode mode) override
Definition: tlb.cc:388
RiscvISA::INST_PAGE
@ INST_PAGE
Definition: faults.hh:75
Stats::Group
Statistics container.
Definition: group.hh:83
ThreadContext::readMiscReg
virtual RegVal readMiscReg(RegIndex misc_reg)=0
RiscvISA::TLB::checkPermissions
Fault checkPermissions(STATUS status, PrivilegeMode pmode, Addr vaddr, Mode mode, PTESv39 pte)
Definition: tlb.cc:216
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:63
RiscvISA::ExceptionCode
ExceptionCode
Definition: faults.hh:61
Stats
Definition: statistics.cc:61
utility.hh
RiscvISA::TLB::stats
RiscvISA::TLB::TlbStats stats
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
RiscvISA::TLB::TLB
TLB(const Params *p)
Definition: tlb.cc:68
RiscvISA::MISCREG_SATP
@ MISCREG_SATP
Definition: registers.hh:244
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
RiscvISA::TlbEntry::trieHandle
TlbEntryTrie::Handle trieHandle
Definition: pagetable.hh:92
RiscvISA::TLB::nextSeq
uint64_t nextSeq()
Definition: tlb.hh:118
page_table.hh
CheckpointIn
Definition: serialize.hh:67
RiscvISA::PRV_M
@ PRV_M
Definition: isa.hh:60
RiscvISA::Walker::startFunctional
Fault startFunctional(ThreadContext *_tc, Addr &addr, unsigned &logBytes, BaseTLB::Mode mode)
Definition: pagetable_walker.cc:94
BaseTLB::Execute
@ Execute
Definition: tlb.hh:57
RiscvISA::TLB::TlbStats::read_hits
Stats::Scalar read_hits
Definition: tlb.hh:70
ArmISA::tlb
Bitfield< 59, 56 > tlb
Definition: miscregs_types.hh:88
pagetable.hh
csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:158
RiscvISA::TlbEntry::vaddr
Addr vaddr
Definition: pagetable.hh:84
thread_context.hh
RiscvISA::TLB::getWalker
Walker * getWalker()
Definition: tlb.cc:81
RiscvISA::TlbEntry::paddr
Addr paddr
Definition: pagetable.hh:81
RegVal
uint64_t RegVal
Definition: types.hh:168
RiscvISA::TLB::tlb
std::vector< TlbEntry > tlb
Definition: tlb.hh:60
ThreadContext::getDTBPtr
virtual BaseTLB * getDTBPtr()=0
RiscvISA::TLB::size
size_t size
Definition: tlb.hh:59
RiscvISA::TlbEntry::asid
uint16_t asid
Definition: pagetable.hh:88
pagetable_walker.hh
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