ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
|
#include <MMU.h>
Public Member Functions | |
MMU (bool hw_ptw, std::string name, bool pid_enabled) | |
MMU ctor. More... | |
virtual | ~MMU () |
virtual int32_t | Translate (const uint64_t vma, uint64_t *const pma_buf, MM_ACCESS access, uint64_t data=0) |
Conduct the actual translation according to the format set by PTEFormatBuilder. More... | |
void | SignalMMU (uint64_t control_reg_val_) |
Whenever the MMU control register changes, the MMU has to be notified with the updated control register value. More... | |
void | Dump () |
Dump the details of the MMU, when page fault cannot be handled. More... | |
void | Init (ETISS_CPU *cpu, ETISS_System *system) |
Initialize the MMU, when DMMUWrapper is wrapping the MMU. More... | |
void | AddTLBEntryMap (uint64_t phy_addr_, PTE &pte) |
Keep a record of mapping between cached PTE with its physical address. More... | |
virtual bool | CheckPrivilegedMode ()=0 |
MMU is enabled in certain mode. More... | |
virtual int32_t | CheckProtection (const PTE &, MM_ACCESS access)=0 |
Memory protection is architecture-dependent, which should be implemented with architecture model. More... | |
virtual int32_t | WalkPageTable (uint64_t, MM_ACCESS) |
Page table walking is required to translate virtual address to physical address if TLB miss occurs. More... | |
virtual void | UpdatePTEFlags (PTE &, MM_ACCESS) |
Reserved for some MMU that might update PTE when translating. More... | |
bool | IsTLBFull () const |
PTE | EvictTLBEntry (const uint64_t vfn) |
bool | HasPageTableWalker () |
bool | IsProcessIdEnabled () |
void | UpdatePid (uint32_t new_pid) |
uint64_t | GetMMUControlReg () |
int32_t | AddTLBEntry (const uint64_t vfn, const PTE &pte) |
std::string | GetName () const |
virtual int32_t | GetPid (uint64_t control_reg_val_) |
Public Attributes | |
bool | cache_flush_pending |
Protected Attributes | |
ETISS_CPU * | cpu_ |
ETISS_System * | system_ |
bool | mmu_enabled_ |
Private Attributes | |
std::shared_ptr< etiss::mm::TLB< 0 > > | tlb_ |
std::map< uint64_t, PTE * > | tlb_entry_map_ |
uint64_t | mmu_control_reg_val_ |
uint32_t | pid_ |
std::string | name_ |
const bool | pid_enabled_ |
const bool | hw_page_table_walker_ |
MMU ctor.
It is needed to explicitly declared whether the MMU has a hardware page table walker, or support process identifier
Definition at line 68 of file MMU.cpp.
References REGISTER_PAGE_FAULT_HANDLER, tlb_, etiss::mm::tlb_miss_handler(), and etiss::mm::TLBMISS.
Definition at line 154 of file MMU.cpp.
References HANDLE_PAGE_FAULT, etiss::mm::NOERROR, etiss::mm::R_ACCESS, tlb_, and uint32_t.
Keep a record of mapping between cached PTE with its physical address.
Definition at line 214 of file MMU.cpp.
References HANDLE_PAGE_FAULT, etiss::mm::PTEOVERLAP, etiss::mm::R_ACCESS, and tlb_entry_map_.
|
pure virtual |
MMU is enabled in certain mode.
Thus the privilege mode check should be implemented in architectural part
Referenced by Translate().
Memory protection is architecture-dependent, which should be implemented with architecture model.
Referenced by Translate().
void etiss::mm::MMU::Dump | ( | ) |
Dump the details of the MMU, when page fault cannot be handled.
Definition at line 189 of file MMU.cpp.
References mmu_control_reg_val_, mmu_enabled_, name_, pid_, pid_enabled_, and tlb_.
Referenced by etiss::mm::DUMP_MMU(), and Translate().
|
inline |
Definition at line 169 of file MMU.h.
References mmu_control_reg_val_.
|
inline |
Definition at line 173 of file MMU.h.
References name_.
Referenced by SignalMMU().
Definition at line 175 of file MMU.h.
Referenced by SignalMMU().
|
inline |
Definition at line 159 of file MMU.h.
References hw_page_table_walker_.
Referenced by etiss::mm::tlb_miss_handler().
void etiss::mm::MMU::Init | ( | ETISS_CPU * | cpu, |
ETISS_System * | system | ||
) |
Initialize the MMU, when DMMUWrapper is wrapping the MMU.
Definition at line 204 of file MMU.cpp.
References cpu_, DEFAULT_PAGE_TABLE_WALKER, etiss::FATALERROR, hw_page_table_walker_, etiss::log(), etiss::mm::R_ACCESS, system_, and WalkPageTable().
|
inline |
Definition at line 161 of file MMU.h.
References pid_enabled_.
|
inline |
void etiss::mm::MMU::SignalMMU | ( | uint64_t | control_reg_val_ | ) |
Whenever the MMU control register changes, the MMU has to be notified with the updated control register value.
Definition at line 166 of file MMU.cpp.
References cache_flush_pending, GetName(), GetPid(), etiss::log(), mmu_control_reg_val_, mmu_enabled_, pid_enabled_, tlb_, tlb_entry_map_, UpdatePid(), etiss::VERBOSE, and etiss::WARNING.
|
virtual |
Conduct the actual translation according to the format set by PTEFormatBuilder.
Definition at line 82 of file MMU.cpp.
References CheckPrivilegedMode(), CheckProtection(), Dump(), etiss::FATALERROR, etiss::mm::PTEFormat::GetFormatMap(), etiss::mm::PTE::GetPPN(), HANDLE_PAGE_FAULT, etiss::mm::PTEFormat::Instance(), int32_t, etiss::log(), mmu_enabled_, etiss::mm::NOERROR, pid_, pid_enabled_, tlb_, tlb_entry_map_, uint32_t, uint64_t, UpdatePTEFlags(), and etiss::mm::W_ACCESS.
|
inline |
Definition at line 163 of file MMU.h.
References pid_, and pid_enabled_.
Referenced by SignalMMU().
Reserved for some MMU that might update PTE when translating.
Definition at line 153 of file MMU.h.
Referenced by Translate().
Page table walking is required to translate virtual address to physical address if TLB miss occurs.
Definition at line 147 of file MMU.h.
References DEFAULT_PAGE_TABLE_WALKER.
Referenced by Init(), and etiss::mm::tlb_miss_handler().
bool etiss::mm::MMU::cache_flush_pending |
Definition at line 177 of file MMU.h.
Referenced by SignalMMU().
|
protected |
|
private |
Definition at line 198 of file MMU.h.
Referenced by HasPageTableWalker(), and Init().
|
private |
Definition at line 193 of file MMU.h.
Referenced by Dump(), GetMMUControlReg(), and SignalMMU().
|
protected |
Definition at line 182 of file MMU.h.
Referenced by Dump(), SignalMMU(), and Translate().
|
private |
|
private |
Definition at line 194 of file MMU.h.
Referenced by Dump(), Translate(), and UpdatePid().
|
private |
Definition at line 197 of file MMU.h.
Referenced by Dump(), IsProcessIdEnabled(), SignalMMU(), Translate(), and UpdatePid().
|
protected |
|
private |
Definition at line 186 of file MMU.h.
Referenced by AddTLBEntry(), Dump(), EvictTLBEntry(), IsTLBFull(), MMU(), SignalMMU(), and Translate().
Definition at line 191 of file MMU.h.
Referenced by AddTLBEntryMap(), SignalMMU(), and Translate().