ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
PTE.h
Go to the documentation of this file.
1 
45 #ifndef ETISS_INCLUDE_MM_PTE_H_
46 #define ETISS_INCLUDE_MM_PTE_H_
47 
48 #include "etiss/mm/PTEFormat.h"
50 
51 #include "etiss/Misc.h"
52 
53 namespace etiss
54 {
55 namespace mm
56 {
57 
68 class PTE
69 {
70  public:
71  PTE(){};
72 
73  PTE(uint64_t pte) { Update(pte); }
74 
75  // PTE(const PTE & pte_cp_){
76  // Update(pte_cp_.pte_val_);
77 
78  // }
79 
80  // PTE & operator= (const PTE & pte_assign_){
81  // if (& pte_assign_ == this)
82  // return *this;
83  // Update(pte_assign_.pte_val_);
84  // return *this;
85  // }
86 
91  void Update(uint64_t new_pte);
92 
97  uint64_t GetByName(std::string const name) const;
98 
103  void SetFlagByName(std::string name, uint64_t val);
104 
109  void ClearFlagByName(std::string name);
110 
115  void Dump();
116 
117  uint64_t Get() const { return pte_val_; }
118 
119  uint64_t GetPPN() const { return ppn_val_; }
120 
121  private:
123  {
124  // In order to generate 64 bit mask, mask has to be declared
125  // as 64 bit integer.
126  if (len >= 64)
127  return static_cast<uint64_t>(-1);
128  else
129  return (static_cast<uint64_t>(1) << len) - 1;
130  }
131 
132  void SetBit(uint32_t pos) { pte_val_ |= (static_cast <uint64_t>(1) << pos); }
133 
134  void ClearBit(uint32_t pos) { pte_val_ &= (~(static_cast < uint64_t > (1) << pos)); }
135 
136  bool CheckBit(uint32_t pos) const { return pte_val_ & (static_cast<uint64_t>(1) << pos) ? true : false; }
137 
140 };
141 
142 } // namespace mm
143 } // namespace etiss
144 
145 #endif
general configuration and logging
static __inline__ uint32_t
Definition: arm_cde.h:25
static __inline__ uint64_t
Definition: arm_cde.h:31
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
Definition: PTE.h:69
PTE(uint64_t pte)
Definition: PTE.h:73
uint64_t ppn_val_
Definition: PTE.h:138
void ClearFlagByName(std::string name)
Clear the bit field value with its name.
Definition: PTE.cpp:124
uint64_t GetByName(std::string const name) const
Get the bit field value with its name.
Definition: PTE.cpp:87
uint64_t GetPPN() const
Definition: PTE.h:119
uint64_t Get() const
Definition: PTE.h:117
bool CheckBit(uint32_t pos) const
Definition: PTE.h:136
void Dump()
Dump the details of the PTE entry.
Definition: PTE.cpp:143
void ClearBit(uint32_t pos)
Definition: PTE.h:134
void SetBit(uint32_t pos)
Definition: PTE.h:132
uint64_t pte_val_
Definition: PTE.h:139
void SetFlagByName(std::string name, uint64_t val)
Set the bit field value with its name.
Definition: PTE.cpp:104
void Update(uint64_t new_pte)
Update the PTE with a new value.
Definition: PTE.cpp:62
uint64_t GenerateMask(uint64_t len) const
Definition: PTE.h:122
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
Definition: Benchmark.h:53
#define true
Definition: stdbool.h:16