75 std::stringstream msg;
76 msg <<
"PTE value: [0x" << std::hex << new_pte <<
"] exceed the format length " << std::dec
82 ppn_val_ = new_pte >> bit_field.second;
92 std::stringstream msg;
93 msg <<
"Trying to get value of non-existed Flag in PTE: " << name << std::endl;
97 std::pair<uint32_t, uint32_t> bit_field = itr->second;
100 uint32_t len = msb_pos - lsb_pos + 1;
109 std::stringstream msg;
110 msg <<
"Trying to set value of non-existed Flag in PTE: " << name << std::endl;
114 std::pair<uint32_t, uint32_t> bit_field = itr->second;
118 if (val & (
static_cast<uint64_t>(1) << i))
119 SetBit(i + bit_field.second);
121 }
while (i <= bit_field.first);
129 std::stringstream msg;
130 msg <<
"Trying to clear value of non-existed Flag in PTE: " << name << std::endl;
134 std::pair<uint32_t, uint32_t> bit_field = itr->second;
140 }
while (i <= bit_field.first);
146 std::cout <<
"PTE entry value: 0x" << std::hex <<
pte_val_ << std::endl;
147 std::cout <<
"Bit field details: " << std::endl;
151 std::string name = itr->first;
153 std::cout <<
"Value of " << name <<
" : 0x" << std::hex <<
GetByName(name) << std::endl;
static __inline__ uint32_t
static __inline__ uint64_t
void ClearFlagByName(std::string name)
Clear the bit field value with its name.
uint64_t GetByName(std::string const name) const
Get the bit field value with its name.
void Dump()
Dump the details of the PTE entry.
void ClearBit(uint32_t pos)
void SetBit(uint32_t pos)
void SetFlagByName(std::string name, uint64_t val)
Set the bit field value with its name.
void Update(uint64_t new_pte)
Update the PTE with a new value.
uint64_t GenerateMask(uint64_t len) const
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
void log(Verbosity level, std::string msg)
write log message at the given level.