gem5 v24.0.0.0
Loading...
Searching...
No Matches
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"
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
60namespace gem5
61{
62
63namespace X86ISA {
64
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
81void
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
99TlbEntry *
100TLB::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
135TlbEntry *
136TLB::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
144void
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
157void
159{
161}
162
163void
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
176void
177TLB::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
187namespace
188{
189
190Cycles
191localMiscRegAccess(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
209Fault
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
272Fault
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;
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
321Fault
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) {
423 } else {
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
507Fault
510{
511 bool delayedResponse;
512 // CLFLUSHOPT/WB/FLUSH should be treated as read for protection checks
513 if (req->isCacheClean())
515 return TLB::translate(req, tc, NULL, mode, delayedResponse, false);
516}
517
518Fault
521{
522 // CLFLUSHOPT/WB/FLUSH should be treated as read for protection checks
523 if (req->isCacheClean())
525 unsigned logBytes;
526 const Addr vaddr = req->getVaddr();
527 Addr addr = vaddr;
528 Addr paddr = 0;
529 if (FullSystem) {
530 Fault fault = walker->startFunctional(tc, addr, logBytes, mode);
531 if (fault != NoFault)
532 return fault;
533 paddr = insertBits(addr, logBytes - 1, 0, vaddr);
534 } else {
535 Process *process = tc->getProcessPtr();
536 const auto *pte = process->pTable->lookup(vaddr);
537
538 if (!pte && mode != BaseMMU::Execute) {
539 // Check if we just need to grow the stack.
540 if (process->fixupFault(vaddr)) {
541 // If we did, lookup the entry for the new page.
542 pte = process->pTable->lookup(vaddr);
543 }
544 }
545
546 if (!pte)
547 return std::make_shared<PageFault>(vaddr, true, mode, true, false);
548
549 paddr = pte->paddr | process->pTable->pageOffset(vaddr);
550 }
551 DPRINTF(TLB, "Translated (functional) %#x -> %#x.\n", vaddr, paddr);
552 req->setPaddr(paddr);
553 return NoFault;
554}
555
556void
559{
560 bool delayedResponse;
561 assert(translation);
562 // CLFLUSHOPT/WB/FLUSH should be treated as read for protection checks
563 if (req->isCacheClean())
565 Fault fault =
566 TLB::translate(req, tc, translation, mode, delayedResponse, true);
567 if (!delayedResponse)
568 translation->finish(fault, req, tc, mode);
569 else
570 translation->markDelayed();
571}
572
573Walker *
575{
576 return walker;
577}
578
580 : statistics::Group(parent),
581 ADD_STAT(rdAccesses, statistics::units::Count::get(),
582 "TLB accesses on read requests"),
583 ADD_STAT(wrAccesses, statistics::units::Count::get(),
584 "TLB accesses on write requests"),
585 ADD_STAT(rdMisses, statistics::units::Count::get(),
586 "TLB misses on read requests"),
587 ADD_STAT(wrMisses, statistics::units::Count::get(),
588 "TLB misses on write requests")
589{
590}
591
592void
594{
595 // Only store the entries in use.
596 uint32_t _size = size - freeList.size();
597 SERIALIZE_SCALAR(_size);
599
600 uint32_t _count = 0;
601 for (uint32_t x = 0; x < size; x++) {
602 if (tlb[x].trieHandle != NULL)
603 tlb[x].serializeSection(cp, csprintf("Entry%d", _count++));
604 }
605}
606
607void
608TLB::unserialize(CheckpointIn &cp)
609{
610 // Do not allow to restore with a smaller tlb.
611 uint32_t _size;
612 UNSERIALIZE_SCALAR(_size);
613 if (_size > size) {
614 fatal("TLB size less than the one in checkpoint!");
615 }
616
618
619 for (uint32_t x = 0; x < _size; x++) {
620 TlbEntry *newEntry = freeList.front();
621 freeList.pop_front();
622
623 newEntry->unserializeSection(cp, csprintf("Entry%d", x));
624 newEntry->trieHandle = trie.insert(newEntry->vaddr,
625 TlbEntryTrie::MaxBits - newEntry->logBytes, newEntry);
626 }
627}
628
629Port *
631{
632 return &walker->getPort("port");
633}
634
635} // namespace X86ISA
636} // namespace gem5
#define DPRINTF(x,...)
Definition trace.hh:210
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.
Cycles is a wrapper class for representing cycle counts, i.e.
Definition types.hh:79
const Entry * lookup(Addr vaddr)
Lookup function.
Addr instAddr() const
Returns the memory address of the instruction this PC points to.
Definition pcstate.hh:108
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
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:1293
unsigned getSize() const
Definition packet.hh:817
void writeData(uint8_t *p) const
Copy data from the packet to the memory at the provided pointer.
Definition packet.hh:1322
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:184
@ 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 Process * getProcessPtr()=0
virtual ContextID contextId() const =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:557
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:195
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition tlb.cc:207
X86TLBParams Params
Definition tlb.hh:71
Port * getTableWalkerPort() override
Get the table walker port.
Definition tlb.cc:630
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:238
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)
Statistics container.
Definition group.hh:93
#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.
Addr start() const
Get the start address of the range.
static const unsigned MaxBits
Definition trie.hh:127
Value * remove(Handle handle)
Method to delete a value from the trie.
Definition trie.hh:308
Handle insert(Key key, unsigned width, Value *val)
Method which inserts a key/value pair into the trie.
Definition trie.hh:204
Value * lookup(Key key)
Method which looks up the Value corresponding to a particular key.
Definition trie.hh:291
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:79
constexpr T mbits(T val, unsigned first, unsigned last)
Mask off the given bits in place like bits() but without shifting.
Definition bitfield.hh:106
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:185
#define panic(...)
This implements a cprintf based panic() function.
Definition logging.hh:188
#define fatal(...)
This implements a cprintf based fatal() function.
Definition logging.hh:200
uint8_t flags
Definition helpers.cc:87
#define warn_once(...)
Definition logging.hh:260
Bitfield< 7 > i
Definition misc_types.hh:67
Bitfield< 8 > va
Bitfield< 59, 56 > tlb
static RegIndex segAttr(int index)
Definition misc.hh:543
static RegIndex segBase(int index)
Definition misc.hh:522
static RegIndex segLimit(int index)
Definition misc.hh:536
constexpr auto AddrSizeFlagMask
Definition ldstflags.hh:58
Bitfield< 15 > system
Definition misc.hh:1032
const Addr PhysAddrPrefixPciConfig
Definition x86_traits.hh:69
Bitfield< 51, 12 > base
Definition pagetable.hh:141
Bitfield< 14 > expandDown
Definition misc.hh:1031
const Addr IntAddrPrefixIO
Definition x86_traits.hh:66
constexpr auto AddrSizeFlagShift
Definition ldstflags.hh:57
constexpr Request::FlagsType SegmentFlagMask
Definition ldstflags.hh:54
BitfieldType< SegDescriptorLimit > limit
Definition misc.hh:959
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:68
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:64
@ SixtyFourBitMode
Definition types.hh:204
const Addr IntAddrPrefixMSR
Definition x86_traits.hh:65
Bitfield< 11, 0 > pcid
Definition misc.hh:634
const Addr IntAddrPrefixMask
Definition x86_traits.hh:63
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:92
const Addr PageBytes
Definition page_size.hh:49
static void decodeAddrOffset(Addr offset, uint8_t &func)
bool pseudoInst(ThreadContext *tc, uint8_t func, uint64_t &result)
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint16_t RegIndex
Definition types.hh:176
std::shared_ptr< FaultBase > Fault
Definition types.hh:249
T letoh(T value)
Definition byteswap.hh:173
std::shared_ptr< Request > RequestPtr
Definition request.hh:94
uint64_t RegVal
Definition types.hh:173
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
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:514
statistics::Scalar wrMisses
Definition tlb.hh:119
TlbEntryTrie::Handle trieHandle
Definition pagetable.hh:94

Generated on Tue Jun 18 2024 16:24:00 for gem5 by doxygen 1.11.0