Go to the documentation of this file.
54 #include "debug/Faults.hh"
105 "Invalid size of ArmFault::shortDescFaultSources[]");
150 "Invalid size of ArmFault::longDescFaultSources[]");
196 "Invalid size of ArmFault::aarch64FaultSources[]");
204 "Reset", 0x000, 0x000, 0x000, 0x000, 0x000,
MODE_SVC,
208 "Undefined Instruction", 0x004, 0x000, 0x200, 0x400, 0x600,
MODE_UNDEFINED,
212 "Supervisor Call", 0x008, 0x000, 0x200, 0x400, 0x600,
MODE_SVC,
216 "Secure Monitor Call", 0x008, 0x000, 0x200, 0x400, 0x600,
MODE_MON,
220 "Hypervisor Call", 0x008, 0x000, 0x200, 0x400, 0x600,
MODE_HYP,
221 4, 4, 4, 4,
true,
false,
false,
EC_HVC
224 "Prefetch Abort", 0x00C, 0x000, 0x200, 0x400, 0x600,
MODE_ABORT,
228 "Data Abort", 0x010, 0x000, 0x200, 0x400, 0x600,
MODE_ABORT,
232 "Virtual Data Abort", 0x010, 0x000, 0x200, 0x400, 0x600,
MODE_ABORT,
237 "Hypervisor Trap", 0x014, 0x000, 0x200, 0x400, 0x600,
MODE_HYP,
241 "Secure Monitor Trap", 0x004, 0x000, 0x200, 0x400, 0x600,
MODE_MON,
245 "IRQ", 0x018, 0x080, 0x280, 0x480, 0x680,
MODE_IRQ,
249 "Virtual IRQ", 0x018, 0x080, 0x280, 0x480, 0x680,
MODE_IRQ,
253 "FIQ", 0x01C, 0x100, 0x300, 0x500, 0x700,
MODE_FIQ,
257 "Virtual FIQ", 0x01C, 0x100, 0x300, 0x500, 0x700,
MODE_FIQ,
261 "Illegal Inst Set State Fault", 0x004, 0x000, 0x200, 0x400, 0x600,
MODE_UNDEFINED,
266 "Supervisor Trap", 0x014, 0x000, 0x200, 0x400, 0x600,
MODE_SVC,
271 "PC Alignment Fault", 0x000, 0x000, 0x200, 0x400, 0x600,
MODE_SVC,
276 "SP Alignment Fault", 0x000, 0x000, 0x200, 0x400, 0x600,
MODE_SVC,
281 "SError", 0x000, 0x180, 0x380, 0x580, 0x780,
MODE_SVC,
286 "Software Breakpoint", 0x000, 0x000, 0x200, 0x400, 0x600,
MODE_SVC,
290 "Hardware Breakpoint", 0x000, 0x000, 0x200, 0x400, 0x600,
MODE_SVC,
294 "Watchpoint", 0x000, 0x000, 0x200, 0x400, 0x600,
MODE_SVC,
298 "SoftwareStep", 0x000, 0x000, 0x200, 0x400, 0x600,
MODE_SVC,
303 "ArmSev Flush", 0x000, 0x000, 0x000, 0x000, 0x000,
MODE_SVC,
356 panic(
"Invalid target exception level");
373 panic(
"Invalid exception level");
389 panic(
"Invalid exception level");
398 uint32_t exc_class = (uint32_t)
ec(tc);
399 uint32_t issVal =
iss();
403 value = exc_class << 26;
411 }
else if ((
bits(exc_class, 5, 3) != 4) ||
412 (
bits(exc_class, 2) &&
bits(issVal, 24))) {
417 if (!
from64 && ((
bits(exc_class, 5, 4) == 0) &&
418 (
bits(exc_class, 3, 0) != 0))) {
428 value |=
bits(issVal, 19, 0);
472 if (
toEL ==
EL2 && hcr.e2h && hcr.tge) {
521 ITSTATE it = tc->
pcState().itstate();
522 saved_cpsr.it2 = it.top6;
523 saved_cpsr.it1 = it.bottom2;
531 if (have_security && saved_cpsr.mode ==
MODE_MON) {
547 if (!scr.ea) {cpsr.a = 1;}
548 if (!scr.fiq) {cpsr.f = 1;}
549 if (!scr.irq) {cpsr.i = 1;}
566 cpsr.it1 = cpsr.it2 = 0;
568 cpsr.pan =
span ? 1 : saved_cpsr.pan;
596 assert(have_security);
613 panic(
"unknown Mode\n");
617 DPRINTF(Faults,
"Invoking Fault:%s cpsr:%#x PC:%#x lr:%#x newVec: %#x "
619 newPc, arm_inst ?
csprintf(
"inst: %#x", arm_inst->encoding()) :
623 pc.nextThumb(
pc.thumb());
625 pc.nextJazelle(
pc.jazelle());
626 pc.aarch64(!cpsr.width);
627 pc.nextAArch64(!cpsr.width);
628 pc.illegalExec(
false);
653 panic(
"Invalid target exception level");
674 ITSTATE it = tc->
pcState().itstate();
676 spsr.it1 = it.bottom2;
682 Addr ret_addr = curr_pc;
692 OperatingMode64
mode = 0;
700 cpsr.pan =
span ? 1 : spsr.pan;
710 DPRINTF(Faults,
"Invoking Fault (AArch64 target EL):%s cpsr:%#x PC:%#x "
711 "elr:%#x newVec: %#x %s\n",
name(), cpsr, curr_pc, ret_addr,
712 new_pc, arm_inst ?
csprintf(
"inst: %#x", arm_inst->encoding()) :
715 pc.aarch64(!cpsr.width);
716 pc.nextAArch64(!cpsr.width);
717 pc.illegalExec(
false);
732 Fault fault =
sd->testVectorCatch(tc, 0x0,
this);
734 fault->invoke(tc, inst);
793 pc.nextAArch64(
true);
810 panic(
"Attempted to execute disabled instruction "
811 "'%s' (inst 0x%08x)",
mnemonic, arm_inst->encoding());
813 panic(
"Attempted to execute unknown instruction (inst 0x%08x)",
814 arm_inst->encoding());
816 panic(
"Attempted to execute unimplemented instruction "
817 "'%s' (inst 0x%08x)",
mnemonic, arm_inst->encoding());
841 uint32_t new_iss = 0;
842 uint32_t op0, op1, op2, CRn, CRm, Rt, dir;
852 new_iss = op0 << 20 | op2 << 17 | op1 << 14 | CRn << 10 |
853 Rt << 5 | CRm << 1 | dir;
954 bool isHypTrap =
false;
960 if (vals.hypTrappable) {
967 return isHypTrap ? 0x14 : vals.offset;
974 if (toEL == fromEL) {
976 return vals.currELTOffset;
977 return vals.currELHOffset;
979 bool lower_32 =
false;
992 return vals.lowerEL32Offset;
993 return vals.lowerEL64Offset;
1070 bool override_LPAE =
false;
1074 override_LPAE =
true;
1078 DPRINTF(Faults,
"Warning: Incomplete translation method "
1079 "override detected.\n");
1097 FSR fsr = getFsr(tc);
1100 }
else if (stage2) {
1122 DPRINTF(Faults,
"Abort Fault source=%#x fsr=%#x faultAddr=%#x "\
1123 "tranMethod=%#x\n", source, fsr, faultAddr, tranMethod);
1133 DPRINTF(Faults,
"Abort Fault (Stage 2) VA: 0x%x IPA: 0x%x\n",
1145 srcEncoded = getFaultStatusCode(tc);
1147 panic(
"Invalid fault source\n");
1158 "Trying to use un-updated ArmFault internal variables\n");
1184 auto fsc = getFaultStatusCode(tc);
1192 fsr.fsLow =
bits(fsc, 3, 0);
1193 fsr.fsHigh =
bits(fsc, 4);
1194 fsr.domain =
static_cast<uint8_t
>(
domain);
1197 fsr.wnr = (write ? 1 : 0);
1209 return (!scr.ns || scr.aw);
1239 val = srcEncoded & 0x3F;
1266 va = (stage2 ? OVAddr : faultAddr);
1328 panic(
"Asynchronous External Abort should be handled with "
1329 "SystemErrors (SErrors)!");
1486 return (!scr.ns || scr.aw);
1519 return (!scr.ns || scr.aw);
1531 return (!scr.ns || scr.fw);
1659 panic(
"Invalid target exception level");
1668 bool _write,
bool _cm)
1670 write(_write),
cm(_cm)
1676 uint32_t
iss = 0x0022;
1762 uint32_t
iss= 0x0022;
1777 DPRINTF(Faults,
"Invoking ArmSev Fault\n");
1830 auto arm_fault =
dynamic_cast<ArmFault *
>(fault.get());
1837 va = pgt_fault->getFaultVAddr();
1843 va = align_fault->getFaultVAddr();
@ SynchronousExternalAbort
ExceptionClass ec(ThreadContext *tc) const override
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
void invoke(ThreadContext *tc, const StaticInstPtr &inst=StaticInst::nullStaticInstPtr) override
bool getFaultVAddr(Addr &va) const override
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 ...
@ EC_PREFETCH_ABORT_CURR_EL
bool getFaultVAddr(Fault fault, Addr &va)
Returns true if the fault passed as a first argument was triggered by a memory access,...
bool EL2Enabled(ThreadContext *tc)
static bool opModeIsT(OperatingMode mode)
uint32_t iss() const override
bool HaveVirtHostExt(ThreadContext *tc)
static uint8_t aarch64FaultSources[NumFaultSources]
Encodings of the fault sources in AArch64 state.
bool routeToMonitor(ThreadContext *tc) const override
virtual bool routeToMonitor(ThreadContext *tc) const =0
FaultOffset offset(ThreadContext *tc) override
virtual void advancePC(TheISA::PCState &pcState) const =0
ExceptionClass overrideEc
Addr getVector64(ThreadContext *tc)
ExceptionClass ec(ThreadContext *tc) const override
virtual uint32_t iss() const =0
bool highestELIs64() const
Returns true if the register width of the highest implemented exception level is 64 bits (ARMv8)
Addr resetAddr() const
Returns the reset address if the highest implemented exception level is 64 bits (ARMv8)
ExceptionClass ec(ThreadContext *tc) const override
bool abortDisable(ThreadContext *tc) override
virtual uint8_t thumbPcOffset(bool isHyp)=0
uint32_t iss() const override
bool routeToHyp(ThreadContext *tc) const override
ExceptionClass ec(ThreadContext *tc) const override
ExceptionClass overrideEc
bool routeToHyp(ThreadContext *tc) const override
static ExceptionLevel currEL(const ThreadContext *tc)
bool routeToHyp(ThreadContext *tc) const override
void invoke(ThreadContext *tc, const StaticInstPtr &inst=StaticInst::nullStaticInstPtr) override
virtual void setIntReg(RegIndex reg_idx, RegVal val)=0
void invoke(ThreadContext *tc, const StaticInstPtr &inst=StaticInst::nullStaticInstPtr) override
ExceptionClass ec(ThreadContext *tc) const override
MiscRegIndex getFaultAddrReg64() const
IllegalInstSetStateFault()
virtual Addr getVector(ThreadContext *tc)
virtual void invoke(ThreadContext *tc, const StaticInstPtr &inst=StaticInst::nullStaticInstPtr)
SoftwareBreakpoint(ExtMachInst _mach_inst, uint32_t _iss)
ExceptionClass ec(ThreadContext *tc) const override
void annotate(AnnotationIDs id, uint64_t val) override
ExceptionClass ec(ThreadContext *tc) const override
virtual bool fiqDisable(ThreadContext *tc)=0
@ AsynchronousExternalAbort
virtual FaultOffset offset(ThreadContext *tc)=0
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
@ EC_SOFTWARE_BREAKPOINT_64
@ EC_PREFETCH_ABORT_LOWER_EL
RegVal getMPIDR(ArmSystem *arm_sys, ThreadContext *tc)
This helper function is returning the value of MPIDR_EL1.
void invoke(ThreadContext *tc, const StaticInstPtr &inst=StaticInst::nullStaticInstPtr) override
bool routeToHyp(ThreadContext *tc) const override
void invoke(ThreadContext *tc, const StaticInstPtr &inst=StaticInst::nullStaticInstPtr) override
ExceptionClass ec(ThreadContext *tc) const override
bool haveVirtualization() const
Returns true if this system implements the virtualization Extensions.
bool vectorCatch(ThreadContext *tc, const StaticInstPtr &inst)
bool routeToMonitor(ThreadContext *tc) const override
Addr getVector(ThreadContext *tc) override
Bitfield< 31, 28 > condCode
virtual int threadId() const =0
bool abortDisable(ThreadContext *tc) override
bool ELIs64(ThreadContext *tc, ExceptionLevel el)
bool routeToHyp(ThreadContext *tc) const override
virtual void setSyndrome(ThreadContext *tc, MiscRegIndex syndrome_reg)
@ EC_SOFTWARE_STEP_CURR_EL
uint32_t iss() const override
@ EC_SOFTWARE_STEP_LOWER_EL
bool routeToHyp(ThreadContext *tc) const override
bool ELIs32(ThreadContext *tc, ExceptionLevel el)
void setSyndrome(ThreadContext *tc, MiscRegIndex syndrome_reg) override
virtual void clearArchRegs()=0
virtual void annotate(AnnotationIDs id, uint64_t val)
@ EC_HW_BREAKPOINT_CURR_EL
ArmStaticInst * instrAnnotate(const StaticInstPtr &inst)
bool routeToHyp(ThreadContext *tc) const override
uint32_t iss() const override
ExceptionClass ec(ThreadContext *tc) const override
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.
@ EC_PREFETCH_ABORT_TO_HYP
virtual FaultStat & countStat()=0
FaultOffset offset64(ThreadContext *tc) override
ExceptionClass ec(ThreadContext *tc) const override
virtual FaultOffset offset64(ThreadContext *tc)=0
bool routeToHyp(ThreadContext *tc) const override
std::shared_ptr< FaultBase > Fault
virtual void annotateFault(ArmFault *fault)
bool routeToHyp(ThreadContext *tc) const override
MiscRegIndex getSyndromeReg64() const
HypervisorCall(ExtMachInst _machInst, uint32_t _imm)
@ MISCREG_ID_AA64MMFR1_EL1
uint8_t getFaultStatusCode(ThreadContext *tc) const
virtual uint8_t armPcElrOffset()=0
void clearInterrupt(ThreadID tid, int int_num, int index)
uint32_t iss() const override
void invoke64(ThreadContext *tc, const StaticInstPtr &inst=StaticInst::nullStaticInstPtr)
bool fiqDisable(ThreadContext *tc) override
virtual OperatingMode nextMode()=0
static ExceptionLevel opModeToEL(OperatingMode mode)
System error (AArch64 only)
bool routeToMonitor(ThreadContext *tc) const override
FSR getFsr(ThreadContext *tc) const override
bool longDescFormatInUse(ThreadContext *tc)
constexpr decltype(nullptr) NoFault
uint32_t iss() const override
bool routeToHyp(ThreadContext *tc) const override
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.
bool routeToHyp(ThreadContext *tc) const override
void invoke(ThreadContext *tc, const StaticInstPtr &inst=StaticInst::nullStaticInstPtr) override
virtual TheISA::PCState pcState() const =0
SelfDebug * getSelfDebug() const
ExceptionClass overrideEc
bool routeToHyp(ThreadContext *tc) const override
virtual RegVal readCCReg(RegIndex reg_idx) const =0
ExceptionClass ec(ThreadContext *tc) const override
MipsFaultBase::FaultVals FaultVals
void invoke(ThreadContext *tc, const StaticInstPtr &inst=StaticInst::nullStaticInstPtr) override
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
void invoke(ThreadContext *tc, const StaticInstPtr &inst=StaticInst::nullStaticInstPtr) override
bool routeToMonitor(ThreadContext *tc) const override
SoftwareStepFault(ExtMachInst _mach_inst, bool is_ldx, bool stepped)
ExceptionClass ec(ThreadContext *tc) const override
virtual uint8_t thumbPcElrOffset()=0
void update(ThreadContext *tc)
uint32_t iss() const override
GenericISA::DelaySlotPCState< MachInst > PCState
bool routeToHyp(ThreadContext *tc) const override
void clearInterrupts(ThreadID tid)
ExceptionClass ec(ThreadContext *tc) const override
HardwareBreakpoint(Addr _vaddr, uint32_t _iss)
bool routeToMonitor(ThreadContext *tc) const override
virtual ExceptionClass ec(ThreadContext *tc) const =0
void annotate(AnnotationIDs id, uint64_t val) override
virtual uint8_t armPcOffset(bool isHyp)=0
virtual RegVal readMiscReg(RegIndex misc_reg)=0
virtual void setMiscReg(RegIndex misc_reg, RegVal val)=0
ExceptionClass ec(ThreadContext *tc) const override
static bool haveEL(ThreadContext *tc, ArmISA::ExceptionLevel el)
Return true if the system implements a specific exception level.
void invoke(ThreadContext *tc, const StaticInstPtr &inst=StaticInst::nullStaticInstPtr) override
void annotate(ArmFault::AnnotationIDs id, uint64_t val) override
ExceptionClass overrideEc
virtual bool getFaultVAddr(Addr &va) const
virtual bool routeToHyp(ThreadContext *tc) const
void invoke(ThreadContext *tc, const StaticInstPtr &inst=StaticInst::nullStaticInstPtr) override
bool routeToHyp(ThreadContext *tc) const override
static uint8_t shortDescFaultSources[NumFaultSources]
Encodings of the fault sources when the short-desc.
virtual FaultName name() const =0
virtual void setMiscRegNoEffect(RegIndex misc_reg, RegVal val)=0
ExceptionClass overrideEc
bool abortDisable(ThreadContext *tc) override
bool routeToHyp(ThreadContext *tc) const override
virtual RegVal readIntReg(RegIndex reg_idx) const =0
static uint8_t longDescFaultSources[NumFaultSources]
Encodings of the fault sources when the long-desc.
bool routeToHyp(ThreadContext *tc) const override
void invoke(ThreadContext *tc, const StaticInstPtr &inst) override
virtual BaseCPU * getCpuPtr()=0
Watchpoint(ExtMachInst _mach_inst, Addr _vaddr, bool _write, bool _cm)
std::string csprintf(const char *format, const Args &...args)
bool routeToMonitor(ThreadContext *tc) const override
Addr faultPC
The unaligned value of the PC.
bool isSecure(ThreadContext *tc)
virtual System * getSystemPtr()=0
uint32_t iss() const override
#define panic(...)
This implements a cprintf based panic() function.
virtual bool abortDisable(ThreadContext *tc)=0
@ EC_HW_BREAKPOINT_LOWER_EL
void invoke(ThreadContext *tc, const StaticInstPtr &inst=StaticInst::nullStaticInstPtr) override
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Addr faultAddr
The virtual address the fault occured at.
T * get() const
Directly access the pointer itself without taking a reference.
Generated on Wed Sep 30 2020 14:01:59 for gem5 by doxygen 1.8.17