41#ifndef __ARCH_ARM_MMU_HH__
42#define __ARCH_ARM_MMU_HH__
49#include "enums/ArmLookupLevel.hh"
51#include "params/ArmMMU.hh"
215 MMU(
const ArmMMUParams &
p);
217 void init()
override;
272 Translation *translation,
bool &delay,
bool timing,
bool functional,
281 Translation *translation,
bool &delay,
bool timing,
300 template <
typename OP>
304 if (tlbi_op.stage1Flush()) {
308 if (tlbi_op.stage2Flush()) {
313 template <
typename OP>
328 template <
typename OP>
336 template <
typename OP>
348 template <
typename OP>
408 bool secure,
bool functional,
414 Translation *translation,
bool timing,
bool functional,
419 Translation *translation,
bool timing,
bool functional,
425 Translation *translation,
bool timing,
441 TCR tcr,
bool is_inst, CachedState&
state);
512 auto mmu =
static_cast<MMU *
>(tc->getMMUPtr());
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
void setAttr(uint64_t attr)
Accessor functions for memory attributes for last accessed TLB entry.
bool checkPAN(ThreadContext *tc, uint8_t ap, const RequestPtr &req, Mode mode, const bool is_priv, CachedState &state)
static bool hasUnprivRegime(TranslationRegime regime)
Fault translateSe(const RequestPtr &req, ThreadContext *tc, Mode mode, Translation *translation, bool &delay, bool timing, CachedState &state)
void drainResume() override
Resume execution after a successful drain.
Fault translateComplete(const RequestPtr &req, ThreadContext *tc, Translation *translation, Mode mode, ArmTranslationType tran_type, bool call_from_s2)
TLB * getTlb(BaseMMU::Mode mode, bool stage2) const
Fault translateMmuOff(ThreadContext *tc, const RequestPtr &req, Mode mode, ArmTranslationType tran_type, Addr vaddr, bool long_desc_format, CachedState &state)
void init() override
Called at init time, this method is traversing the TLB hierarchy and pupulating the instruction/data/...
Fault getTE(TlbEntry **te, const RequestPtr &req, ThreadContext *tc, Mode mode, Translation *translation, bool timing, bool functional, bool is_secure, ArmTranslationType tran_type, bool stage2)
void flushStage2(const OP &tlbi_op)
void translateTiming(const RequestPtr &req, ThreadContext *tc, BaseMMU::Translation *translation, BaseMMU::Mode mode, bool stage2)
void iflush(const OP &tlbi_op)
CachedState & updateMiscReg(ThreadContext *tc, ArmTranslationType tran_type, bool stage2)
bool isCompleteTranslation(TlbEntry *te) const
Fault finalizePhysical(const RequestPtr &req, ThreadContext *tc, Mode mode) const override
std::pair< bool, bool > s1PermBits64(TlbEntry *te, const RequestPtr &req, Mode mode, ThreadContext *tc, CachedState &state, bool r, bool w, bool x)
Fault getResultTe(TlbEntry **te, const RequestPtr &req, ThreadContext *tc, Mode mode, Translation *translation, bool timing, bool functional, TlbEntry *mergeTe, CachedState &state)
static ExceptionLevel tranTypeEL(CPSR cpsr, SCR scr, ArmTranslationType type)
Determine the EL to use for the purpose of a translation given a specific translation type.
bool checkWalkCache() const
void translateTiming(const RequestPtr &req, ThreadContext *tc, Translation *translation, Mode mode) override
enums::ArmLookupLevel LookupLevel
void setTestInterface(SimObject *ti)
TlbEntry * lookup(Addr vpn, uint16_t asn, vmid_t vmid, bool secure, bool functional, bool ignore_asn, TranslationRegime target_regime, bool stage2, BaseMMU::Mode mode)
Lookup an entry in the TLB.
TableWalker * itbStage2Walker
void flushStage1(const OP &tlbi_op)
TableWalker * dtbStage2Walker
void flush(const OP &tlbi_op)
Fault checkPermissions64(TlbEntry *te, const RequestPtr &req, Mode mode, ThreadContext *tc, bool stage2)
Fault translateFs(const RequestPtr &req, ThreadContext *tc, Mode mode, Translation *translation, bool &delay, bool timing, ArmTranslationType tran_type, bool functional, CachedState &state)
ArmISA::TLB * getITBPtr() const
const ArmRelease * _release
gem5::ArmISA::MMU::Stats stats
std::pair< bool, bool > s2PermBits64(TlbEntry *te, const RequestPtr &req, Mode mode, ThreadContext *tc, CachedState &state, bool r, bool w, bool x)
Fault checkPermissions(TlbEntry *te, const RequestPtr &req, Mode mode, bool stage2)
bool faultPAN(ThreadContext *tc, uint8_t ap, const RequestPtr &req, Mode mode, const bool is_priv, CachedState &state)
MMU(const ArmMMUParams &p)
TableWalker * getTableWalker(BaseMMU::Mode mode, bool stage2) const
void takeOverFrom(BaseMMU *old_mmu) override
void dflush(const OP &tlbi_op)
Fault translateMmuOn(ThreadContext *tc, const RequestPtr &req, Mode mode, Translation *translation, bool &delay, bool timing, bool functional, Addr vaddr, ArmFault::TranMethod tranMethod, CachedState &state)
Fault testAndFinalize(const RequestPtr &req, ThreadContext *tc, Mode mode, TlbEntry *te, CachedState &state) const
Addr purifyTaggedAddr(Addr vaddr_tainted, ThreadContext *tc, ExceptionLevel el, TCR tcr, bool is_inst, CachedState &state)
ArmISA::TLB * getDTBPtr() const
Fault testTranslation(const RequestPtr &req, Mode mode, TlbEntry::DomainType domain, CachedState &state) const
bool hasWalkCache() const
Fault translateAtomic(const RequestPtr &req, ThreadContext *tc, Mode mode) override
TranslationGenPtr translateFunctional(Addr start, Addr size, ThreadContext *tc, Mode mode, Request::Flags flags) override
Returns a translation generator for a region of virtual addresses, instead of directly translating a ...
const ArmRelease * release() const
void flush(const TLBIOp &tlbi_op)
Flush TLB entries.
void flushAll() override
Reset the entire TLB.
std::set< BaseTLB * > instruction
It is possible from the MMU to traverse the entire hierarchy of TLBs, starting from the DTB and ITB (...
virtual Fault translateFunctional(const RequestPtr &req, ThreadContext *tc, Mode mode)
std::set< BaseTLB * > data
std::set< BaseTLB * > unified
This class takes a function as a constructor argument and memoizes it: every time the function gets i...
Abstract superclass for simulation objects.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
This is a simple scalar statistic, like a counter.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::shared_ptr< FaultBase > Fault
std::shared_ptr< Request > RequestPtr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
std::unique_ptr< TranslationGen > TranslationGenPtr
int ContextID
Globally unique thread context ID.
ExceptionLevel exceptionLevel
void updateMiscReg(ThreadContext *tc, ArmTranslationType tran_type)
vmid_t getVMID(ThreadContext *tc) const
Returns the current VMID (information stored in the VTTBR_EL2 register)
CachedState & operator=(const CachedState &rhs)
CachedState(MMU *_mmu, bool stage2)
Memoizer< int, ThreadContext *, bool, bool, TCR, ExceptionLevel > computeAddrTop
ArmTranslationType curTranType
TranslationRegime currRegime
Stats(statistics::Group *parent)
statistics::Scalar permsFaults
statistics::Scalar alignFaults
statistics::Scalar prefetchFaults
statistics::Scalar domainFaults