18#ifndef ETISS_INCLUDE_MM_TLB_H_
19#define ETISS_INCLUDE_MM_TLB_H_
31template <u
int32_t EntryNum>
35 typedef std::map<uint64_t, PTE>
TLBMap;
89 TLBMap::iterator itr =
tlb_map_.find(vfn);
94 *pte_buf = itr->second;
115 TLBMap::iterator itr =
tlb_map_.find(vfn);
118 itr->second.Update(pte_val);
128 TLBMap::iterator itr =
tlb_map_.find(vfn);
145 TLBMap::iterator itr =
tlb_map_.find(vfn);
151 std::cout <<
"Virtual Frame Number (VFN) : 0x" << std::hex << vfn << std::endl;
153 std::cout <<
"---------------------------" << std::endl;
165 TLBMap::const_iterator itr =
tlb_map_.begin();
166 std::cout <<
"----------TLB Details---------" << std::endl;
167 cout <<
"TLB is full : " << std::boolalpha <<
is_full_ << endl;
171 for (; itr !=
tlb_map_.end(); ++itr)
Internal fault inside MMU and.
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
void log(Verbosity level, std::string msg)
write log message at the given level.