Go to the documentation of this file.
54 #include "debug/Faults.hh"
108 "Invalid size of ArmFault::shortDescFaultSources[]");
153 "Invalid size of ArmFault::longDescFaultSources[]");
199 "Invalid size of ArmFault::aarch64FaultSources[]");
207 "Reset", 0x000, 0x000, 0x000, 0x000, 0x000,
MODE_SVC,
211 "Undefined Instruction", 0x004, 0x000, 0x200, 0x400, 0x600,
MODE_UNDEFINED,
215 "Supervisor Call", 0x008, 0x000, 0x200, 0x400, 0x600,
MODE_SVC,
219 "Secure Monitor Call", 0x008, 0x000, 0x200, 0x400, 0x600,
MODE_MON,
223 "Hypervisor Call", 0x008, 0x000, 0x200, 0x400, 0x600,
MODE_HYP,
224 4, 4, 4, 4,
true,
false,
false,
EC_HVC
227 "Prefetch Abort", 0x00C, 0x000, 0x200, 0x400, 0x600,
MODE_ABORT,
231 "Data Abort", 0x010, 0x000, 0x200, 0x400, 0x600,
MODE_ABORT,
235 "Virtual Data Abort", 0x010, 0x000, 0x200, 0x400, 0x600,
MODE_ABORT,
240 "Hypervisor Trap", 0x014, 0x000, 0x200, 0x400, 0x600,
MODE_HYP,
244 "Secure Monitor Trap", 0x004, 0x000, 0x200, 0x400, 0x600,
MODE_MON,
248 "IRQ", 0x018, 0x080, 0x280, 0x480, 0x680,
MODE_IRQ,
252 "Virtual IRQ", 0x018, 0x080, 0x280, 0x480, 0x680,
MODE_IRQ,
256 "FIQ", 0x01C, 0x100, 0x300, 0x500, 0x700,
MODE_FIQ,
260 "Virtual FIQ", 0x01C, 0x100, 0x300, 0x500, 0x700,
MODE_FIQ,
264 "Illegal Inst Set State Fault", 0x004, 0x000, 0x200, 0x400, 0x600,
MODE_UNDEFINED,
269 "Supervisor Trap", 0x014, 0x000, 0x200, 0x400, 0x600,
MODE_SVC,
274 "PC Alignment Fault", 0x000, 0x000, 0x200, 0x400, 0x600,
MODE_SVC,
279 "SP Alignment Fault", 0x000, 0x000, 0x200, 0x400, 0x600,
MODE_SVC,
284 "SError", 0x000, 0x180, 0x380, 0x580, 0x780,
MODE_SVC,
289 "Software Breakpoint", 0x000, 0x000, 0x200, 0x400, 0x600,
MODE_SVC,
293 "Hardware Breakpoint", 0x000, 0x000, 0x200, 0x400, 0x600,
MODE_SVC,
297 "Watchpoint", 0x000, 0x000, 0x200, 0x400, 0x600,
MODE_SVC,
301 "SoftwareStep", 0x000, 0x000, 0x200, 0x400, 0x600,
MODE_SVC,
306 "ArmSev Flush", 0x000, 0x000, 0x000, 0x000, 0x000,
MODE_SVC,
359 panic(
"Invalid target exception level");
376 panic(
"Invalid exception level");
392 panic(
"Invalid exception level");
401 uint32_t exc_class = (uint32_t)
ec(tc);
402 uint32_t issVal =
iss();
406 value = exc_class << 26;
414 }
else if ((
bits(exc_class, 5, 3) != 4) ||
415 (
bits(exc_class, 2) &&
bits(issVal, 24))) {
420 if (!
from64 && ((
bits(exc_class, 5, 4) == 0) &&
421 (
bits(exc_class, 3, 0) != 0))) {
431 value |=
bits(issVal, 19, 0);
475 if (
toEL ==
EL2 && hcr.e2h && hcr.tge) {
524 ITSTATE it = tc->
pcState().itstate();
525 saved_cpsr.it2 = it.top6;
526 saved_cpsr.it1 = it.bottom2;
534 if (have_security && saved_cpsr.mode ==
MODE_MON) {
550 if (!scr.ea) {cpsr.a = 1;}
551 if (!scr.fiq) {cpsr.f = 1;}
552 if (!scr.irq) {cpsr.i = 1;}
569 cpsr.it1 = cpsr.it2 = 0;
571 cpsr.pan =
span ? 1 : saved_cpsr.pan;
599 assert(have_security);
616 panic(
"unknown Mode\n");
620 DPRINTF(Faults,
"Invoking Fault:%s cpsr:%#x PC:%#x lr:%#x newVec: %#x "
622 newPc, arm_inst ?
csprintf(
"inst: %#x", arm_inst->encoding()) :
626 pc.nextThumb(
pc.thumb());
628 pc.nextJazelle(
pc.jazelle());
629 pc.aarch64(!cpsr.width);
630 pc.nextAArch64(!cpsr.width);
631 pc.illegalExec(
false);
656 panic(
"Invalid target exception level");
677 ITSTATE it = tc->
pcState().itstate();
679 spsr.it1 = it.bottom2;
685 Addr ret_addr = curr_pc;
695 OperatingMode64
mode = 0;
703 cpsr.pan =
span ? 1 : spsr.pan;
713 DPRINTF(Faults,
"Invoking Fault (AArch64 target EL):%s cpsr:%#x PC:%#x "
714 "elr:%#x newVec: %#x %s\n",
name(), cpsr, curr_pc, ret_addr,
715 new_pc, arm_inst ?
csprintf(
"inst: %#x", arm_inst->encoding()) :
718 pc.aarch64(!cpsr.width);
719 pc.nextAArch64(!cpsr.width);
720 pc.illegalExec(
false);
735 Fault fault =
sd->testVectorCatch(tc, 0x0,
this);
737 fault->invoke(tc, inst);
796 pc.nextAArch64(
true);
813 panic(
"Attempted to execute disabled instruction "
814 "'%s' (inst 0x%08x)",
mnemonic, arm_inst->encoding());
816 panic(
"Attempted to execute unknown instruction (inst 0x%08x)",
817 arm_inst->encoding());
819 panic(
"Attempted to execute unimplemented instruction "
820 "'%s' (inst 0x%08x)",
mnemonic, arm_inst->encoding());
844 uint32_t new_iss = 0;
845 uint32_t op0, op1, op2, CRn, CRm, Rt, dir;
855 new_iss = op0 << 20 | op2 << 17 | op1 << 14 | CRn << 10 |
856 Rt << 5 | CRm << 1 | dir;
957 bool isHypTrap =
false;
963 if (vals.hypTrappable) {
970 return isHypTrap ? 0x14 : vals.offset;
977 if (toEL == fromEL) {
979 return vals.currELTOffset;
980 return vals.currELHOffset;
982 bool lower_32 =
false;
995 return vals.lowerEL32Offset;
996 return vals.lowerEL64Offset;
1073 bool override_LPAE =
false;
1077 override_LPAE =
true;
1081 DPRINTF(Faults,
"Warning: Incomplete translation method "
1082 "override detected.\n");
1100 FSR fsr = getFsr(tc);
1103 }
else if (stage2) {
1125 DPRINTF(Faults,
"Abort Fault source=%#x fsr=%#x faultAddr=%#x "\
1126 "tranMethod=%#x\n", source, fsr, faultAddr, tranMethod);
1136 DPRINTF(Faults,
"Abort Fault (Stage 2) VA: 0x%x IPA: 0x%x\n",
1148 srcEncoded = getFaultStatusCode(tc);
1150 panic(
"Invalid fault source\n");
1161 "Trying to use un-updated ArmFault internal variables\n");
1187 auto fsc = getFaultStatusCode(tc);
1195 fsr.fsLow =
bits(fsc, 3, 0);
1196 fsr.fsHigh =
bits(fsc, 4);
1197 fsr.domain =
static_cast<uint8_t
>(
domain);
1200 fsr.wnr = (write ? 1 : 0);
1212 return (!scr.ns || scr.aw);
1242 val = srcEncoded & 0x3F;
1269 va = (stage2 ? OVAddr : faultAddr);
1331 panic(
"Asynchronous External Abort should be handled with "
1332 "SystemErrors (SErrors)!");
1489 return (!scr.ns || scr.aw);
1522 return (!scr.ns || scr.aw);
1534 return (!scr.ns || scr.fw);
1662 panic(
"Invalid target exception level");
1671 bool _write,
bool _cm)
1673 write(_write),
cm(_cm)
1679 uint32_t
iss = 0x0022;
1765 uint32_t
iss= 0x0022;
1780 DPRINTF(Faults,
"Invoking ArmSev Fault\n");
1833 auto arm_fault =
dynamic_cast<ArmFault *
>(fault.get());
1840 va = pgt_fault->getFaultVAddr();
1846 va = align_fault->getFaultVAddr();
virtual void setIntReg(RegIndex reg_idx, RegVal val)=0
void annotate(ArmFault::AnnotationIDs id, uint64_t val) override
void setSyndrome(ThreadContext *tc, MiscRegIndex syndrome_reg) override
ExceptionClass ec(ThreadContext *tc) const override
@ EC_PREFETCH_ABORT_TO_HYP
virtual RegVal readMiscReg(RegIndex misc_reg)=0
bool routeToMonitor(ThreadContext *tc) const override
constexpr decltype(nullptr) NoFault
virtual System * getSystemPtr()=0
ExceptionClass ec(ThreadContext *tc) const override
bool ELIs64(ThreadContext *tc, ExceptionLevel el)
bool routeToHyp(ThreadContext *tc) const override
Watchpoint(ExtMachInst _mach_inst, Addr _vaddr, bool _write, bool _cm)
bool highestELIs64() const
Returns true if the register width of the highest implemented exception level is 64 bits (ARMv8)
Addr faultPC
The unaligned value of the PC.
virtual bool abortDisable(ThreadContext *tc)=0
@ EC_HW_BREAKPOINT_LOWER_EL
ExceptionClass overrideEc
ExceptionClass ec(ThreadContext *tc) const override
Bitfield< 31, 28 > condCode
bool routeToHyp(ThreadContext *tc) const override
ExceptionClass ec(ThreadContext *tc) const override
ExceptionClass overrideEc
@ SynchronousExternalAbort
static ExceptionLevel currEL(const ThreadContext *tc)
uint32_t iss() const override
bool routeToHyp(ThreadContext *tc) const override
bool routeToHyp(ThreadContext *tc) const override
virtual uint8_t armPcElrOffset()=0
uint8_t getFaultStatusCode(ThreadContext *tc) const
bool routeToMonitor(ThreadContext *tc) const override
static bool opModeIsT(OperatingMode mode)
bool routeToMonitor(ThreadContext *tc) const override
virtual FaultOffset offset64(ThreadContext *tc)=0
Workload * workload
OS kernel.
bool routeToHyp(ThreadContext *tc) const override
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 ...
std::string csprintf(const char *format, const Args &...args)
uint32_t iss() const override
T * get() const
Directly access the pointer itself without taking a reference.
void invoke(ThreadContext *tc, const StaticInstPtr &inst) override
virtual void setSyndrome(ThreadContext *tc, MiscRegIndex syndrome_reg)
bool getFaultVAddr(Fault fault, Addr &va)
Returns true if the fault passed as a first argument was triggered by a memory access,...
ExceptionClass ec(ThreadContext *tc) const override
bool routeToHyp(ThreadContext *tc) const override
Addr getVector64(ThreadContext *tc)
bool routeToMonitor(ThreadContext *tc) const override
virtual FaultName name() const =0
virtual RegVal readCCReg(RegIndex reg_idx) const =0
@ AsynchronousExternalAbort
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
FSR getFsr(ThreadContext *tc) const override
Addr purifyTaggedAddr(Addr addr, ThreadContext *tc, ExceptionLevel el, TCR tcr, bool isInstr)
Removes the tag from tagged addresses if that mode is enabled.
uint32_t iss() const override
virtual uint32_t iss() const =0
bool abortDisable(ThreadContext *tc) override
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
virtual FaultStat & countStat()=0
ArmStaticInst * instrAnnotate(const StaticInstPtr &inst)
virtual uint8_t thumbPcElrOffset()=0
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual FaultOffset offset(ThreadContext *tc)=0
virtual uint8_t thumbPcOffset(bool isHyp)=0
std::shared_ptr< FaultBase > Fault
bool HaveVirtHostExt(ThreadContext *tc)
@ EC_SOFTWARE_BREAKPOINT_64
MiscRegIndex getSyndromeReg64() const
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
ExceptionClass ec(ThreadContext *tc) const override
ExceptionClass ec(ThreadContext *tc) const override
bool routeToHyp(ThreadContext *tc) const override
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
static uint8_t shortDescFaultSources[NumFaultSources]
Encodings of the fault sources when the short-desc.
bool ELIs32(ThreadContext *tc, ExceptionLevel el)
void update(ThreadContext *tc)
FaultOffset offset64(ThreadContext *tc) override
void clearInterrupt(ThreadID tid, int int_num, int index)
virtual bool getFaultVAddr(Addr &va) const
uint32_t iss() const override
bool routeToHyp(ThreadContext *tc) const override
uint32_t iss() const override
bool abortDisable(ThreadContext *tc) override
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
bool EL2Enabled(ThreadContext *tc)
ExceptionClass overrideEc
void annotate(AnnotationIDs id, uint64_t val) override
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
virtual OperatingMode nextMode()=0
virtual TheISA::PCState pcState() const =0
bool fiqDisable(ThreadContext *tc) override
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
@ MISCREG_ID_AA64MMFR1_EL1
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual RegVal readIntReg(RegIndex reg_idx) const =0
SoftwareBreakpoint(ExtMachInst _mach_inst, uint32_t _iss)
System error (AArch64 only)
FaultOffset offset(ThreadContext *tc) override
uint32_t iss() const override
ExceptionClass ec(ThreadContext *tc) const override
ExceptionClass ec(ThreadContext *tc) const override
bool isSecure(ThreadContext *tc)
virtual void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr)
bool getFaultVAddr(Addr &va) const override
bool routeToHyp(ThreadContext *tc) const override
MiscRegIndex getFaultAddrReg64() const
HardwareBreakpoint(Addr _vaddr, uint32_t _iss)
Addr getVector(ThreadContext *tc) override
Addr faultAddr
The virtual address the fault occured at.
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
MipsFaultBase::FaultVals FaultVals
static uint8_t aarch64FaultSources[NumFaultSources]
Encodings of the fault sources in AArch64 state.
ExceptionClass overrideEc
@ EC_SOFTWARE_STEP_LOWER_EL
bool routeToHyp(ThreadContext *tc) const override
@ EC_PREFETCH_ABORT_CURR_EL
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
bool routeToHyp(ThreadContext *tc) const override
void invoke64(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr)
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
bool routeToHyp(ThreadContext *tc) const override
void annotate(AnnotationIDs id, uint64_t val) override
virtual Addr getVector(ThreadContext *tc)
@ EC_PREFETCH_ABORT_LOWER_EL
uint32_t iss() const override
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
@ EC_HW_BREAKPOINT_CURR_EL
SoftwareStepFault(ExtMachInst _mach_inst, bool is_ldx, bool stepped)
ExceptionClass ec(ThreadContext *tc) const override
virtual void setMiscReg(RegIndex misc_reg, RegVal val)=0
SelfDebug * getSelfDebug() const
bool haveSecurity() const
Returns true if this system implements the Security Extensions.
virtual ExceptionClass ec(ThreadContext *tc) const =0
bool longDescFormatInUse(ThreadContext *tc)
virtual void annotate(AnnotationIDs id, uint64_t val)
Addr resetAddr() const
Returns the reset address if the highest implemented exception level is 64 bits (ARMv8)
ExceptionClass ec(ThreadContext *tc) const override
uint32_t iss() const override
bool routeToMonitor(ThreadContext *tc) const override
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
HypervisorCall(ExtMachInst _machInst, uint32_t _imm)
virtual BaseCPU * getCpuPtr()=0
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
virtual bool routeToHyp(ThreadContext *tc) const
virtual void clearArchRegs()=0
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
virtual int threadId() const =0
bool vectorCatch(ThreadContext *tc, const StaticInstPtr &inst)
bool routeToHyp(ThreadContext *tc) const override
ExceptionClass ec(ThreadContext *tc) const override
bool routeToHyp(ThreadContext *tc) const override
bool routeToMonitor(ThreadContext *tc) const override
bool routeToHyp(ThreadContext *tc) const override
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
static bool haveEL(ThreadContext *tc, ArmISA::ExceptionLevel el)
Return true if the system implements a specific exception level.
virtual uint8_t armPcOffset(bool isHyp)=0
bool routeToHyp(ThreadContext *tc) const override
@ EC_SOFTWARE_STEP_CURR_EL
ExceptionClass ec(ThreadContext *tc) const override
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
virtual bool routeToMonitor(ThreadContext *tc) const =0
IllegalInstSetStateFault()
static uint8_t longDescFaultSources[NumFaultSources]
Encodings of the fault sources when the long-desc.
void clearInterrupts(ThreadID tid)
virtual void annotateFault(ArmFault *fault)
virtual void advancePC(TheISA::PCState &pc_state) const =0
virtual void syscall(ThreadContext *tc)
bool haveVirtualization() const
Returns true if this system implements the virtualization Extensions.
ExceptionClass overrideEc
RegVal getMPIDR(ArmSystem *arm_sys, ThreadContext *tc)
This helper function is returning the value of MPIDR_EL1.
bool abortDisable(ThreadContext *tc) override
#define panic(...)
This implements a cprintf based panic() function.
ExceptionClass ec(ThreadContext *tc) const override
virtual void setMiscRegNoEffect(RegIndex misc_reg, RegVal val)=0
virtual bool fiqDisable(ThreadContext *tc)=0
Generated on Tue Sep 21 2021 12:24:29 for gem5 by doxygen 1.8.17