ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
Public Member Functions | Public Attributes | Protected Attributes | Private Attributes | List of all members
etiss::mm::MMU Class Referenceabstract

#include <MMU.h>

Collaboration diagram for etiss::mm::MMU:
Collaboration graph
[legend]

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_CPUcpu_
 
ETISS_Systemsystem_
 
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_
 

Detailed Description

Definition at line 75 of file MMU.h.

Constructor & Destructor Documentation

◆ MMU()

etiss::mm::MMU::MMU ( bool  hw_ptw,
std::string  name,
bool  pid_enabled 
)
explicit

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.

Here is the call graph for this function:

◆ ~MMU()

virtual etiss::mm::MMU::~MMU ( )
inlinevirtual

Definition at line 89 of file MMU.h.

Member Function Documentation

◆ AddTLBEntry()

int32_t etiss::mm::MMU::AddTLBEntry ( const uint64_t  vfn,
const PTE pte 
)

Definition at line 154 of file MMU.cpp.

References HANDLE_PAGE_FAULT, etiss::mm::NOERROR, etiss::mm::R_ACCESS, tlb_, and uint32_t.

◆ AddTLBEntryMap()

void etiss::mm::MMU::AddTLBEntryMap ( uint64_t  phy_addr_,
PTE pte 
)

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_.

◆ CheckPrivilegedMode()

virtual bool etiss::mm::MMU::CheckPrivilegedMode ( )
pure virtual

MMU is enabled in certain mode.

Thus the privilege mode check should be implemented in architectural part

Referenced by Translate().

Here is the caller graph for this function:

◆ CheckProtection()

virtual int32_t etiss::mm::MMU::CheckProtection ( const PTE ,
MM_ACCESS  access 
)
pure virtual

Memory protection is architecture-dependent, which should be implemented with architecture model.

Referenced by Translate().

Here is the caller graph for this function:

◆ Dump()

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().

Here is the caller graph for this function:

◆ EvictTLBEntry()

PTE etiss::mm::MMU::EvictTLBEntry ( const uint64_t  vfn)
inline

Definition at line 157 of file MMU.h.

References tlb_.

◆ GetMMUControlReg()

uint64_t etiss::mm::MMU::GetMMUControlReg ( )
inline

Definition at line 169 of file MMU.h.

References mmu_control_reg_val_.

◆ GetName()

std::string etiss::mm::MMU::GetName ( ) const
inline

Definition at line 173 of file MMU.h.

References name_.

Referenced by SignalMMU().

Here is the caller graph for this function:

◆ GetPid()

virtual int32_t etiss::mm::MMU::GetPid ( uint64_t  control_reg_val_)
inlinevirtual

Definition at line 175 of file MMU.h.

Referenced by SignalMMU().

Here is the caller graph for this function:

◆ HasPageTableWalker()

bool etiss::mm::MMU::HasPageTableWalker ( )
inline

Definition at line 159 of file MMU.h.

References hw_page_table_walker_.

Referenced by etiss::mm::tlb_miss_handler().

Here is the caller graph for this function:

◆ Init()

void etiss::mm::MMU::Init ( ETISS_CPU cpu,
ETISS_System system 
)

Initialize the MMU, when DMMUWrapper is wrapping the MMU.

See also
etiss::mm::DMMUWrapper

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().

Here is the call graph for this function:

◆ IsProcessIdEnabled()

bool etiss::mm::MMU::IsProcessIdEnabled ( )
inline

Definition at line 161 of file MMU.h.

References pid_enabled_.

◆ IsTLBFull()

bool etiss::mm::MMU::IsTLBFull ( ) const
inline

Definition at line 155 of file MMU.h.

References tlb_.

◆ SignalMMU()

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.

Here is the call graph for this function:

◆ Translate()

int32_t etiss::mm::MMU::Translate ( const uint64_t  vma,
uint64_t *const  pma_buf,
MM_ACCESS  access,
uint64_t  data = 0 
)
virtual

◆ UpdatePid()

void etiss::mm::MMU::UpdatePid ( uint32_t  new_pid)
inline

Definition at line 163 of file MMU.h.

References pid_, and pid_enabled_.

Referenced by SignalMMU().

Here is the caller graph for this function:

◆ UpdatePTEFlags()

virtual void etiss::mm::MMU::UpdatePTEFlags ( PTE ,
MM_ACCESS   
)
inlinevirtual

Reserved for some MMU that might update PTE when translating.

Definition at line 153 of file MMU.h.

Referenced by Translate().

Here is the caller graph for this function:

◆ WalkPageTable()

virtual int32_t etiss::mm::MMU::WalkPageTable ( uint64_t  ,
MM_ACCESS   
)
inlinevirtual

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().

Here is the caller graph for this function:

Member Data Documentation

◆ cache_flush_pending

bool etiss::mm::MMU::cache_flush_pending

Definition at line 177 of file MMU.h.

Referenced by SignalMMU().

◆ cpu_

ETISS_CPU* etiss::mm::MMU::cpu_
protected

Definition at line 180 of file MMU.h.

Referenced by Init().

◆ hw_page_table_walker_

const bool etiss::mm::MMU::hw_page_table_walker_
private

Definition at line 198 of file MMU.h.

Referenced by HasPageTableWalker(), and Init().

◆ mmu_control_reg_val_

uint64_t etiss::mm::MMU::mmu_control_reg_val_
private

Definition at line 193 of file MMU.h.

Referenced by Dump(), GetMMUControlReg(), and SignalMMU().

◆ mmu_enabled_

bool etiss::mm::MMU::mmu_enabled_
protected

Definition at line 182 of file MMU.h.

Referenced by Dump(), SignalMMU(), and Translate().

◆ name_

std::string etiss::mm::MMU::name_
private

Definition at line 195 of file MMU.h.

Referenced by Dump(), and GetName().

◆ pid_

uint32_t etiss::mm::MMU::pid_
private

Definition at line 194 of file MMU.h.

Referenced by Dump(), Translate(), and UpdatePid().

◆ pid_enabled_

const bool etiss::mm::MMU::pid_enabled_
private

Definition at line 197 of file MMU.h.

Referenced by Dump(), IsProcessIdEnabled(), SignalMMU(), Translate(), and UpdatePid().

◆ system_

ETISS_System* etiss::mm::MMU::system_
protected

Definition at line 181 of file MMU.h.

Referenced by Init().

◆ tlb_

std::shared_ptr<etiss::mm::TLB<0> > etiss::mm::MMU::tlb_
private

Definition at line 186 of file MMU.h.

Referenced by AddTLBEntry(), Dump(), EvictTLBEntry(), IsTLBFull(), MMU(), SignalMMU(), and Translate().

◆ tlb_entry_map_

std::map<uint64_t, PTE *> etiss::mm::MMU::tlb_entry_map_
private

Definition at line 191 of file MMU.h.

Referenced by AddTLBEntryMap(), SignalMMU(), and Translate().


The documentation for this class was generated from the following files: