Go to the documentation of this file.
63 if (src_mode == Enums::Full) {
99 static_cast<MMU *
>(dest->
getMMUPtr())->invalidateMiscReg();
138 route_to_el2 = (hdcr.tde == 1 || hcr.tge == 1);
142 route_to_el2 = (mdcr.tde == 1 || hcr.tge == 1);
145 route_to_el2 =
false;
180 switch (current_el) {
186 warn_once(
"Trying to read MPIDR at EL0\n");
197 panic(
"Invalid EL for reading MPIDR register\n");
215 assert((0 <= tc->
cpuId()) && (tc->
cpuId() < 256));
218 RegVal mpidr = 0x80000000;
259 return id_aa64isar1.api | id_aa64isar1.apa |
260 id_aa64isar1.gpi | id_aa64isar1.gpa;
267 return id_aa64mmfr1.vh;
274 return (
bool)mm_fr2.varange;
296 return id_aa64pfr0.sel2;
332 panic_if(!known,
"EL state is UNKNOWN");
374 panic_if(
el ==
EL2 && !have_el2,
"Asking for EL2 when it doesn't exist");
375 panic_if(
el ==
EL3 && !have_el3,
"Asking for EL3 when it doesn't exist");
378 known = aarch32 =
false;
382 known =
true; aarch32 =
false;
383 }
else if (secure &&
el ==
EL2) {
384 known =
true; aarch32 =
false;
387 known =
true; aarch32 =
true;
389 known =
true; aarch32 =
false;
392 bool aarch32_below_el3 = have_el3 && scr.rw == 0 &&
397 bool aarch32_at_el1 = (aarch32_below_el3 ||
398 (have_el2 && (sec_el2 || !secure) &&
399 hcr.rw == 0 && !(hcr.e2h && hcr.tge &&
403 if (
el ==
EL0 && !aarch32_at_el1) {
407 aarch32 = (cpsr.width == 1);
410 aarch32 = (aarch32_below_el3 &&
el !=
EL3)
411 || (aarch32_at_el1 && (
el ==
EL0 ||
el ==
EL1) );
415 return std::make_pair(known, aarch32);
423 panic_if(!known,
"EL state is UNKNOWN");
440 panic(
"Invalid exception level");
471 tbi = selbit? tcr.tbi1 : tcr.tbi0;
472 tbid = selbit? tcr.tbid1 : tcr.tbid0;
479 tbi = selbit? tcr.tbi1 : tcr.tbi0;
480 tbid = selbit? tcr.tbid1 : tcr.tbid0;
499 int res = (
tbi && (!
tbid || !isInstr))? 55: 63;
504 TCR tcr,
bool isInstr)
512 uint64_t
mask = ((uint64_t)0x1 << topbit) -1;
547 return std::make_shared<HypervisorTrap>(machInst,
imm,
ec);
561 bool trapToHype =
false;
572 trapToHype = ((uint32_t) hstr) & (1 << crn);
573 trapToHype |= hdcr.tpm && (crn == 9) && (crm >= 12);
574 trapToHype |= hcr.tidcp && (
575 ((crn == 9) && ((crm <= 2) || ((crm >= 5) && (crm <= 8)))) ||
576 ((crn == 10) && ((crm <= 1) || (crm == 4) || (crm == 8))) ||
577 ((crn == 11) && ((crm <= 8) || (crm == 15))) );
582 trapToHype = hcptr.tcpac;
588 trapToHype = hcr.tid1;
594 trapToHype = hcr.tid2;
612 trapToHype = hcr.tid3;
617 trapToHype = hcr.tsw;
622 trapToHype = hcr.tpc;
628 trapToHype = hcr.tpu;
648 trapToHype = hcr.ttlb;
651 trapToHype = hcr.tac;
669 trapToHype = hcr.tvm & !isRead;
672 trapToHype = hdcr.tpmcr;
678 if (isa->haveGICv3CpuIfc())
679 trapToHype = hcr.fmo;
686 if (isa->haveGICv3CpuIfc())
687 trapToHype = hcr.imo;
710 HDCR hdcr, HSTR hstr, HCPTR hcptr, uint32_t iss)
718 bool trapToHype =
false;
722 inform(
"trap check M:%x N:%x 1:%x 2:%x hdcr %x, hcptr %x, hstr %x\n",
723 crm, crn, opc1,
opc2, hdcr, hcptr, hstr);
724 trapToHype = hdcr.tda && (opc1 == 0);
725 trapToHype |= hcptr.tta && (opc1 == 1);
732 trapToHype = hdcr.tdosa;
736 trapToHype = hdcr.tdra;
739 trapToHype = hcr.tid0;
743 trapToHype = hstr.tjdbx;
747 trapToHype = hstr.ttee;
764 return std::make_shared<HypervisorTrap>(machInst,
imm,
ec);
778 bool trapToHype =
false;
790 trapToHype = ((uint32_t) hstr) & (1 << crm);
810 trapToHype = hcr.tvm & !isRead;
836 return std::make_shared<SupervisorTrap>(machInst,
imm,
ec);
839 return std::make_shared<HypervisorTrap>(machInst,
imm,
ec);
889 if (
ELIs32(tc,
EL1) && trap_cond && hcr.tge) {
912 return !cnthctl.el1pcten;
914 return !cnthctl.el1pcen;
931 return !(
EL2Enabled(tc) && hcr.e2h && hcr.tge) && trap_cond &&
948 return !cntkctl.el0pcten && !cntkctl.el0vcten;
951 return !cntkctl.el0pcten;
954 return !cntkctl.el0vcten;
957 return !cntkctl.el0pten;
960 return !cntkctl.el0vten;
1023 return (!
ELIs32(tc,
EL1) && !hcr.e2h && trap_cond_el1 && hcr.tge) ||
1024 (
ELIs32(tc,
EL1) && trap_cond_el1 && hcr.tge) ||
1025 (hcr.e2h && hcr.tge && trap_cond_el2);
1039 return !hcr.e2h && trap_cond_1;
1042 return (!hcr.e2h && trap_cond_0) ||
1043 (hcr.e2h && !hcr.tge && trap_cond_1);
1065 return (!hcr.e2h && trap_cond_0) ||
1066 (hcr.e2h && trap_cond_1);
1079 return !
ELIs32(tc,
EL1) && !(hcr.e2h && hcr.tge) && trap_cond;
1090 return !cnthctl.el0pcten && !cnthctl.el0vcten;
1093 return !cnthctl.el0pcten;
1096 return !cnthctl.el0vcten;
1099 return !cnthctl.el0pten;
1102 return !cnthctl.el0vten;
1116 const CNTHCTL cnthctl = cnthctl_val;
1117 const CNTHCTL_E2H cnthctl_e2h = cnthctl_val;
1121 return hcr.e2h ? !cnthctl_e2h.el1pcten : !cnthctl.el1pcten;
1127 return hcr.e2h ? cnthctl_e2h.el1tvct : cnthctl.el1tvct;
1130 return hcr.e2h ? !cnthctl_e2h.el1pten :
false;
1136 return hcr.e2h ? cnthctl_e2h.el1tvt : cnthctl.el1tvt;
1148 return !cnthctl.el1pcen;
1159 return currEL(tc) ==
EL1 && !scr.ns && !scr.st;
1169 CPSR cpsr, SCR scr, NSACR nsacr,
bool checkSecurity)
1214 int sysM4To3 =
bits(sysM, 4, 3);
1216 if (sysM4To3 == 0) {
1219 }
else if (sysM4To3 == 1) {
1222 }
else if (sysM4To3 == 3) {
1223 if (
bits(sysM, 1) == 0) {
1228 if (
bits(sysM, 0) == 1) {
1236 int sysM2 =
bits(sysM, 2);
1237 int sysM1 =
bits(sysM, 1);
1241 ((sysM2 && !sysM1) << 2) |
1242 ((sysM2 && sysM1) << 3) |
1247 ok &=
mode != cpsr.mode;
1252 if (ok && checkSecurity &&
mode != cpsr.mode) {
1279 panic(
"unknown Mode 0x%x\n", cpsr.mode);
1291 bool have_nv_ext =
false;
1294 have_nv_ext && hcr.nv == 1 && hcr.nv1 == 1);
1296 currEL(tc) ==
EL2 && hcr.e2h == 1 && hcr.tge == 1;
1299 bool user_access_override =
false;
1300 return (unpriv_el1 || unpriv_el2) && !user_access_override;
1322 panic(
"Invalid exception level");
1346 panic(
"Invalid phys. address range encoding");
1369 panic(
"Invalid phys. address range");
void sendEvent(ThreadContext *tc)
Send an event (SEV) to a specific PE if there isn't already a pending event.
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
bool isGenericTimerSystemAccessTrapEL3(const MiscRegIndex miscReg, ThreadContext *tc)
@ MISCREG_ID_AA64MMFR2_EL1
virtual RegVal readIntRegFlat(RegIndex idx) const =0
Flat register interfaces.
bool ELIsInHost(ThreadContext *tc, ExceptionLevel el)
Returns true if the current exception level el is executing a Host OS or an application of a Host OS ...
void copyRegs(ThreadContext *src, ThreadContext *dest)
bool EL2Enabled(ThreadContext *tc)
uint8_t encodePhysAddrRange64(int pa_size)
Returns the encoding corresponding to the specified n.
ExceptionLevel debugTargetFrom(ThreadContext *tc, bool secure)
RegVal getAffinity(ArmSystem *arm_sys, ThreadContext *tc)
Retrieves MPIDR_EL1.
int computeAddrTop(ThreadContext *tc, bool selbit, bool isInstr, TCR tcr, ExceptionLevel el)
@ MISCREG_ID_AA64ISAR1_EL1
bool HaveVirtHostExt(ThreadContext *tc)
bool HaveLVA(ThreadContext *tc)
bool isGenericTimerVirtSystemAccessTrapEL2(const MiscRegIndex miscReg, ThreadContext *tc)
static Enums::VecRegRenameMode mode(const TheISA::PCState &)
bool highestELIs64() const
Returns true if the register width of the highest implemented exception level is 64 bits (ARMv8)
bool isGenericTimerPhysEL1SystemAccessTrapEL2(const MiscRegIndex miscReg, ThreadContext *tc)
bool isGenericTimerCommonEL0SystemAccessTrapEL2(const MiscRegIndex miscReg, ThreadContext *tc)
bool badMode32(ThreadContext *tc, OperatingMode mode)
badMode is checking if the execution mode provided as an argument is valid and implemented for AArch3...
static ExceptionLevel currEL(const ThreadContext *tc)
virtual BaseMMU * getMMUPtr()=0
bool condGenericTimerCommonEL1SystemAccessTrapEL2(const MiscRegIndex miscReg, ThreadContext *tc)
bool isAArch64AArch32SystemAccessTrapEL1(const MiscRegIndex miscReg, ThreadContext *tc)
bool isGenericTimerHypTrap(const MiscRegIndex miscReg, ThreadContext *tc, ExceptionClass *ec)
static bool inSecureState(SCR scr, CPSR cpsr)
@ EC_TRAPPED_CP15_MCRR_MRRC
static RegVal getAff1(ArmSystem *arm_sys, ThreadContext *tc)
int decodePhysAddrRange64(uint8_t pa_enc)
Returns the n.
void postInterrupt(ThreadID tid, int int_num, int index)
bool condGenericTimerPhysHypTrap(const MiscRegIndex miscReg, ThreadContext *tc)
bool mcrrMrrc15TrapToHyp(const MiscRegIndex miscReg, ThreadContext *tc, uint32_t iss, ExceptionClass *ec)
bool HaveSecureEL2Ext(ThreadContext *tc)
bool mcrMrc15TrapToHyp(const MiscRegIndex miscReg, ThreadContext *tc, uint32_t iss, ExceptionClass *ec)
RegVal getMPIDR(ArmSystem *arm_sys, ThreadContext *tc)
This helper function is returning the value of MPIDR_EL1.
bool condGenericTimerPhysEL1SystemAccessTrapEL2(const MiscRegIndex miscReg, ThreadContext *tc)
Fault AArch64AArch32SystemAccessTrap(const MiscRegIndex miscReg, ExtMachInst machInst, ThreadContext *tc, uint32_t imm, ExceptionClass ec)
int unflattenMiscReg(int reg)
bool decodeMrsMsrBankedReg(uint8_t sysM, bool r, bool &isIntReg, int ®Idx, CPSR cpsr, SCR scr, NSACR nsacr, bool checkSecurity)
virtual void setFloatRegFlat(RegIndex idx, RegVal val)=0
bool haveVirtualization() const
Returns true if this system implements the virtualization Extensions.
@ MISCREG_ID_AA64MMFR0_EL1
virtual int threadId() const =0
Fault mcrrMrrc15Trap(const MiscRegIndex miscReg, ExtMachInst machInst, ThreadContext *tc, uint32_t imm)
bool ELIs64(ThreadContext *tc, ExceptionLevel el)
virtual BaseISA * getIsaPtr()=0
Fault mcrMrc15Trap(const MiscRegIndex miscReg, ExtMachInst machInst, ThreadContext *tc, uint32_t imm)
bool IsSecureEL2Enabled(ThreadContext *tc)
bool ELStateUsingAArch32(ThreadContext *tc, ExceptionLevel el, bool secure)
Addr truncPage(Addr addr)
bool ELIs32(ThreadContext *tc, ExceptionLevel el)
@ MISCREG_ID_AA64PFR0_EL1
virtual void setVecElemFlat(RegIndex idx, const ElemIndex &elem_idx, const TheISA::VecElem &val)=0
bool isBigEndian64(const ThreadContext *tc)
bool haveSecurity() const
Returns true if this system implements the Security Extensions.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
bool haveLPAE() const
Returns true if this system implements the Large Physical Address Extension.
virtual void setIntRegFlat(RegIndex idx, RegVal val)=0
bool isAArch64AArch32SystemAccessTrapEL2(const MiscRegIndex miscReg, ThreadContext *tc)
std::shared_ptr< FaultBase > Fault
@ MISCREG_ID_AA64MMFR1_EL1
std::pair< bool, bool > ELStateUsingAArch32K(ThreadContext *tc, ExceptionLevel el, bool secure)
constexpr unsigned NumVecElemPerVecReg
bool SPAlignmentCheckEnabled(ThreadContext *tc)
virtual int cpuId() const =0
bool isGenericTimerPhysHypTrap(const MiscRegIndex miscReg, ThreadContext *tc, ExceptionClass *ec)
static RegVal getAff2(ArmSystem *arm_sys, ThreadContext *tc)
static ExceptionLevel opModeToEL(OperatingMode mode)
ExceptionLevel s1TranslationRegime(ThreadContext *tc, ExceptionLevel el)
bool longDescFormatInUse(ThreadContext *tc)
virtual RegVal readFloatRegFlat(RegIndex idx) const =0
std::pair< bool, bool > ELUsingAArch32K(ThreadContext *tc, ExceptionLevel el)
This function checks whether selected EL provided as an argument is using the AArch32 ISA.
constexpr decltype(nullptr) NoFault
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Addr purifyTaggedAddr(Addr addr, ThreadContext *tc, ExceptionLevel el, TCR tcr, bool isInstr)
Removes the tag from tagged addresses if that mode is enabled.
@ EC_TRAPPED_CP15_MCR_MRC
RegVal readMPIDR(ArmSystem *arm_sys, ThreadContext *tc)
This helper function is either returing the value of MPIDR_EL1 (by calling getMPIDR),...
bool HavePACExt(ThreadContext *tc)
virtual TheISA::PCState pcState() const =0
bool isGenericTimerSystemAccessTrapEL1(const MiscRegIndex miscReg, ThreadContext *tc)
static void copyVecRegs(ThreadContext *src, ThreadContext *dest)
virtual RegVal readCCReg(RegIndex reg_idx) const =0
static bool unknownMode32(OperatingMode mode)
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
virtual void setCCReg(RegIndex reg_idx, RegVal val)=0
static void mcrMrcIssExtract(uint32_t iss, bool &isRead, uint32_t &crm, IntRegIndex &rt, uint32_t &crn, uint32_t &opc1, uint32_t &opc2)
bool isSecureBelowEL3(ThreadContext *tc)
ArmISA::ExceptionLevel highestEL() const
Returns the highest implemented exception level.
bool isUnpriviledgeAccess(ThreadContext *tc)
virtual RegVal readMiscReg(RegIndex misc_reg)=0
virtual void setMiscReg(RegIndex misc_reg, RegVal val)=0
bool isGenericTimerCommonEL0HypTrap(const MiscRegIndex miscReg, ThreadContext *tc, ExceptionClass *ec)
static bool haveEL(ThreadContext *tc, ArmISA::ExceptionLevel el)
Return true if the system implements a specific exception level.
static bool unknownMode(OperatingMode mode)
bool condGenericTimerCommonEL0SystemAccessTrapEL2(const MiscRegIndex miscReg, ThreadContext *tc)
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
bool multiProc
true if this a multiprocessor system
static int intRegInMode(OperatingMode mode, int reg)
virtual void setMiscRegNoEffect(RegIndex misc_reg, RegVal val)=0
bool haveAArch32EL(ThreadContext *tc, ExceptionLevel el)
virtual uint32_t socketId() const =0
virtual const TheISA::VecElem & readVecElemFlat(RegIndex idx, const ElemIndex &elem_idx) const =0
static RegVal getAff0(ArmSystem *arm_sys, ThreadContext *tc)
bool inAArch64(ThreadContext *tc)
bool isGenericTimerPhysEL0SystemAccessTrapEL2(const MiscRegIndex miscReg, ThreadContext *tc)
bool mcrMrc14TrapToHyp(const MiscRegIndex miscReg, HCR hcr, CPSR cpsr, SCR scr, HDCR hdcr, HSTR hstr, HCPTR hcptr, uint32_t iss)
virtual void setVecRegFlat(RegIndex idx, const TheISA::VecRegContainer &val)=0
bool condGenericTimerSystemAccessTrapEL1(const MiscRegIndex miscReg, ThreadContext *tc)
virtual BaseCPU * getCpuPtr()=0
bool isGenericTimerSystemAccessTrapEL2(const MiscRegIndex miscReg, ThreadContext *tc)
Addr roundPage(Addr addr)
bool badMode(ThreadContext *tc, OperatingMode mode)
badMode is checking if the execution mode provided as an argument is valid and implemented.
constexpr void replaceBits(T &val, unsigned first, unsigned last, B bit_val)
A convenience function to replace bits first to last of val with bit_val in place.
bool isSecure(ThreadContext *tc)
virtual const TheISA::VecRegContainer & readVecRegFlat(RegIndex idx) const =0
#define panic(...)
This implements a cprintf based panic() function.
Generated on Tue Mar 23 2021 19:41:20 for gem5 by doxygen 1.8.17