37 std::stringstream msg;
38 msg <<
"PTE value: [0x" << std::hex << new_pte <<
"] exceed the format length " << std::dec
44 ppn_val_ = new_pte >> bit_field.second;
53 std::stringstream msg;
54 msg <<
"Trying to get value of non-existed Flag in PTE: " << name << std::endl;
58 std::pair<uint32_t, uint32_t> bit_field = itr->second;
61 uint32_t len = msb_pos - lsb_pos + 1;
70 std::stringstream msg;
71 msg <<
"Trying to set value of non-existed Flag in PTE: " << name << std::endl;
75 std::pair<uint32_t, uint32_t> bit_field = itr->second;
79 if (val & (
static_cast<uint64_t>(1) << i))
80 SetBit(i + bit_field.second);
82 }
while (i <= bit_field.first);
90 std::stringstream msg;
91 msg <<
"Trying to clear value of non-existed Flag in PTE: " << name << std::endl;
95 std::pair<uint32_t, uint32_t> bit_field = itr->second;
101 }
while (i <= bit_field.first);
107 std::cout <<
"PTE entry value: 0x" << std::hex <<
pte_val_ << std::endl;
108 std::cout <<
"Bit field details: " << std::endl;
112 std::string name = itr->first;
114 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
void log(Verbosity level, std::string msg)
write log message at the given level.