gem5  v20.1.0.0
tlb.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 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 #ifndef __ARCH_X86_TLB_HH__
39 #define __ARCH_X86_TLB_HH__
40 
41 #include <list>
42 #include <vector>
43 
44 #include "arch/generic/tlb.hh"
45 #include "arch/x86/pagetable.hh"
46 #include "base/trie.hh"
47 #include "mem/request.hh"
48 #include "params/X86TLB.hh"
49 #include "sim/stats.hh"
50 
51 class ThreadContext;
52 
53 namespace X86ISA
54 {
55  class Walker;
56 
57  class TLB : public BaseTLB
58  {
59  protected:
60  friend class Walker;
61 
63 
64  uint32_t configAddress;
65 
66  public:
67 
68  typedef X86TLBParams Params;
69  TLB(const Params *p);
70 
71  void takeOverFrom(BaseTLB *otlb) override {}
72 
73  TlbEntry *lookup(Addr va, bool update_lru = true);
74 
75  void setConfigAddress(uint32_t addr);
76 
77  protected:
78 
79  EntryList::iterator lookupIt(Addr va, bool update_lru = true);
80 
82 
83  public:
84  Walker *getWalker();
85 
86  void flushAll() override;
87 
88  void flushNonGlobal();
89 
90  void demapPage(Addr va, uint64_t asn) override;
91 
92  protected:
93  uint32_t size;
94 
96 
98 
100  uint64_t lruSeq;
101 
103 
104  struct TlbStats : public Stats::Group {
105  TlbStats(Stats::Group *parent);
106 
111  } stats;
112 
113  Fault translateInt(bool read, RequestPtr req, ThreadContext *tc);
114 
115  Fault translate(const RequestPtr &req, ThreadContext *tc,
116  Translation *translation, Mode mode,
117  bool &delayedResponse, bool timing);
118 
119  public:
120 
121  void evictLRU();
122 
123  uint64_t
125  {
126  return ++lruSeq;
127  }
128 
130  const RequestPtr &req, ThreadContext *tc, Mode mode) override;
132  const RequestPtr &req, ThreadContext *tc, Mode mode) override;
133  void translateTiming(
134  const RequestPtr &req, ThreadContext *tc,
135  Translation *translation, Mode mode) override;
136 
151  Mode mode) const override;
152 
153  TlbEntry *insert(Addr vpn, const TlbEntry &entry);
154 
155  // Checkpointing
156  void serialize(CheckpointOut &cp) const override;
157  void unserialize(CheckpointIn &cp) override;
158 
169  Port *getTableWalkerPort() override;
170  };
171 }
172 
173 #endif // __ARCH_X86_TLB_HH__
pagetable.hh
X86ISA::TLB::tlb
std::vector< TlbEntry > tlb
Definition: tlb.hh:95
X86ISA::TLB::walker
Walker * walker
Definition: tlb.hh:81
X86ISA::TLB::getWalker
Walker * getWalker()
Definition: tlb.cc:516
X86ISA::TLB::TlbStats::rdMisses
Stats::Scalar rdMisses
Definition: tlb.hh:109
X86ISA::TLB::lookupIt
EntryList::iterator lookupIt(Addr va, bool update_lru=true)
X86ISA::TLB::flushAll
void flushAll() override
Remove all entries from the TLB.
Definition: tlb.cc:130
X86ISA::TLB::TlbStats
Definition: tlb.hh:104
X86ISA::TLB::EntryList
std::list< TlbEntry * > EntryList
Definition: tlb.hh:62
X86ISA::TLB::trie
TlbEntryTrie trie
Definition: tlb.hh:99
X86ISA::TlbEntry
Definition: pagetable.hh:65
X86ISA::TLB::lruSeq
uint64_t lruSeq
Definition: tlb.hh:100
tlb.hh
BaseTLB::Mode
Mode
Definition: tlb.hh:57
RequestPtr
std::shared_ptr< Request > RequestPtr
Definition: request.hh:82
X86ISA::TLB
Definition: tlb.hh:57
std::vector
STL vector class.
Definition: stl.hh:37
X86ISA::TLB::getTableWalkerPort
Port * getTableWalkerPort() override
Get the table walker port.
Definition: tlb.cc:568
X86ISA::TLB::translateInt
Fault translateInt(bool read, RequestPtr req, ThreadContext *tc)
Definition: tlb.cc:195
Trie< Addr, X86ISA::TlbEntry >
request.hh
BaseTLB
Definition: tlb.hh:50
X86ISA::TLB::translate
Fault translate(const RequestPtr &req, ThreadContext *tc, Translation *translation, Mode mode, bool &delayedResponse, bool timing)
Definition: tlb.cc:307
Stats::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2533
stats.hh
X86ISA::TLB::flushNonGlobal
void flushNonGlobal()
Definition: tlb.cc:149
X86ISA::TLB::m5opRange
AddrRange m5opRange
Definition: tlb.hh:102
cp
Definition: cprintf.cc:40
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
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::TLB::insert
TlbEntry * insert(Addr vpn, const TlbEntry &entry)
Definition: tlb.cc:97
Fault
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
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
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
X86ISA::TLB::translateTiming
void translateTiming(const RequestPtr &req, ThreadContext *tc, Translation *translation, Mode mode) override
Definition: tlb.cc:502
BaseTLB::Translation
Definition: tlb.hh:59
X86ISA::TLB::TlbStats::rdAccesses
Stats::Scalar rdAccesses
Definition: tlb.hh:107
X86ISA::TLB::Params
X86TLBParams Params
Definition: tlb.hh:68
X86ISA::TLB::evictLRU
void evictLRU()
Definition: tlb.cc:79
X86ISA::TLB::lookup
TlbEntry * lookup(Addr va, bool update_lru=true)
Definition: tlb.cc:121
X86ISA::TLB::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: tlb.cc:546
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
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
X86ISA::TLB::finalizePhysical
Fault finalizePhysical(const RequestPtr &req, ThreadContext *tc, Mode mode) const override
Do post-translation physical address finalization.
Definition: tlb.cc:258
X86ISA::p
Bitfield< 0 > p
Definition: pagetable.hh:151
X86ISA::TLB::nextSeq
uint64_t nextSeq()
Definition: tlb.hh:124
Stats::Group
Statistics container.
Definition: group.hh:83
X86ISA::TLB::translateFunctional
Fault translateFunctional(const RequestPtr &req, ThreadContext *tc, Mode mode) override
Definition: tlb.cc:468
X86ISA::TLB::freeList
EntryList freeList
Definition: tlb.hh:97
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:63
std::list< TlbEntry * >
X86ISA::TLB::TlbStats::TlbStats
TlbStats(Stats::Group *parent)
Definition: tlb.cc:521
X86ISA::TLB::takeOverFrom
void takeOverFrom(BaseTLB *otlb) override
Take over from an old tlb context.
Definition: tlb.hh:71
X86ISA::TLB::TlbStats::wrMisses
Stats::Scalar wrMisses
Definition: tlb.hh:110
CheckpointIn
Definition: serialize.hh:67
X86ISA::TLB::size
uint32_t size
Definition: tlb.hh:93
X86ISA::TLB::translateAtomic
Fault translateAtomic(const RequestPtr &req, ThreadContext *tc, Mode mode) override
Definition: tlb.cc:461
trie.hh
ArmISA::va
Bitfield< 8 > va
Definition: miscregs_types.hh:272

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