pagetable.hh (5877:9fe574944f31) pagetable.hh (7741:340b6f01d69b)
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 51 unchanged lines hidden (view full) ---

60 const TteTag &
61 operator=(uint64_t e)
62 {
63 populated = true;
64 entry = e;
65 return *this;
66 }
67
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 51 unchanged lines hidden (view full) ---

60 const TteTag &
61 operator=(uint64_t e)
62 {
63 populated = true;
64 entry = e;
65 return *this;
66 }
67
68 bool valid() const {assert(populated); return !bits(entry,62,62); }
69 Addr va() const {assert(populated); return bits(entry,41,0); }
68 bool valid() const { assert(populated); return !bits(entry,62,62); }
69 Addr va() const { assert(populated); return bits(entry,41,0); }
70};
71
72
73class PageTableEntry
74{
75 public:
76 enum EntryType {
77 sun4v,
78 sun4u,
79 invalid
80 };
81
82 private:
83 uint64_t entry;
84 EntryType type;
85 uint64_t entry4u;
86 bool populated;
87
88 public:
70};
71
72
73class PageTableEntry
74{
75 public:
76 enum EntryType {
77 sun4v,
78 sun4u,
79 invalid
80 };
81
82 private:
83 uint64_t entry;
84 EntryType type;
85 uint64_t entry4u;
86 bool populated;
87
88 public:
89 PageTableEntry()
90 : entry(0), type(invalid), populated(false)
89 PageTableEntry() : entry(0), type(invalid), populated(false)
91 {}
92
93 PageTableEntry(uint64_t e, EntryType t = sun4u)
94 : entry(e), type(t), populated(true)
95 {
96 populate(entry, type);
97 }
98
90 {}
91
92 PageTableEntry(uint64_t e, EntryType t = sun4u)
93 : entry(e), type(t), populated(true)
94 {
95 populate(entry, type);
96 }
97
99 void populate(uint64_t e, EntryType t = sun4u)
98 void
99 populate(uint64_t e, EntryType t = sun4u)
100 {
101 entry = e;
102 type = t;
103 populated = true;
104
105 // If we get a sun4v format TTE, turn it into a sun4u
106 if (type == sun4u)
107 entry4u = entry;
108 else {
109 entry4u = 0;
100 {
101 entry = e;
102 type = t;
103 populated = true;
104
105 // If we get a sun4v format TTE, turn it into a sun4u
106 if (type == sun4u)
107 entry4u = entry;
108 else {
109 entry4u = 0;
110 entry4u |= mbits(entry,63,63); //valid
111 entry4u |= bits(entry,1,0) << 61; //size[1:0]
112 entry4u |= bits(entry,62,62) << 60; //nfo
113 entry4u |= bits(entry,12,12) << 59; //ie
114 entry4u |= bits(entry,2,2) << 48; //size[2]
115 entry4u |= mbits(entry,39,13); //paddr
110 entry4u |= mbits(entry,63,63); // valid
111 entry4u |= bits(entry,1,0) << 61; // size[1:0]
112 entry4u |= bits(entry,62,62) << 60; // nfo
113 entry4u |= bits(entry,12,12) << 59; // ie
114 entry4u |= bits(entry,2,2) << 48; // size[2]
115 entry4u |= mbits(entry,39,13); // paddr
116 entry4u |= bits(entry,61,61) << 6;; // locked
116 entry4u |= bits(entry,61,61) << 6;; // locked
117 entry4u |= bits(entry,10,10) << 5; //cp
118 entry4u |= bits(entry,9,9) << 4; //cv
119 entry4u |= bits(entry,11,11) << 3; //e
120 entry4u |= bits(entry,8,8) << 2; //p
121 entry4u |= bits(entry,6,6) << 1; //w
117 entry4u |= bits(entry,10,10) << 5; // cp
118 entry4u |= bits(entry,9,9) << 4; // cv
119 entry4u |= bits(entry,11,11) << 3; // e
120 entry4u |= bits(entry,8,8) << 2; // p
121 entry4u |= bits(entry,6,6) << 1; // w
122 }
123 }
124
125 void
126 clear()
127 {
128 populated = false;
129 }
130
131 static int pageSizes[6];
132
133 uint64_t operator()() const { assert(populated); return entry4u; }
122 }
123 }
124
125 void
126 clear()
127 {
128 populated = false;
129 }
130
131 static int pageSizes[6];
132
133 uint64_t operator()() const { assert(populated); return entry4u; }
134
134 const PageTableEntry &
135 operator=(uint64_t e)
136 {
137 populated = true;
138 entry4u = e;
139 return *this;
140 }
141

--- 114 unchanged lines hidden (view full) ---

256 valid = true;
257 }
258
259 TlbRange range;
260 PageTableEntry pte;
261 bool used;
262 bool valid;
263
135 const PageTableEntry &
136 operator=(uint64_t e)
137 {
138 populated = true;
139 entry4u = e;
140 return *this;
141 }
142

--- 114 unchanged lines hidden (view full) ---

257 valid = true;
258 }
259
260 TlbRange range;
261 PageTableEntry pte;
262 bool used;
263 bool valid;
264
264 Addr pageStart()
265 Addr
266 pageStart()
265 {
266 return pte.paddr();
267 }
268
269 void
270 updateVaddr(Addr new_vaddr)
271 {
272 range.va = new_vaddr;
273 }
274
275 void serialize(std::ostream &os);
276 void unserialize(Checkpoint *cp, const std::string &section);
277};
278
279} // namespace SparcISA
280
281#endif // __ARCH_SPARC_PAGE_TABLE_HH__
282
267 {
268 return pte.paddr();
269 }
270
271 void
272 updateVaddr(Addr new_vaddr)
273 {
274 range.va = new_vaddr;
275 }
276
277 void serialize(std::ostream &os);
278 void unserialize(Checkpoint *cp, const std::string &section);
279};
280
281} // namespace SparcISA
282
283#endif // __ARCH_SPARC_PAGE_TABLE_HH__
284