gem5  v20.0.0.3
pagetable.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2005 The Regents of The University of Michigan
3  * Copyright (c) 2007 MIPS Technologies, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met: redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer;
10  * redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution;
13  * neither the name of the copyright holders nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef __ARCH_MIPS_PAGETABLE_H__
31 #define __ARCH_MIPS_PAGETABLE_H__
32 
33 #include "base/logging.hh"
34 #include "base/types.hh"
35 #include "sim/serialize.hh"
36 
37 namespace MipsISA {
38 
39 struct VAddr
40 {
41 };
42 
43 // ITB/DTB page table entry
44 struct PTE
45 {
48  uint8_t asid;
49 
50  bool G;
51 
52  /* Contents of Entry Lo0 */
53  Addr PFN0; // Physical Frame Number - Even
54  bool D0; // Even entry Dirty Bit
55  bool V0; // Even entry Valid Bit
56  uint8_t C0; // Cache Coherency Bits - Even
57 
58  /* Contents of Entry Lo1 */
59  Addr PFN1; // Physical Frame Number - Odd
60  bool D1; // Odd entry Dirty Bit
61  bool V1; // Odd entry Valid Bit
62  uint8_t C1; // Cache Coherency Bits (3 bits)
63 
64  /*
65  * The next few variables are put in as optimizations to reduce
66  * TLB lookup overheads. For a given Mask, what is the address shift
67  * amount, and what is the OffsetMask
68  */
71 
72  bool Valid() { return (V0 | V1); };
73  void serialize(CheckpointOut &cp) const;
74  void unserialize(CheckpointIn &cp);
75 };
76 
77 // WARN: This particular TLB entry is not necessarily conformed to MIPS ISA
78 struct TlbEntry
79 {
81  TlbEntry() {}
82  TlbEntry(Addr asn, Addr vaddr, Addr paddr,
83  bool uncacheable, bool read_only)
84  : _pageStart(paddr)
85  {
86  if (uncacheable || read_only)
87  warn("MIPS TlbEntry does not support uncacheable"
88  " or read-only mappings\n");
89  }
90 
92  {
93  return _pageStart;
94  }
95 
96  void
97  updateVaddr(Addr new_vaddr) {}
98 
99  void serialize(CheckpointOut &cp) const
100  {
101  SERIALIZE_SCALAR(_pageStart);
102  }
103 
105  {
106  UNSERIALIZE_SCALAR(_pageStart);
107  }
108 
109 };
110 
111 };
112 #endif // __ARCH_MIPS_PAGETABLE_H__
113 
TlbEntry(Addr asn, Addr vaddr, Addr paddr, bool uncacheable, bool read_only)
Definition: pagetable.hh:82
int OffsetMask
Definition: pagetable.hh:70
void serialize(CheckpointOut &cp) const
Definition: pagetable.hh:99
Definition: cprintf.cc:40
void unserialize(CheckpointIn &cp)
Definition: pagetable.hh:104
void updateVaddr(Addr new_vaddr)
Definition: pagetable.hh:97
#define UNSERIALIZE_SCALAR(scalar)
Definition: serialize.hh:770
int AddrShiftAmount
Definition: pagetable.hh:69
void serialize(const ThreadContext &tc, CheckpointOut &cp)
Thread context serialization helpers.
uint8_t asid
Definition: pagetable.hh:48
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:140
#define SERIALIZE_SCALAR(scalar)
Definition: serialize.hh:763
std::ostream CheckpointOut
Definition: serialize.hh:63
uint8_t C1
Definition: pagetable.hh:62
void unserialize(ThreadContext &tc, CheckpointIn &cp)
#define warn(...)
Definition: logging.hh:208
uint8_t C0
Definition: pagetable.hh:56
bool Valid()
Definition: pagetable.hh:72

Generated on Fri Jul 3 2020 15:42:40 for gem5 by doxygen 1.8.13