Go to the documentation of this file.
60 panic(
"getArgument() only implemented for full system mode.\n");
65 panic(
"getArgument(): Floating point arguments not implemented\n");
68 if (size == (uint16_t)(-1))
69 size =
sizeof(uint64_t);
74 panic(
"getArgument(): No support reading stack args for AArch64\n");
77 if (size == (uint16_t)(-1))
78 size =
sizeof(uint32_t);
83 if (size ==
sizeof(uint64_t)) {
84 if ((number % 2) != 0)
99 if (size ==
sizeof(uint64_t)) {
101 if ((number % 2) != 0)
103 arg = vp.
read<uint64_t>(
sp +
108 arg = vp.
read<uint32_t>(
sp +
114 panic(
"getArgument() should always return\n");
124 if (src_mode == Enums::Full) {
160 dynamic_cast<TLB *
>(dest->
getITBPtr())->invalidateMiscReg();
161 dynamic_cast<TLB *
>(dest->
getDTBPtr())->invalidateMiscReg();
200 route_to_el2 = (hdcr.tde == 1 || hcr.tge == 1);
204 route_to_el2 = (mdcr.tde == 1 || hcr.tge == 1);
207 route_to_el2 =
false;
242 switch (current_el) {
248 warn_once(
"Trying to read MPIDR at EL0\n");
259 panic(
"Invalid EL for reading MPIDR register\n");
277 assert((0 <= tc->
cpuId()) && (tc->
cpuId() < 256));
280 RegVal mpidr = 0x80000000;
321 return id_aa64isar1.api | id_aa64isar1.apa |
322 id_aa64isar1.gpi | id_aa64isar1.gpa;
329 return id_aa64mmfr1.vh;
351 return id_aa64pfr0.sel2;
387 panic_if(!known,
"EL state is UNKNOWN");
429 panic_if(
el ==
EL2 && !have_el2,
"Asking for EL2 when it doesn't exist");
430 panic_if(
el ==
EL3 && !have_el3,
"Asking for EL3 when it doesn't exist");
433 known = aarch32 =
false;
437 known =
true; aarch32 =
false;
438 }
else if (secure &&
el ==
EL2) {
439 known =
true; aarch32 =
false;
442 known =
true; aarch32 =
true;
444 known =
true; aarch32 =
false;
447 bool aarch32_below_el3 = have_el3 && scr.rw == 0 &&
452 bool aarch32_at_el1 = (aarch32_below_el3 ||
453 (have_el2 && (sec_el2 || !secure) &&
454 hcr.rw == 0 && !(hcr.e2h && hcr.tge &&
458 if (
el ==
EL0 && !aarch32_at_el1) {
462 aarch32 = (cpsr.width == 1);
465 aarch32 = (aarch32_below_el3 &&
el !=
EL3)
466 || (aarch32_at_el1 && (
el ==
EL0 ||
el ==
EL1) );
470 return std::make_pair(known, aarch32);
478 panic_if(!known,
"EL state is UNKNOWN");
495 panic(
"Invalid exception level");
526 tbi = selbit? tcr.tbi1 : tcr.tbi0;
527 tbid = selbit? tcr.tbid1 : tcr.tbid0;
534 tbi = selbit? tcr.tbi1 : tcr.tbi0;
535 tbid = selbit? tcr.tbid1 : tcr.tbid0;
554 int res = (
tbi && (!
tbid || !isInstr))? 55: 63;
559 TCR tcr,
bool isInstr)
567 uint64_t
mask = ((uint64_t)0x1 << topbit) -1;
602 return std::make_shared<HypervisorTrap>(machInst,
imm,
ec);
616 bool trapToHype =
false;
627 trapToHype = ((uint32_t) hstr) & (1 << crn);
628 trapToHype |= hdcr.tpm && (crn == 9) && (crm >= 12);
629 trapToHype |= hcr.tidcp && (
630 ((crn == 9) && ((crm <= 2) || ((crm >= 5) && (crm <= 8)))) ||
631 ((crn == 10) && ((crm <= 1) || (crm == 4) || (crm == 8))) ||
632 ((crn == 11) && ((crm <= 8) || (crm == 15))) );
637 trapToHype = hcptr.tcpac;
643 trapToHype = hcr.tid1;
649 trapToHype = hcr.tid2;
665 trapToHype = hcr.tid3;
670 trapToHype = hcr.tsw;
675 trapToHype = hcr.tpc;
681 trapToHype = hcr.tpu;
701 trapToHype = hcr.ttlb;
704 trapToHype = hcr.tac;
722 trapToHype = hcr.tvm & !isRead;
725 trapToHype = hdcr.tpmcr;
731 if (isa->haveGICv3CpuIfc())
732 trapToHype = hcr.fmo;
739 if (isa->haveGICv3CpuIfc())
740 trapToHype = hcr.imo;
763 HDCR hdcr, HSTR hstr, HCPTR hcptr, uint32_t iss)
771 bool trapToHype =
false;
775 inform(
"trap check M:%x N:%x 1:%x 2:%x hdcr %x, hcptr %x, hstr %x\n",
776 crm, crn, opc1,
opc2, hdcr, hcptr, hstr);
777 trapToHype = hdcr.tda && (opc1 == 0);
778 trapToHype |= hcptr.tta && (opc1 == 1);
785 trapToHype = hdcr.tdosa;
789 trapToHype = hdcr.tdra;
792 trapToHype = hcr.tid0;
796 trapToHype = hstr.tjdbx;
800 trapToHype = hstr.ttee;
817 return std::make_shared<HypervisorTrap>(machInst,
imm,
ec);
831 bool trapToHype =
false;
843 trapToHype = ((uint32_t) hstr) & (1 << crm);
863 trapToHype = hcr.tvm & !isRead;
889 return std::make_shared<SupervisorTrap>(machInst,
imm,
ec);
892 return std::make_shared<HypervisorTrap>(machInst,
imm,
ec);
942 if (
ELIs32(tc,
EL1) && trap_cond && hcr.tge) {
965 return !cnthctl.el1pcten;
967 return !cnthctl.el1pcen;
984 return !(
EL2Enabled(tc) && hcr.e2h && hcr.tge) && trap_cond &&
1001 return !cntkctl.el0pcten && !cntkctl.el0vcten;
1004 return !cntkctl.el0pcten;
1007 return !cntkctl.el0vcten;
1010 return !cntkctl.el0pten;
1013 return !cntkctl.el0vten;
1076 return (!
ELIs32(tc,
EL1) && !hcr.e2h && trap_cond_el1 && hcr.tge) ||
1077 (
ELIs32(tc,
EL1) && trap_cond_el1 && hcr.tge) ||
1078 (hcr.e2h && hcr.tge && trap_cond_el2);
1092 return !hcr.e2h && trap_cond_1;
1095 return (!hcr.e2h && trap_cond_0) ||
1096 (hcr.e2h && !hcr.tge && trap_cond_1);
1118 return (!hcr.e2h && trap_cond_0) ||
1119 (hcr.e2h && trap_cond_1);
1132 return !
ELIs32(tc,
EL1) && !(hcr.e2h && hcr.tge) && trap_cond;
1143 return !cnthctl.el0pcten && !cnthctl.el0vcten;
1146 return !cnthctl.el0pcten;
1149 return !cnthctl.el0vcten;
1152 return !cnthctl.el0pten;
1155 return !cnthctl.el0vten;
1169 const CNTHCTL cnthctl = cnthctl_val;
1170 const CNTHCTL_E2H cnthctl_e2h = cnthctl_val;
1174 return hcr.e2h ? !cnthctl_e2h.el1pcten : !cnthctl.el1pcten;
1180 return hcr.e2h ? cnthctl_e2h.el1tvct : cnthctl.el1tvct;
1183 return hcr.e2h ? !cnthctl_e2h.el1pten :
false;
1189 return hcr.e2h ? cnthctl_e2h.el1tvt : cnthctl.el1tvt;
1201 return !cnthctl.el1pcen;
1212 return currEL(tc) ==
EL1 && !scr.ns && !scr.st;
1222 CPSR cpsr, SCR scr, NSACR nsacr,
bool checkSecurity)
1267 int sysM4To3 =
bits(sysM, 4, 3);
1269 if (sysM4To3 == 0) {
1272 }
else if (sysM4To3 == 1) {
1275 }
else if (sysM4To3 == 3) {
1276 if (
bits(sysM, 1) == 0) {
1281 if (
bits(sysM, 0) == 1) {
1289 int sysM2 =
bits(sysM, 2);
1290 int sysM1 =
bits(sysM, 1);
1294 ((sysM2 && !sysM1) << 2) |
1295 ((sysM2 && sysM1) << 3) |
1300 ok &=
mode != cpsr.mode;
1305 if (ok && checkSecurity &&
mode != cpsr.mode) {
1332 panic(
"unknown Mode 0x%x\n", cpsr.mode);
1344 bool have_nv_ext =
false;
1347 have_nv_ext && hcr.nv == 1 && hcr.nv1 == 1);
1349 currEL(tc) ==
EL2 && hcr.e2h == 1 && hcr.tge == 1;
1352 bool user_access_override =
false;
1353 return (unpriv_el1 || unpriv_el2) && !user_access_override;
1375 panic(
"Invalid exception level");
1399 panic(
"Invalid phys. address range encoding");
1420 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)
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)
virtual const VecElem & readVecElemFlat(RegIndex idx, const ElemIndex &elemIdx) const =0
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
void replaceBits(T &val, int first, int last, B bit_val)
A convenience function to replace bits first to last of val with bit_val in place.
bool HaveVirtHostExt(ThreadContext *tc)
virtual const VecRegContainer & readVecRegFlat(RegIndex idx) const =0
bool isGenericTimerVirtSystemAccessTrapEL2(const MiscRegIndex miscReg, ThreadContext *tc)
static Enums::VecRegRenameMode mode(const TheISA::PCState &)
uint64_t getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp)
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)
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 FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
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
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
const int NumArgumentRegs
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 BaseTLB * getITBPtr()=0
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
virtual PortProxy & getVirtProxy()=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...
This object is a proxy for a port or other object which implements the functional response protocol,...
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)
T read(Addr address) const
Read sizeof(T) bytes from address and return as object T.
bool isSecureBelowEL3(ThreadContext *tc)
const int StackPointerReg
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)
bool multiProc
true if this a multiprocessor system
static int intRegInMode(OperatingMode mode, int reg)
virtual void setVecElemFlat(RegIndex idx, const ElemIndex &elemIdx, const VecElem &val)=0
virtual void setMiscRegNoEffect(RegIndex misc_reg, RegVal val)=0
bool haveAArch32EL(ThreadContext *tc, ExceptionLevel el)
virtual uint32_t socketId() const =0
static RegVal getAff0(ArmSystem *arm_sys, ThreadContext *tc)
bool inAArch64(ThreadContext *tc)
bool isGenericTimerPhysEL0SystemAccessTrapEL2(const MiscRegIndex miscReg, ThreadContext *tc)
virtual void setVecRegFlat(RegIndex idx, const VecRegContainer &val)=0
virtual RegVal readIntReg(RegIndex reg_idx) const =0
bool mcrMrc14TrapToHyp(const MiscRegIndex miscReg, HCR hcr, CPSR cpsr, SCR scr, HDCR hdcr, HSTR hstr, HCPTR hcptr, uint32_t iss)
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.
virtual BaseTLB * getDTBPtr()=0
bool isSecure(ThreadContext *tc)
#define panic(...)
This implements a cprintf based panic() function.
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Generated on Wed Sep 30 2020 14:02:01 for gem5 by doxygen 1.8.17