Go to the documentation of this file.
99 route_to_el2 = (hdcr.tde == 1 || hcr.tge == 1);
103 route_to_el2 = (mdcr.tde == 1 || hcr.tge == 1);
106 route_to_el2 =
false;
148 switch (current_el) {
154 warn_once(
"Trying to read MPIDR at EL0\n");
165 panic(
"Invalid EL for reading MPIDR register\n");
183 assert((0 <= tc->
cpuId()) && (tc->
cpuId() < 256));
186 RegVal mpidr = 0x80000000;
227 return id_aa64isar1.api | id_aa64isar1.apa |
228 id_aa64isar1.gpi | id_aa64isar1.gpa;
235 return id_aa64mmfr1.vh;
242 return (
bool)mm_fr2.varange;
264 return id_aa64pfr0.sel2;
299 panic_if(!known,
"EL state is UNKNOWN");
341 panic_if(
el ==
EL2 && !have_el2,
"Asking for EL2 when it doesn't exist");
342 panic_if(
el ==
EL3 && !have_el3,
"Asking for EL3 when it doesn't exist");
345 known = aarch32 =
false;
349 known =
true; aarch32 =
false;
350 }
else if (secure &&
el ==
EL2) {
351 known =
true; aarch32 =
false;
354 known =
true; aarch32 =
true;
356 known =
true; aarch32 =
false;
359 bool aarch32_below_el3 = have_el3 && scr.rw == 0 &&
364 bool aarch32_at_el1 = (aarch32_below_el3 ||
365 (have_el2 && (sec_el2 || !secure) &&
366 hcr.rw == 0 && !(hcr.e2h && hcr.tge &&
370 if (
el ==
EL0 && !aarch32_at_el1) {
374 aarch32 = (cpsr.width == 1);
377 aarch32 = (aarch32_below_el3 &&
el !=
EL3) ||
378 (aarch32_at_el1 && (
el ==
EL0 ||
el ==
EL1) );
382 return std::make_pair(known, aarch32);
389 panic_if(!known,
"EL state is UNKNOWN");
406 panic(
"Invalid exception level");
437 tbi = selbit? tcr.tbi1 : tcr.tbi0;
438 tbid = selbit? tcr.tbid1 : tcr.tbid0;
445 tbi = selbit? tcr.tbi1 : tcr.tbi0;
446 tbid = selbit? tcr.tbid1 : tcr.tbid0;
465 int res = (
tbi && (!
tbid || !is_instr))? 55: 63;
470 TCR tcr,
bool is_instr)
478 uint64_t
mask = ((uint64_t)0x1 << topbit) -1;
513 return std::make_shared<HypervisorTrap>(mach_inst,
imm,
ec);
527 bool trap_to_hyp =
false;
536 trap_to_hyp = ((uint32_t) hstr) & (1 << crn);
537 trap_to_hyp |= hdcr.tpm && (crn == 9) && (crm >= 12);
538 trap_to_hyp |= hcr.tidcp && (
539 ((crn == 9) && ((crm <= 2) || ((crm >= 5) && (crm <= 8)))) ||
540 ((crn == 10) && ((crm <= 1) || (crm == 4) || (crm == 8))) ||
541 ((crn == 11) && ((crm <= 8) || (crm == 15))));
546 trap_to_hyp = hcptr.tcpac;
552 trap_to_hyp = hcr.tid1;
558 trap_to_hyp = hcr.tid2;
576 trap_to_hyp = hcr.tid3;
581 trap_to_hyp = hcr.tsw;
586 trap_to_hyp = hcr.tpc;
592 trap_to_hyp = hcr.tpu;
612 trap_to_hyp = hcr.ttlb;
615 trap_to_hyp = hcr.tac;
633 trap_to_hyp = hcr.tvm & !is_read;
636 trap_to_hyp = hdcr.tpmcr;
642 if (isa->haveGICv3CpuIfc())
643 trap_to_hyp = hcr.fmo;
650 if (isa->haveGICv3CpuIfc())
651 trap_to_hyp = hcr.imo;
687 bool trap_to_hyp =
false;
691 inform(
"trap check M:%x N:%x 1:%x 2:%x hdcr %x, hcptr %x, hstr %x\n",
692 crm, crn, opc1,
opc2, hdcr, hcptr, hstr);
693 trap_to_hyp = hdcr.tda && (opc1 == 0);
694 trap_to_hyp |= hcptr.tta && (opc1 == 1);
701 trap_to_hyp = hdcr.tdosa;
705 trap_to_hyp = hdcr.tdra;
708 trap_to_hyp = hcr.tid0;
712 trap_to_hyp = hstr.tjdbx;
716 trap_to_hyp = hstr.ttee;
733 return std::make_shared<HypervisorTrap>(mach_inst,
imm,
ec);
747 bool trap_to_hyp =
false;
757 trap_to_hyp = ((uint32_t)hstr) & (1 << crm);
777 trap_to_hyp = hcr.tvm & !is_read;
804 return std::make_shared<SupervisorTrap>(mach_inst,
imm,
ec);
807 return std::make_shared<HypervisorTrap>(mach_inst,
imm,
ec);
857 if (
ELIs32(tc,
EL1) && trap_cond && hcr.tge) {
880 return !cnthctl.el1pcten;
882 return !cnthctl.el1pcen;
899 return !(
EL2Enabled(tc) && hcr.e2h && hcr.tge) && trap_cond &&
916 return !cntkctl.el0pcten && !cntkctl.el0vcten;
919 return !cntkctl.el0pcten;
922 return !cntkctl.el0vcten;
925 return !cntkctl.el0pten;
928 return !cntkctl.el0vten;
991 return (!
ELIs32(tc,
EL1) && !hcr.e2h && trap_cond_el1 && hcr.tge) ||
992 (
ELIs32(tc,
EL1) && trap_cond_el1 && hcr.tge) ||
993 (hcr.e2h && hcr.tge && trap_cond_el2);
1009 return !hcr.e2h && trap_cond_1;
1012 return (!hcr.e2h && trap_cond_0) ||
1013 (hcr.e2h && !hcr.tge && trap_cond_1);
1037 return (!hcr.e2h && trap_cond_0) ||
1038 (hcr.e2h && trap_cond_1);
1052 return !
ELIs32(tc,
EL1) && !(hcr.e2h && hcr.tge) && trap_cond;
1063 return !cnthctl.el0pcten && !cnthctl.el0vcten;
1066 return !cnthctl.el0pcten;
1069 return !cnthctl.el0vcten;
1072 return !cnthctl.el0pten;
1075 return !cnthctl.el0vten;
1089 const CNTHCTL cnthctl = cnthctl_val;
1090 const CNTHCTL_E2H cnthctl_e2h = cnthctl_val;
1094 return hcr.e2h ? !cnthctl_e2h.el1pcten : !cnthctl.el1pcten;
1100 return hcr.e2h ? cnthctl_e2h.el1tvct : cnthctl.el1tvct;
1103 return hcr.e2h ? !cnthctl_e2h.el1pten :
false;
1109 return hcr.e2h ? cnthctl_e2h.el1tvt : cnthctl.el1tvt;
1121 return !cnthctl.el1pcen;
1132 return currEL(tc) ==
EL1 && !scr.ns && !scr.st;
1142 CPSR cpsr, SCR scr, NSACR nsacr,
bool checkSecurity)
1186 int sysM4To3 =
bits(sysM, 4, 3);
1188 if (sysM4To3 == 0) {
1191 }
else if (sysM4To3 == 1) {
1194 }
else if (sysM4To3 == 3) {
1195 if (
bits(sysM, 1) == 0) {
1200 if (
bits(sysM, 0) == 1) {
1208 int sysM2 =
bits(sysM, 2);
1209 int sysM1 =
bits(sysM, 1);
1213 ((sysM2 && !sysM1) << 2) |
1214 ((sysM2 && sysM1) << 3) |
1219 ok &=
mode != cpsr.mode;
1224 if (ok && checkSecurity &&
mode != cpsr.mode) {
1225 switch (cpsr.mode) {
1250 panic(
"unknown Mode 0x%x\n", cpsr.mode);
1264 bool have_nv_ext =
false;
1267 have_nv_ext && hcr.nv == 1 && hcr.nv1 == 1);
1269 currEL(tc) ==
EL2 && hcr.e2h == 1 && hcr.tge == 1;
1271 return (unpriv_el1 || unpriv_el2) && !cpsr.uao;
1293 panic(
"Invalid exception level");
1317 panic(
"Invalid phys. address range encoding");
1340 panic(
"Invalid phys. address range");
constexpr unsigned NumVecElemPerVecReg
static int intRegInMode(OperatingMode mode, int reg)
virtual RegVal readMiscReg(RegIndex misc_reg)=0
constexpr decltype(nullptr) NoFault
bool ELIs64(ThreadContext *tc, ExceptionLevel el)
bool highestELIs64() const
Returns true if the register width of the highest implemented exception level is 64 bits (ARMv8)
@ VecElemClass
Vector Register Native Elem lane.
bool isGenericTimerPhysEL1SystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
bool isGenericTimerHypTrap(const MiscRegIndex misc_reg, ThreadContext *tc, ExceptionClass *ec)
int decodePhysAddrRange64(uint8_t pa_enc)
Returns the n.
@ EC_TRAPPED_CP15_MCR_MRC
bool isGenericTimerSystemAccessTrapEL1(const MiscRegIndex misc_reg, ThreadContext *tc)
bool isGenericTimerCommonEL0HypTrap(const MiscRegIndex misc_reg, ThreadContext *tc, ExceptionClass *ec)
uint8_t encodePhysAddrRange64(int pa_size)
Returns the encoding corresponding to the specified n.
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 isSecureBelowEL3(ThreadContext *tc)
bool isGenericTimerSystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
bool mcrrMrrc15TrapToHyp(const MiscRegIndex misc_reg, ThreadContext *tc, uint32_t iss, ExceptionClass *ec)
@ MISCREG_ID_AA64MMFR0_EL1
static ExceptionLevel opModeToEL(OperatingMode mode)
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 ...
bool isAArch64AArch32SystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
bool inAArch64(ThreadContext *tc)
bool badMode(ThreadContext *tc, OperatingMode mode)
badMode is checking if the execution mode provided as an argument is valid and implemented.
virtual int cpuId() const =0
Fault AArch64AArch32SystemAccessTrap(const MiscRegIndex misc_reg, ExtMachInst mach_inst, ThreadContext *tc, uint32_t imm, ExceptionClass ec)
Addr truncPage(Addr addr)
std::pair< bool, bool > ELUsingAArch32K(ThreadContext *tc, ExceptionLevel el)
This function checks whether selected EL provided as an argument is using the AArch32 ISA.
bool condGenericTimerCommonEL0SystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
bool condGenericTimerSystemAccessTrapEL1(const MiscRegIndex misc_reg, ThreadContext *tc)
bool mcrMrc14TrapToHyp(const MiscRegIndex misc_reg, ThreadContext *tc, uint32_t iss)
bool HaveLVA(ThreadContext *tc)
Fault mcrMrc15Trap(const MiscRegIndex misc_reg, ExtMachInst mach_inst, ThreadContext *tc, uint32_t imm)
Addr purifyTaggedAddr(Addr addr, ThreadContext *tc, ExceptionLevel el, TCR tcr, bool is_instr)
Removes the tag from tagged addresses if that mode is enabled.
bool HavePACExt(ThreadContext *tc)
static bool unknownMode32(OperatingMode mode)
bool isGenericTimerCommonEL0SystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
virtual const TheISA::VecRegContainer & readVecReg(const RegId ®) const =0
static RegVal getAff1(ArmSystem *arm_sys, ThreadContext *tc)
bool multiProc
true if this a multiprocessor system
static RegVal getAff2(ArmSystem *arm_sys, ThreadContext *tc)
ArmISA::ExceptionLevel highestEL() const
Returns the highest implemented exception level.
Vector Register Abstraction This generic class is the model in a particularization of MVC,...
virtual uint32_t socketId() const =0
virtual BaseISA * getIsaPtr()=0
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Fault mcrrMrrc15Trap(const MiscRegIndex misc_reg, ExtMachInst mach_inst, ThreadContext *tc, uint32_t imm)
bool condGenericTimerPhysHypTrap(const MiscRegIndex misc_reg, ThreadContext *tc)
@ MISCREG_ID_AA64MMFR2_EL1
std::shared_ptr< FaultBase > Fault
bool HaveVirtHostExt(ThreadContext *tc)
Addr roundPage(Addr addr)
static bool unknownMode(OperatingMode mode)
@ EC_TRAPPED_CP15_MCRR_MRRC
bool ELIs32(ThreadContext *tc, ExceptionLevel el)
void syncVecElemsToRegs(ThreadContext *tc)
RegVal getAffinity(ArmSystem *arm_sys, ThreadContext *tc)
Retrieves MPIDR_EL1.
bool EL2Enabled(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 SPAlignmentCheckEnabled(ThreadContext *tc)
bool mcrMrc15TrapToHyp(const MiscRegIndex misc_reg, ThreadContext *tc, uint32_t iss, ExceptionClass *ec)
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
ExceptionLevel s1TranslationRegime(ThreadContext *tc, ExceptionLevel el)
@ MISCREG_ID_AA64MMFR1_EL1
ExceptionLevel debugTargetFrom(ThreadContext *tc, bool secure)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool isSecure(ThreadContext *tc)
std::pair< bool, bool > ELStateUsingAArch32K(ThreadContext *tc, ExceptionLevel el, bool secure)
@ MISCREG_ID_AA64ISAR1_EL1
ExceptionLevel currEL(const ThreadContext *tc)
Returns the current Exception Level (EL) of the provided ThreadContext.
virtual RegVal readVecElem(const RegId ®) const =0
bool has(ArmExtension ext) const
bool IsSecureEL2Enabled(ThreadContext *tc)
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
void syncVecRegsToElems(ThreadContext *tc)
bool decodeMrsMsrBankedReg(uint8_t sysM, bool r, bool &isIntReg, int ®Idx, CPSR cpsr, SCR scr, NSACR nsacr, bool checkSecurity)
bool isUnpriviledgeAccess(ThreadContext *tc)
static RegVal getAff0(ArmSystem *arm_sys, ThreadContext *tc)
bool isGenericTimerSystemAccessTrapEL3(const MiscRegIndex misc_reg, ThreadContext *tc)
void sendEvent(ThreadContext *tc)
Send an event (SEV) to a specific PE if there isn't already a pending event.
bool ELStateUsingAArch32(ThreadContext *tc, ExceptionLevel el, bool secure)
bool longDescFormatInUse(ThreadContext *tc)
virtual void setVecElem(const RegId ®, RegVal val)=0
bool HaveSecureEL2Ext(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...
bool haveAArch32EL(ThreadContext *tc, ExceptionLevel el)
bool isGenericTimerVirtSystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
virtual BaseCPU * getCpuPtr()=0
virtual int threadId() const =0
bool condGenericTimerPhysEL1SystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
@ VecRegClass
Vector Register.
static bool haveEL(ThreadContext *tc, ArmISA::ExceptionLevel el)
Return true if the system implements a specific exception level.
bool condGenericTimerCommonEL1SystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
@ MISCREG_ID_AA64PFR0_EL1
int computeAddrTop(ThreadContext *tc, bool selbit, bool is_instr, TCR tcr, ExceptionLevel el)
bool isGenericTimerPhysHypTrap(const MiscRegIndex misc_reg, ThreadContext *tc, ExceptionClass *ec)
bool isBigEndian64(const ThreadContext *tc)
bool isAArch64AArch32SystemAccessTrapEL1(const MiscRegIndex misc_reg, ThreadContext *tc)
virtual void setVecReg(const RegId ®, const TheISA::VecRegContainer &val)=0
bool isGenericTimerPhysEL0SystemAccessTrapEL2(const MiscRegIndex misc_reg, ThreadContext *tc)
RegVal readMPIDR(ArmSystem *arm_sys, ThreadContext *tc)
This helper function is either returing the value of MPIDR_EL1 (by calling getMPIDR),...
int unflattenMiscReg(int reg)
RegVal getMPIDR(ArmSystem *arm_sys, ThreadContext *tc)
This helper function is returning the value of MPIDR_EL1.
Register ID: describe an architectural register with its class and index.
#define panic(...)
This implements a cprintf based panic() function.
static void mcrMrcIssExtract(uint32_t iss, bool &isRead, uint32_t &crm, IntRegIndex &rt, uint32_t &crn, uint32_t &opc1, uint32_t &opc2)
Generated on Tue Feb 8 2022 11:46:59 for gem5 by doxygen 1.8.17