gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  * Authors: Gabe Black
38  */
39 
40 #ifndef __ARCH_X86_TLB_HH__
41 #define __ARCH_X86_TLB_HH__
42 
43 #include <list>
44 #include <vector>
45 
46 #include "arch/generic/tlb.hh"
47 #include "arch/x86/pagetable.hh"
48 #include "base/trie.hh"
49 #include "mem/request.hh"
50 #include "params/X86TLB.hh"
51 
52 class ThreadContext;
53 
54 namespace X86ISA
55 {
56  class Walker;
57 
58  class TLB : public BaseTLB
59  {
60  protected:
61  friend class Walker;
62 
64 
65  uint32_t configAddress;
66 
67  public:
68 
69  typedef X86TLBParams Params;
70  TLB(const Params *p);
71 
72  void takeOverFrom(BaseTLB *otlb) override {}
73 
74  TlbEntry *lookup(Addr va, bool update_lru = true);
75 
76  void setConfigAddress(uint32_t addr);
77 
78  protected:
79 
80  EntryList::iterator lookupIt(Addr va, bool update_lru = true);
81 
83 
84  public:
85  Walker *getWalker();
86 
87  void flushAll() override;
88 
89  void flushNonGlobal();
90 
91  void demapPage(Addr va, uint64_t asn) override;
92 
93  protected:
94  uint32_t size;
95 
97 
99 
101  uint64_t lruSeq;
102 
104 
106  Translation *translation, Mode mode,
107  bool &delayedResponse, bool timing);
108 
109  public:
110 
111  void evictLRU();
112 
113  uint64_t
115  {
116  return ++lruSeq;
117  }
118 
121  Translation *translation, Mode mode);
126 
141  Mode mode) const;
142 
143  TlbEntry * insert(Addr vpn, TlbEntry &entry);
144 
145  // Checkpointing
146  void serialize(CheckpointOut &cp) const override;
147  void unserialize(CheckpointIn &cp) override;
148 
159  BaseMasterPort *getMasterPort() override;
160  };
161 }
162 
163 #endif // __ARCH_X86_TLB_HH__
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: tlb.cc:463
void setConfigAddress(uint32_t addr)
Definition: tlb.cc:143
std::vector< TlbEntry > tlb
Definition: tlb.hh:96
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
TLB(const Params *p)
Definition: tlb.cc:62
uint32_t configAddress
Definition: tlb.hh:65
Bitfield< 4, 0 > mode
Definition: miscregs.hh:1385
void flushNonGlobal()
Definition: tlb.cc:149
TlbEntryTrie trie
Definition: tlb.hh:100
ThreadContext is the external interface to all thread state for anything outside of the CPU...
BaseMasterPort * getMasterPort() override
Get the table walker master port.
Definition: tlb.cc:485
TlbEntry * insert(Addr vpn, TlbEntry &entry)
Definition: tlb.cc:97
Definition: tlb.hh:53
uint64_t nextSeq()
Definition: tlb.hh:114
void evictLRU()
Definition: tlb.cc:79
TlbEntry(Addr asn, Addr _vaddr, Addr _paddr, bool uncacheable, bool read_only)
Fault translate(RequestPtr req, ThreadContext *tc, Translation *translation, Mode mode, bool &delayedResponse, bool timing)
Definition: tlb.cc:268
Fault translateInt(RequestPtr req, ThreadContext *tc)
Definition: tlb.cc:173
Walker * getWalker()
Definition: tlb.cc:442
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
EntryList::iterator lookupIt(Addr va, bool update_lru=true)
Bitfield< 8 > va
Definition: miscregs.hh:1473
void flushAll() override
Remove all entries from the TLB.
Definition: tlb.cc:130
Mode
Definition: tlb.hh:61
X86TLBParams Params
Definition: tlb.hh:69
TlbEntry * lookup(Addr va, bool update_lru=true)
Definition: tlb.cc:121
void translateTiming(RequestPtr req, ThreadContext *tc, Translation *translation, Mode mode)
Definition: tlb.cc:423
Fault translateFunctional(RequestPtr req, ThreadContext *tc, Mode mode)
Stub function for compilation support of CheckerCPU.
Definition: tlb.cc:435
std::ostream CheckpointOut
Definition: serialize.hh:67
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: tlb.cc:448
void demapPage(Addr va, uint64_t asn) override
Definition: tlb.cc:162
EntryList freeList
Definition: tlb.hh:98
A BaseMasterPort is a protocol-agnostic master port, responsible only for the structural connection t...
Definition: port.hh:115
void takeOverFrom(BaseTLB *otlb) override
Take over from an old tlb context.
Definition: tlb.hh:72
std::list< TlbEntry * > EntryList
Definition: tlb.hh:63
uint64_t lruSeq
Definition: tlb.hh:101
Bitfield< 0 > p
Definition: pagetable.hh:95
Walker * walker
Definition: tlb.hh:82
Fault translateAtomic(RequestPtr req, ThreadContext *tc, Mode mode)
Definition: tlb.cc:416
std::shared_ptr< FaultBase > Fault
Definition: types.hh:184
Bitfield< 3 > addr
Definition: types.hh:81
Fault finalizePhysical(RequestPtr req, ThreadContext *tc, Mode mode) const
Do post-translation physical address finalization.
Definition: tlb.cc:227
uint32_t size
Definition: tlb.hh:94

Generated on Fri Jun 9 2017 13:03:36 for gem5 by doxygen 1.8.6