50#include "debug/MMU.hh"
52#include "params/ArmMMU.hh"
116 if (
static_cast<TLB*
>(
tlb)->walkCache())
120 if (
static_cast<TLB*
>(
tlb)->walkCache())
124 if (
static_cast<TLB*
>(
tlb)->walkCache())
212 s1State.computeAddrTop.flush();
213 s2State.computeAddrTop.flush();
306 const Addr paddr = req->getPaddr();
311 req->setLocalAccessor(
334 Translation *translation,
bool &delay,
bool timing,
338 Addr vaddr_tainted = req->getVaddr();
344 vaddr = vaddr_tainted;
355 return std::make_shared<DataAbort>(
365 if (
const auto pte =
p->pTable->lookup(
vaddr); !pte) {
366 return std::make_shared<GenericPageTableFault>(vaddr_tainted);
368 req->setPaddr(pte->paddr +
p->pTable->pageOffset(
vaddr));
381 Addr purified_vaddr = 0;
384 static_cast<TCR
>(state.ttbcr),
mode==
Execute, state);
386 purified_vaddr =
vaddr;
388 return purified_vaddr;
404 if (req->isCacheMaintenance()) {
422 if (state.
isStage2 && req->isPTWalk() && state.
hcr.ptw &&
424 return std::make_shared<DataAbort>(
436 return std::make_shared<DataAbort>(
444 if (
te->nonCacheable) {
446 if (req->isPrefetch()) {
449 return std::make_shared<PrefetchAbort>(
455 if (!
te->longDescFormat) {
456 switch ((state.
dacr >> (
static_cast<uint8_t
>(
te->domain) * 2)) & 0x3) {
458 stats.domainFaults++;
459 DPRINTF(
MMU,
"MMU Fault: Data abort on domain. DACR: %#x"
460 " domain: %#x write:%d\n", state.
dacr,
461 static_cast<uint8_t
>(
te->domain), is_write);
466 return std::make_shared<PrefetchAbort>(
471 return std::make_shared<DataAbort>(
479 panic(
"UNPRED domain\n");
486 uint8_t ap =
te->longDescFormat ?
te->ap << 1 :
te->ap;
487 uint8_t hap =
te->hap;
489 if (state.
sctlr.afe == 1 ||
te->longDescFormat)
493 bool isWritable =
true;
502 DPRINTF(
MMU,
"Access permissions 0, checking rs:%#x\n",
503 (
int)state.
sctlr.rs);
504 if (!state.
sctlr.xp) {
505 switch ((
int)state.
sctlr.rs) {
510 abt = is_write || !is_priv;
526 abt = !is_priv && is_write;
527 isWritable = is_priv;
533 panic(
"UNPRED premissions\n");
535 abt = !is_priv || is_write;
544 panic(
"Unknown permissions %#x\n", ap);
548 bool hapAbt = is_write ? !(hap & 2) : !(hap & 1);
549 bool xn =
te->xn || (isWritable && state.
sctlr.wxn) ||
550 (ap == 3 && state.
sctlr.uwxn && is_priv);
551 if (is_fetch && (abt || xn ||
552 (
te->longDescFormat &&
te->pxn && is_priv) ||
554 te->ns && state.
scr.sif))) {
556 DPRINTF(
MMU,
"MMU Fault: Prefetch abort on permission check. AP:%d "
557 "priv:%d write:%d ns:%d sif:%d sctlr.afe: %d \n",
558 ap, is_priv, is_write,
te->ns,
562 return std::make_shared<PrefetchAbort>(
566 }
else if (abt | hapAbt) {
568 DPRINTF(
MMU,
"MMU Fault: Data abort on permission check. AP:%d priv:%d"
569 " write:%d\n", ap, is_priv, is_write);
570 return std::make_shared<DataAbort>(
573 state.
isStage2 | !abt, tran_method);
600 Addr vaddr_tainted = req->getVaddr();
604 bool is_write = !req->isCacheClean() &&
mode ==
Write;
605 bool is_atomic = req->isAtomic();
613 if (state.
isStage2 && req->isPTWalk() && state.
hcr.ptw &&
615 return std::make_shared<DataAbort>(
616 vaddr_tainted,
te->domain, is_write,
627 return std::make_shared<DataAbort>(
630 is_atomic ?
false : is_write,
637 if (
te->nonCacheable) {
639 if (req->isPrefetch()) {
642 return std::make_shared<PrefetchAbort>(
654 bool grant_read =
true;
658 (!is_write && !is_fetch), is_write, is_fetch);
661 (!is_write && !is_fetch), is_write, is_fetch);
667 DPRINTF(
MMU,
"MMU Fault: Prefetch abort on permission check. "
668 "ns:%d scr.sif:%d sctlr.afe: %d\n",
672 return std::make_shared<PrefetchAbort>(
678 DPRINTF(
MMU,
"MMU Fault: Data abort on permission check."
680 return std::make_shared<DataAbort>(
681 vaddr_tainted,
te->domain,
682 (is_atomic && !grant_read) ?
false : is_write,
701 bool grant_read =
te->hap & 0b01;
702 bool grant_write =
te->hap & 0b10;
705 uint8_t pxn =
te->pxn;
709 te->ns && state.
scr.sif) {
714 "Checking S2 permissions: hap:%d, xn:%d, pxn:%d, r:%d, "
715 "w:%d, x:%d\n",
te->hap, xn, pxn,
r,
w,
x);
719 }
else if (req->isAtomic()) {
720 grant = grant_read || grant_write;
726 panic(
"Invalid Operation\n");
729 return std::make_pair(grant, grant_read);
732std::tuple<bool, bool, bool>
735 bool r,
bool w,
bool x)
737 const bool is_priv = state.
isPriv && !(req->getFlags() &
UserMode);
743 uint8_t pxn =
te->pxn;
746 uint8_t piindex =
te->piindex;
747 uint8_t ppi =
bits(state.
pir, 4 * piindex + 3, 4 * piindex);
748 uint8_t upi =
bits(state.
pire0, 4 * piindex + 3, 4 * piindex);
750 DPRINTF(
MMU,
"Checking S1 indirect permissions: "
751 "piindex:%d, ppi:%d, xn:%d, pxn:%d, r:%d, "
752 "w:%d, x:%d, is_priv: %d, wxn: %d\n", piindex, ppi,
753 xn, pxn,
r,
w,
x, is_priv,
wxn);
760 bool p_wxn = ppi == 0b0110;
763 case 0b0000:
pr = 0; pw = 0;
px = 0;
break;
765 case 0b0001:
pr = 1; pw = 0;
px = 0;
break;
767 case 0b0010:
pr = 0; pw = 0;
px = 1;
break;
769 case 0b0011:
pr = 1; pw = 0;
px = 1;
break;
771 case 0b0100:
pr = 0; pw = 0;
px = 0;
break;
773 case 0b0101:
pr = 1; pw = 1;
px = 0;
break;
775 case 0b0110:
pr = 1; pw = 1;
px = 1;
break;
777 case 0b0111:
pr = 1; pw = 1;
px = 1;
break;
779 case 0b1000:
pr = 1; pw = 0;
px = 0;
break;
781 case 0b1001:
pr = 1; pw = 0;
px = 0;
break;
783 case 0b1010:
pr = 1; pw = 0;
px = 1;
break;
785 case 0b1011:
pr = 0; pw = 0;
px = 0;
break;
787 case 0b1100:
pr = 1; pw = 1;
px = 0;
break;
789 case 0b1101:
pr = 0; pw = 0;
px = 0;
break;
791 case 0b1110:
pr = 1; pw = 1;
px = 1;
break;
793 case 0b1111:
pr = 0; pw = 0;
px = 0;
break;
803 bool u_wxn = upi == 0b0110;
806 case 0b0000: ur = 0;
uw = 0;
ux = 0;
break;
808 case 0b0001: ur = 1;
uw = 0;
ux = 0;
break;
810 case 0b0010: ur = 0;
uw = 0;
ux = 1;
break;
812 case 0b0011: ur = 1;
uw = 0;
ux = 1;
break;
814 case 0b0100: ur = 0;
uw = 0;
ux = 0;
break;
816 case 0b0101: ur = 1;
uw = 1;
ux = 0;
break;
818 case 0b0110: ur = 1;
uw = 1;
ux = 1;
break;
820 case 0b0111: ur = 1;
uw = 1;
ux = 1;
break;
822 case 0b1000: ur = 1;
uw = 0;
ux = 0;
break;
824 case 0b1001: ur = 1;
uw = 0;
ux = 0;
break;
826 case 0b1010: ur = 1;
uw = 0;
ux = 1;
break;
828 case 0b1011: ur = 0;
uw = 0;
ux = 0;
break;
830 case 0b1100: ur = 1;
uw = 1;
ux = 0;
break;
832 case 0b1101: ur = 0;
uw = 0;
ux = 0;
break;
834 case 0b1110: ur = 1;
uw = 1;
ux = 1;
break;
836 case 0b1111: ur = 0;
uw = 0;
ux = 0;
break;
840 bool pan_access = !req->isCacheMaintenance() ||
843 if (
_release->has(ArmExtension::FEAT_PAN) && pan_access) {
844 if (state.
cpsr.pan && upi != 0) {
850 grant_read = is_priv ?
pr : ur;
851 grant_write = is_priv ? pw :
uw;
852 grant_exec = is_priv ?
px :
ux;
853 wxn = is_priv ? p_wxn : u_wxn;
863 grant_exec = grant_exec && !(
wxn && grant_write);
867 grant_exec = grant_exec && !state.
scr.sif;
870 return std::make_tuple(grant_read, grant_write, grant_exec);
873std::tuple<bool, bool, bool>
876 bool r,
bool w,
bool x)
878 const uint8_t ap =
te->ap & 0b11;
879 const bool is_priv = state.
isPriv && !(req->getFlags() &
UserMode);
883 uint8_t pxn =
te->pxn;
885 DPRINTF(
MMU,
"Checking S1 direct permissions: ap:%d, xn:%d, pxn:%d, r:%d, "
886 "w:%d, x:%d, is_priv: %d, wxn: %d\n", ap, xn,
887 pxn,
r,
w,
x, is_priv,
wxn);
904 pr = 1; pw = 1; ur = 0;
uw = 0;
907 pr = 1; pw = 1; ur = 1;
uw = 1;
910 pr = 1; pw = 0; ur = 0;
uw = 0;
913 pr = 1; pw = 0; ur = 1;
uw = 0;
919 const bool px = !(pxn ||
uw);
923 bool pan_access = !req->isCacheMaintenance() ||
926 if (
_release->has(ArmExtension::FEAT_PAN) && pan_access) {
932 grant_read = is_priv ?
pr : ur;
933 grant_write = is_priv ? pw :
uw;
934 grant_exec = is_priv ?
px :
ux;
936 switch (
bits(ap, 1)) {
938 grant_read = 1; grant_write = 1;
941 grant_read = 1; grant_write = 0;
949 grant_exec = grant_exec && !(
wxn && grant_write);
953 grant_exec = grant_exec && !state.
scr.sif;
956 return std::make_tuple(grant_read, grant_write, grant_exec);
962 bool r,
bool w,
bool x)
965 bool grant_read =
true, grant_write =
true, grant_exec =
true;
969 std::tie(grant_read, grant_write, grant_exec) =
972 std::tie(grant_read, grant_write, grant_exec) =
978 }
else if (req->isAtomic()) {
979 grant = grant_read && grant_write;
986 return std::make_pair(grant, grant_read);
1006 const bool selbit =
bits(vaddr_tainted, 55);
1020 bool is_atomic = req->isAtomic();
1021 req->setPaddr(
vaddr);
1036 f = std::make_shared<PrefetchAbort>(
vaddr,
1040 f = std::make_shared<DataAbort>(
vaddr,
1050 if (long_desc_format || state.
sctlr.tre == 0 || state.
nmrr.ir0 == 0 ||
1051 state.
nmrr.or0 == 0 || state.
prrr.tr0 != 0x2) {
1052 if (!req->isCacheMaintenance()) {
1061 temp_te.
ns = !in_secure_state;
1062 bool dc = (
HaveExt(tc, ArmExtension::FEAT_VHE) &&
1063 state.
hcr.e2h == 1 && state.
hcr.tge == 1) ? 0: state.
hcr.dc;
1064 bool i_cacheability = state.
sctlr.i && !state.
sctlr.m;
1068 temp_te.
innerAttrs = i_cacheability? 0x2: 0x0;
1069 temp_te.
outerAttrs = i_cacheability? 0x2: 0x0;
1080 DPRINTF(
MMU,
"(No MMU) setting memory attributes: shareable: "
1081 "%d, innerAttrs: %d, outerAttrs: %d, stage2: %d\n",
1091 Translation *translation,
bool &delay,
bool timing,
1100 Addr vaddr_tainted = req->getVaddr();
1103 functional, &mergeTe, state);
1112 "Setting memory attributes: shareable: %d, innerAttrs: %d, "
1113 "outerAttrs: %d, mtype: %d, stage2: %d\n",
1114 te->shareable,
te->innerAttrs,
te->outerAttrs,
1115 static_cast<uint8_t
>(
te->mtype), state.
isStage2);
1118 if (
te->nonCacheable && !req->isCacheMaintenance())
1135 if (!is_fetch && fault ==
NoFault &&
1140 stats.alignFaults++;
1142 return std::make_shared<DataAbort>(
1158 Translation *translation,
bool &delay,
bool timing,
1163 assert(!(timing && functional));
1165 Addr vaddr_tainted = req->getVaddr();
1171 vaddr = vaddr_tainted;
1182 "CPSR is priv:%d UserMode:%d secure:%d S1S2NsTran:%d\n",
1187 DPRINTF(
MMU,
"translateFs addr %#x, mode %d, st2 %d, scr %#x sctlr %#x "
1188 "flags %#lx tranType 0x%x\n", vaddr_tainted,
mode,
1192 if ((req->isInstFetch() && (!state.
sctlr.i)) ||
1193 ((!req->isInstFetch()) && (!state.
sctlr.c))){
1194 if (!req->isCacheMaintenance()) {
1203 stats.alignFaults++;
1204 return std::make_shared<DataAbort>(
1213 bool vm = state.
hcr.vm;
1214 if (
HaveExt(tc, ArmExtension::FEAT_VHE) &&
1215 state.
hcr.e2h == 1 && state.
hcr.tge == 1)
1217 else if (state.
hcr.dc == 1)
1224 long_desc_format, state);
1226 DPRINTF(
MMU,
"Translating %s=%#x context=%d\n",
1227 state.
isStage2 ?
"IPA" :
"VA", vaddr_tainted, state.
asid);
1230 functional,
vaddr, tran_method, state);
1236 if (
sd->enabled() && fault ==
NoFault) {
1237 fault =
sd->testDebug(tc, req,
mode);
1260 tran_type,
false, state);
1290 tran_type,
true, state);
1304 assert(translation);
1327 fault =
translateFs(req, tc,
mode, translation, delay,
true, tran_type,
1332 DPRINTF(
MMU,
"Translation returning delay=%d fault=%d\n", delay,
1341 if (translation && (call_from_s2 || !state.
stage2Req || req->hasPaddr() ||
1358 switch (mmfr1.vmidbits) {
1373 panic(
"Reserved ID_AA64MMFR1_EL1.VMIDBits value: %#x",
1390 ((tran_type == state.curTranType) || stage2)) {
1394 state.updateMiscReg(tc, tran_type);
1400 static_cast<TLB*
>(
tlb)->setVMID(state.vmid);
1403 static_cast<TLB*
>(
tlb)->setVMID(state.vmid);
1406 static_cast<TLB*
>(
tlb)->setVMID(state.vmid);
1412 if (state.directToStage2) {
1413 s2State.updateMiscReg(tc, tran_type);
1447 if (
mmu->release()->has(ArmExtension::FEAT_S1PIE)) {
1452 uint64_t ttbr_asid =
ttbcr.a1 ?
1456 (
mmu->haveLargeAsid64 &&
ttbcr.as) ? 63 : 55, 48);
1465 if (
mmu->release()->has(ArmExtension::FEAT_S1PIE)) {
1470 uint64_t ttbr_asid =
ttbcr.a1 ?
1474 (
mmu->haveLargeAsid64 &&
ttbcr.as) ? 63 : 55, 48);
1481 if (
mmu->release()->has(ArmExtension::FEAT_S1PIE)) {
1490 if (
mmu->release()->has(ArmExtension::FEAT_S1PIE)) {
1499 if (
mmu->release()->has(ArmExtension::VIRTUALIZATION)) {
1502 if (
HaveExt(tc, ArmExtension::FEAT_VHE) &&
1503 hcr.e2h == 1 &&
hcr.tge ==1) {
1546 asid = context_id.asid;
1555 if (
mmu->release()->has(ArmExtension::VIRTUALIZATION)) {
1602 return currEL(cpsr) ==
EL3 && scr.ns == 0 ?
1609 panic(
"Unknown translation mode!\n");
1615 Translation *translation,
bool timing,
bool functional,
1619 return getTE(
te, req, tc,
mode, translation, timing, functional,
1632 lookup_data.
va =
va;
1635 lookup_data.
vmid = vmid;
1636 lookup_data.
ss =
ss;
1641 return tlb->multiLookup(lookup_data);
1646 Translation *translation,
bool timing,
bool functional,
1656 Addr vaddr_tainted = req->getVaddr();
1664 vaddr = vaddr_tainted;
1671 if (req->isPrefetch()) {
1675 stats.prefetchFaults++;
1676 return std::make_shared<PrefetchAbort>(
1683 "TLB Miss: Starting hardware table walker for %#x(%d:%d)\n",
1684 vaddr_tainted, state.
asid, state.
vmid);
1689 translation, timing, functional,
ss,
1693 if (timing || fault !=
NoFault) {
1707 Translation *translation,
bool timing,
bool functional,
1720 fault =
getTE(&s2_te, req, tc,
mode, translation, timing, functional,
1736 Addr vaddr_tainted = req->getVaddr();
1739 fault =
getTE(&s1_te, req, tc,
mode, translation, timing, functional,
1751 req, translation,
mode, timing, functional,
1753 fault = s2_lookup->
getTe(tc, mergeTe);
1768 DPRINTF(
MMU,
"s2TLB: reqVa %#x, reqPa %#x, fault %p\n",
1769 vaddr_tainted, req->hasPaddr() ? req->getPaddr() : ~0,
1772 auto arm_fault =
reinterpret_cast<ArmFault*
>(fault.get());
1786 return entry && !entry->
partial;
1794 auto *ommu =
dynamic_cast<MMU*
>(old_mmu);
1797 _attr = ommu->_attr;
1810 fatal_if(!
ti,
"%s is not a valid ARM TLB tester\n", _ti->
name());
1823 if (!
test || !req->hasSize() || req->getSize() == 0 ||
1824 req->isCacheMaintenance()) {
1834 "Number of MMU faults due to alignment restrictions"),
1836 "Number of MMU faults due to prefetch"),
1838 "Number of MMU faults due to domain restrictions"),
1840 "Number of MMU faults due to permissions restrictions")
virtual void annotate(AnnotationIDs id, uint64_t val)
SelfDebug * getSelfDebug() const
Fault translateMmuOn(ThreadContext *tc, const RequestPtr &req, Mode mode, Translation *translation, bool &delay, bool timing, bool functional, Addr vaddr, TranMethod tran_method, CachedState &state)
std::tuple< bool, bool, bool > s1IndirectPermBits64(TlbEntry *te, const RequestPtr &req, Mode mode, ThreadContext *tc, CachedState &state, bool r, bool w, bool x)
ArmISA::TLB * getITBPtr() const
void setAttr(uint64_t attr)
Accessor functions for memory attributes for last accessed TLB entry.
void flushStage2(const TLBIOp &tlbi_op)
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)
Fault testTranslation(const RequestPtr &req, Mode mode, DomainType domain, CachedState &state) const
void init() override
Called at init time, this method is traversing the TLB hierarchy and pupulating the instruction/data/...
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)
void flushStage1(const TLBIOp &tlbi_op)
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.
std::tuple< bool, bool, bool > s1DirectPermBits64(TlbEntry *te, const RequestPtr &req, Mode mode, ThreadContext *tc, CachedState &state, bool r, bool w, bool x)
ArmISA::TLB * getDTBPtr() const
bool checkWalkCache() const
void translateTiming(const RequestPtr &req, ThreadContext *tc, Translation *translation, Mode mode) override
void setTestInterface(SimObject *ti)
TableWalker * itbStage2Walker
Addr getValidAddr(Addr vaddr, ThreadContext *tc, Mode mode) override
TableWalker * dtbStage2Walker
Fault getTE(TlbEntry **te, const RequestPtr &req, ThreadContext *tc, Mode mode, Translation *translation, bool timing, bool functional, SecurityState ss, PASpace ipaspace, ArmTranslationType tran_type, bool stage2)
void dflush(const TLBIOp &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)
TlbEntry * lookup(Addr vpn, uint16_t asn, vmid_t vmid, SecurityState ss, bool functional, bool ignore_asn, TranslationRegime target_regime, bool stage2, BaseMMU::Mode mode)
Lookup an entry in the TLB.
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)
void flush(const TLBIOp &tlbi_op)
Fault checkPermissions(TlbEntry *te, const RequestPtr &req, Mode mode, bool stage2)
MMU(const ArmMMUParams &p)
TableWalker * getTableWalker(BaseMMU::Mode mode, bool stage2) const
void takeOverFrom(BaseMMU *old_mmu) override
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)
void iflush(const TLBIOp &tlbi_op)
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 ...
Fault getTe(ThreadContext *tc, TlbEntry *destTe)
virtual bool stage1Flush() const
Return true if the TLBI op needs to flush stage1 entries, Defaulting to true in the TLBIOp abstract c...
virtual bool stage2Flush() const
Return true if the TLBI op needs to flush stage2 entries, Defaulting to false in the TLBIOp abstract ...
void setTableWalker(TableWalker *table_walker)
Fault walk(const RequestPtr &req, ThreadContext *tc, uint16_t asid, vmid_t _vmid, BaseMMU::Mode mode, BaseMMU::Translation *_trans, bool timing, bool functional, SecurityState ss, PASpace ipaspace, MMU::ArmTranslationType tran_type, bool stage2, const TlbEntry *walk_entry)
uint8_t physAddrRange() const
Returns the supported physical address range in bits.
bool haveLargeAsid64() const
Returns true if ASID is 16 bits in AArch64 (ARMv8)
static bool haveEL(ThreadContext *tc, ArmISA::ExceptionLevel el)
Return true if the system implements a specific exception level.
const ArmRelease * releaseFS() const
virtual void finish(const Fault &fault, const RequestPtr &req, ThreadContext *tc, BaseMMU::Mode mode)=0
virtual void markDelayed()=0
Signal that the translation has been delayed due to a hw page table walk.
std::set< BaseTLB * > instruction
It is possible from the MMU to traverse the entire hierarchy of TLBs, starting from the DTB and ITB (...
void init() override
Called at init time, this method is traversing the TLB hierarchy and pupulating the instruction/data/...
virtual void takeOverFrom(BaseMMU *old_mmu)
std::set< BaseTLB * > data
std::set< BaseTLB * > unified
Cycles is a wrapper class for representing cycle counts, i.e.
virtual std::string name() const
void setLE(T v)
Set the value in the data pointer to v as little endian.
@ SECURE
The request targets the secure memory space.
@ STRICT_ORDER
The request is required to be strictly ordered by CPU models and is non-speculative.
@ UNCACHEABLE
The request is to an uncacheable address.
@ CACHE_BLOCK_ZERO
This is a write that is targeted and zeroing an entire cache block.
gem5::Flags< FlagsType > Flags
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual RegVal readMiscReg(RegIndex misc_reg)=0
virtual Process * getProcessPtr()=0
virtual ContextID contextId() const =0
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
#define panic(...)
This implements a cprintf based panic() function.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
SimObject(const Params &p)
void tagRequest(ThreadContext *tc, const RequestPtr &req, bool ind)
Tag a memory request with MPAM information.
ExceptionLevel currEL(const ThreadContext *tc)
Returns the current Exception Level (EL) of the provided ThreadContext.
bool isSecure(ThreadContext *tc)
Addr maskTaggedAddr(Addr addr, ThreadContext *tc, ExceptionLevel el, int topbit)
bool longDescFormatInUse(ThreadContext *tc)
bool ELIs64(ThreadContext *tc, ExceptionLevel el)
TranslationRegime translationRegime(ThreadContext *tc, ExceptionLevel el)
bool EL2Enabled(ThreadContext *tc)
ExceptionLevel translationEl(TranslationRegime regime)
SecurityState
Security State.
int computeAddrTop(ThreadContext *tc, bool selbit, bool is_instr, TCR tcr, ExceptionLevel el)
@ MISCREG_ID_AA64MMFR1_EL1
int snsBankedIndex(MiscRegIndex reg, ThreadContext *tc)
bool inAArch64(ThreadContext *tc)
PASpace
Physical Address Space.
bool HaveExt(ThreadContext *tc, ArmExtension ext)
Returns true if the provided ThreadContext supports the ArmExtension passed as a second argument.
static void decodeAddrOffset(Addr offset, uint8_t &func)
bool pseudoInst(ThreadContext *tc, uint8_t func, uint64_t &result)
Copyright (c) 2024 Arm Limited 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.
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
constexpr decltype(nullptr) NoFault
ExceptionLevel exceptionLevel
SecurityState securityState
void updateMiscReg(ThreadContext *tc, ArmTranslationType tran_type)
vmid_t getVMID(ThreadContext *tc) const
Returns the current VMID (information stored in the VTTBR_EL2 register)
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
TranslationRegime targetRegime
void setAttributes(bool lpae)
TLBTypes::KeyType KeyType
The file contains the definition of a set of TLB Invalidate Instructions.