56 #ifndef ETISS_INCLUDE_MM_TLB_H_
57 #define ETISS_INCLUDE_MM_TLB_H_
68 template <u
int32_t EntryNum>
72 typedef std::map<uint64_t, PTE>
TLBMap;
126 TLBMap::iterator itr =
tlb_map_.find(vfn);
131 *pte_buf = itr->second;
152 TLBMap::iterator itr =
tlb_map_.find(vfn);
155 itr->second.Update(pte_val);
165 TLBMap::iterator itr =
tlb_map_.find(vfn);
182 TLBMap::iterator itr =
tlb_map_.find(vfn);
188 std::cout <<
"Virtual Frame Number (VFN) : 0x" << std::hex << vfn << std::endl;
190 std::cout <<
"---------------------------" << std::endl;
202 TLBMap::const_iterator itr =
tlb_map_.begin();
203 std::cout <<
"----------TLB Details---------" << std::endl;
204 cout <<
"TLB is full : " << std::boolalpha <<
is_full_ << endl;
208 for (; itr !=
tlb_map_.end(); ++itr)
static __inline__ uint32_t
static __inline__ uint64_t
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
void DumpEntry(uint64_t vfn)
Dump the PTE details according to the given VPN.
void Dump()
Dump all PTEs in TLB and TLB details.
uint32_t AddPTE(uint64_t vfn, const PTE &pte_entry)
Add an PTE entry in TLB from the given PTE.
uint32_t AddPTE(uint64_t vfn, uint64_t pte_val)
Add an PTE entry in TLB with a pte value.
std::map< uint64_t, PTE > TLBMap
bool infinite_tlb_entries_
uint32_t Lookup(uint64_t vfn, PTE *pte_buf)
Look up the TLB for the given given virtual page number.
uint32_t UpdatePTE(uint64_t vfn, uint64_t pte_val)
Update the PTE entry.
uint32_t current_entry_num_
uint32_t EvictPTE(uint64_t vfn)
Evict the PTE entry.
void Flush()
Flush the TLB.
MM_EXPORT const int32_t PTENOTEXISTED
MM_EXPORT const int32_t TLBISFULL
MM_EXPORT const int32_t TLBMISS
MM_EXPORT const int32_t NOERROR
MM_EXPORT const int32_t PTEOVERLAP
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.