pagetable.hh (3809:41f230650d69) | pagetable.hh (3826:e35adf01a285) |
---|---|
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; --- 18 unchanged lines hidden (view full) --- 27 * 28 * Authors: Ali Saidi 29 */ 30 31#ifndef __ARCH_SPARC_PAGETABLE_HH__ 32#define __ARCH_SPARC_PAGETABLE_HH__ 33 34#include "arch/sparc/isa_traits.hh" | 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; --- 18 unchanged lines hidden (view full) --- 27 * 28 * Authors: Ali Saidi 29 */ 30 31#ifndef __ARCH_SPARC_PAGETABLE_HH__ 32#define __ARCH_SPARC_PAGETABLE_HH__ 33 34#include "arch/sparc/isa_traits.hh" |
35#include "base/bitfield.hh" |
|
35#include "base/misc.hh" 36#include "config/full_system.hh" 37 38class Checkpoint; 39 40namespace SparcISA 41{ 42struct VAddr --- 32 unchanged lines hidden (view full) --- 75 entry = e; 76 type = t; 77 populated = true; 78 79 // If we get a sun4v format TTE, turn it into a sun4u 80 if (type == sun4u) 81 entry4u = entry; 82 else { | 36#include "base/misc.hh" 37#include "config/full_system.hh" 38 39class Checkpoint; 40 41namespace SparcISA 42{ 43struct VAddr --- 32 unchanged lines hidden (view full) --- 76 entry = e; 77 type = t; 78 populated = true; 79 80 // If we get a sun4v format TTE, turn it into a sun4u 81 if (type == sun4u) 82 entry4u = entry; 83 else { |
83 uint64_t entry4u = 0; 84 entry4u |= entry & ULL(0x8000000000000000); //valid 85 entry4u |= (entry & 0x3) << 61; //size[1:0] 86 entry4u |= (entry & ULL(0x4000000000000000)) >> 2; //nfo 87 entry4u |= (entry & 0x1000) << 47; //ie 88 //entry4u |= (entry & 0x3F00000000000000) >> 7; //soft2 89 entry4u |= (entry & 0x4) << 48; //size[2] 90 //diag? 91 entry4u |= (entry & ULL(0x0000FFFFFFFFE000)); //paddr 92 entry4u |= (entry & 0x400) >> 5; //cp 93 entry4u |= (entry & 0x200) >> 5; //cv 94 entry4u |= (entry & 0x800) >> 8; //e 95 entry4u |= (entry & 0x100) >> 6; //p 96 entry4u |= (entry & 0x40) >> 5; //w | 84 entry4u = 0; 85 entry4u |= mbits(entry,63,63); //valid 86 entry4u |= bits(entry,1,0) << 61; //size[1:0] 87 entry4u |= bits(entry,62,62) << 60; //nfo 88 entry4u |= bits(entry,12,12) << 59; //ie 89 entry4u |= bits(entry,2,2) << 48; //size[2] 90 entry4u |= mbits(entry,39,13); //paddr 91 entry4u |= bits(entry,61,61) << 6;; // locked 92 entry4u |= bits(entry,10,10) << 5; //cp 93 entry4u |= bits(entry,9,9) << 4; //cv 94 entry4u |= bits(entry,11,11) << 3; //e 95 entry4u |= bits(entry,8,8) << 2; //p 96 entry4u |= bits(entry,6,6) << 1; //w |
97 } 98 } 99 100 void clear() 101 { 102 populated = false; 103 } 104 105 static int pageSizes[6]; 106 107 108 uint64_t operator()() const { assert(populated); return entry4u; } 109 const PageTableEntry &operator=(uint64_t e) { populated = true; 110 entry4u = e; return *this; } 111 112 const PageTableEntry &operator=(const PageTableEntry &e) 113 { populated = true; entry4u = e.entry4u; return *this; } 114 | 97 } 98 } 99 100 void clear() 101 { 102 populated = false; 103 } 104 105 static int pageSizes[6]; 106 107 108 uint64_t operator()() const { assert(populated); return entry4u; } 109 const PageTableEntry &operator=(uint64_t e) { populated = true; 110 entry4u = e; return *this; } 111 112 const PageTableEntry &operator=(const PageTableEntry &e) 113 { populated = true; entry4u = e.entry4u; return *this; } 114 |
115 bool valid() const { return entry4u & ULL(0x8000000000000000) && populated; } | 115 bool valid() const { return bits(entry4u,63,63) && populated; } |
116 uint8_t _size() const { assert(populated); | 116 uint8_t _size() const { assert(populated); |
117 return ((entry4u & 0x6) >> 61) | 118 ((entry4u & ULL(0x000080000000000)) >> 46); } 119 Addr size() const { return pageSizes[_size()]; } 120 bool ie() const { return entry4u >> 59 & 0x1; } 121 Addr pfn() const { assert(populated); 122 return entry4u >> 13 & ULL(0xFFFFFFFFFF); } 123 Addr paddr() const { assert(populated); 124 return entry4u & ULL(0x0000FFFFFFFFE000); } 125 bool locked() const { assert(populated); 126 return entry4u & 0x40; } 127 bool cv() const { assert(populated); 128 return entry4u & 0x10; } 129 bool cp() const { assert(populated); 130 return entry4u & 0x20; } 131 bool priv() const { assert(populated); 132 return entry4u & 0x4; } 133 bool writable() const { assert(populated); 134 return entry4u & 0x2; } 135 bool nofault() const { assert(populated); 136 return entry4u & ULL(0x1000000000000000); } 137 bool sideffect() const { assert(populated); 138 return entry4u & 0x8; } | 117 return bits(entry4u, 62,61) | 118 bits(entry4u, 48,48) << 2; } 119 Addr size() const { assert(_size() < 6); return pageSizes[_size()]; } 120 bool ie() const { return bits(entry4u, 59,59); } 121 Addr pfn() const { assert(populated); return bits(entry4u,39,13); } 122 Addr paddr() const { assert(populated); return mbits(entry4u, 39,13);} 123 bool locked() const { assert(populated); return bits(entry4u,6,6); } 124 bool cv() const { assert(populated); return bits(entry4u,4,4); } 125 bool cp() const { assert(populated); return bits(entry4u,5,5); } 126 bool priv() const { assert(populated); return bits(entry4u,2,2); } 127 bool writable() const { assert(populated); return bits(entry4u,1,1); } 128 bool nofault() const { assert(populated); return bits(entry4u,60,60); } 129 bool sideffect() const { assert(populated); return bits(entry4u,3,3); } |
139}; 140 141struct TlbRange { 142 Addr va; 143 Addr size; 144 int contextId; 145 int partitionId; 146 bool real; --- 51 unchanged lines hidden --- | 130}; 131 132struct TlbRange { 133 Addr va; 134 Addr size; 135 int contextId; 136 int partitionId; 137 bool real; --- 51 unchanged lines hidden --- |