gem5  v22.1.0.0
faults.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010, 2012-2013, 2016-2019, 2022 Arm Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2003-2005 The Regents of The University of Michigan
15  * Copyright (c) 2007-2008 The Florida State University
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions are
20  * met: redistributions of source code must retain the above copyright
21  * notice, this list of conditions and the following disclaimer;
22  * redistributions in binary form must reproduce the above copyright
23  * notice, this list of conditions and the following disclaimer in the
24  * documentation and/or other materials provided with the distribution;
25  * neither the name of the copyright holders nor the names of its
26  * contributors may be used to endorse or promote products derived from
27  * this software without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  */
41 
42 #ifndef __ARM_FAULTS_HH__
43 #define __ARM_FAULTS_HH__
44 
45 #include "arch/arm/pagetable.hh"
46 #include "arch/arm/regs/misc.hh"
47 #include "arch/arm/types.hh"
48 #include "base/logging.hh"
49 #include "cpu/null_static_inst.hh"
50 #include "sim/faults.hh"
51 #include "sim/full_system.hh"
52 
53 namespace gem5
54 {
55 
56 // The design of the "name" and "vect" functions is in sim/faults.hh
57 
58 namespace ArmISA
59 {
60 typedef Addr FaultOffset;
61 
62 class ArmStaticInst;
63 
64 class ArmFault : public FaultBase
65 {
66  protected:
68  uint32_t issRaw;
69 
70  // Helper variables for ARMv8 exception handling
71  bool bStep; // True if the Arm Faul exception is a software Step exception
72  bool from64; // True if the exception is generated from the AArch64 state
73  bool to64; // True if the exception is taken in AArch64 state
74  ExceptionLevel fromEL; // Source exception level
75  ExceptionLevel toEL; // Target exception level
76  OperatingMode fromMode; // Source operating mode (aarch32)
77  OperatingMode toMode; // Next operating mode (aarch32)
78 
79  // This variable is true if the above fault specific informations
80  // have been updated. This is to prevent that a client is using their
81  // un-updated default constructed value.
83 
84  bool hypRouted; // True if the fault has been routed to Hypervisor
85  bool span; // True if the fault is setting the PSTATE.PAN bit
86 
87  virtual Addr getVector(ThreadContext *tc);
89 
90  public:
96  {
98  InstructionCacheMaintenance, // Short-desc. format only
107  TLBConflictAbort, // Requires LPAE
111  AddressSizeLL, // AArch64 only
112 
113  // Not real faults. These are faults to allow the translation function
114  // to inform the memory access function not to proceed for a prefetch
115  // that misses in the TLB or that targets an uncacheable address
118 
120  FaultSourceInvalid = 0xff
121  };
122 
131 
133  {
134  S1PTW, // DataAbort, PrefetchAbort: Stage 1 Page Table Walk,
135  OVA, // DataAbort, PrefetchAbort: stage 1 Virtual Address for stage 2 faults
136  SAS, // DataAbort: Syndrome Access Size
137  SSE, // DataAbort: Syndrome Sign Extend
138  SRT, // DataAbort: Syndrome Register Transfer
139  CM, // DataAbort: Cache Maintenance/Address Translation Op
140  OFA, // DataAbort: Override fault Address. This is needed when
141  // the abort is triggered by a CMO. The faulting address is
142  // then the address specified in the register argument of the
143  // instruction and not the cacheline address (See FAR doc)
144 
145  // AArch64 only
146  SF, // DataAbort: width of the accessed register is SixtyFour
147  AR // DataAbort: Acquire/Release semantics
148  };
149 
151  {
155  };
156 
158  {
159  NODEBUG = 0,
164  };
165 
166  struct FaultVals
167  {
169 
171 
172  // Offsets used for exceptions taken in AArch64 state
173  const uint16_t currELTOffset;
174  const uint16_t currELHOffset;
175  const uint16_t lowerEL64Offset;
176  const uint16_t lowerEL32Offset;
177 
179 
180  const uint8_t armPcOffset;
181  const uint8_t thumbPcOffset;
182  // The following two values are used in place of armPcOffset and
183  // thumbPcOffset when the exception return address is saved into ELR
184  // registers (exceptions taken in HYP mode or in AArch64 state)
185  const uint8_t armPcElrOffset;
186  const uint8_t thumbPcElrOffset;
187 
188  const bool hypTrappable;
189  const bool abortDisable;
190  const bool fiqDisable;
191 
192  // Exception class used to appropriately set the syndrome register
193  // (exceptions taken in HYP mode or in AArch64 state)
195 
196  FaultVals(const FaultName& name_, FaultOffset offset_,
197  uint16_t curr_elt_offset, uint16_t curr_elh_offset,
198  uint16_t lower_el64_offset,
199  uint16_t lower_el32_offset,
200  OperatingMode next_mode, uint8_t arm_pc_offset,
201  uint8_t thumb_pc_offset, uint8_t arm_pc_elr_offset,
202  uint8_t thumb_pc_elr_offset, bool hyp_trappable,
203  bool abort_disable, bool fiq_disable,
204  ExceptionClass ec_)
205  : name(name_), offset(offset_), currELTOffset(curr_elt_offset),
206  currELHOffset(curr_elh_offset), lowerEL64Offset(lower_el64_offset),
207  lowerEL32Offset(lower_el32_offset), nextMode(next_mode),
208  armPcOffset(arm_pc_offset), thumbPcOffset(thumb_pc_offset),
209  armPcElrOffset(arm_pc_elr_offset),
210  thumbPcElrOffset(thumb_pc_elr_offset),
211  hypTrappable(hyp_trappable), abortDisable(abort_disable),
212  fiqDisable(fiq_disable), ec(ec_) {}
213  };
214 
215  ArmFault(ExtMachInst mach_inst = 0, uint32_t _iss = 0) :
216  machInst(mach_inst), issRaw(_iss), bStep(false), from64(false),
218  faultUpdated(false), hypRouted(false), span(false) {}
219 
220  // Returns the actual syndrome register to use based on the target
221  // exception level
223  // Returns the actual fault address register to use based on the target
224  // exception level
226 
227  void invoke(ThreadContext *tc, const StaticInstPtr &inst =
228  nullStaticInstPtr) override;
229  void invoke32(ThreadContext *tc, const StaticInstPtr &inst =
231  void invoke64(ThreadContext *tc, const StaticInstPtr &inst =
233  void update(ThreadContext *tc);
234  bool isResetSPSR(){ return bStep; }
235 
236  bool vectorCatch(ThreadContext *tc, const StaticInstPtr &inst);
237 
239  virtual void annotate(AnnotationIDs id, uint64_t val) {}
240  virtual FaultOffset offset(ThreadContext *tc) = 0;
242  virtual OperatingMode nextMode() = 0;
243  virtual bool routeToMonitor(ThreadContext *tc) const = 0;
244  virtual bool routeToHyp(ThreadContext *tc) const { return false; }
245  virtual uint8_t armPcOffset(bool is_hyp) = 0;
246  virtual uint8_t thumbPcOffset(bool is_hyp) = 0;
247  virtual uint8_t armPcElrOffset() = 0;
248  virtual uint8_t thumbPcElrOffset() = 0;
249  virtual bool abortDisable(ThreadContext *tc) = 0;
250  virtual bool fiqDisable(ThreadContext *tc) = 0;
251  virtual ExceptionClass ec(ThreadContext *tc) const = 0;
252  virtual bool il(ThreadContext *tc) const = 0;
253  virtual uint32_t iss() const = 0;
254  virtual uint32_t vectorCatchFlag() const { return 0x0; }
255  virtual bool isStage2() const { return false; }
256  virtual FSR getFsr(ThreadContext *tc) const { return 0; }
257  virtual void setSyndrome(ThreadContext *tc, MiscRegIndex syndrome_reg);
258  virtual bool getFaultVAddr(Addr &va) const { return false; }
259  OperatingMode getToMode() const { return toMode; }
260 };
261 
262 template<typename T>
263 class ArmFaultVals : public ArmFault
264 {
265  protected:
266  static FaultVals vals;
267 
268  public:
269  ArmFaultVals<T>(ExtMachInst mach_inst = 0, uint32_t _iss = 0) :
270  ArmFault(mach_inst, _iss) {}
271  FaultName name() const override { return vals.name; }
272  FaultOffset offset(ThreadContext *tc) override;
273 
274  FaultOffset offset64(ThreadContext *tc) override;
275 
276  OperatingMode nextMode() override { return vals.nextMode; }
277 
278  virtual bool
279  routeToMonitor(ThreadContext *tc) const override
280  {
281  return false;
282  }
283 
284  uint8_t
285  armPcOffset(bool is_hyp) override
286  {
287  return is_hyp ? vals.armPcElrOffset
288  : vals.armPcOffset;
289  }
290 
291  uint8_t
292  thumbPcOffset(bool is_hyp) override
293  {
294  return is_hyp ? vals.thumbPcElrOffset
296  }
297 
298  uint8_t armPcElrOffset() override { return vals.armPcElrOffset; }
299  uint8_t thumbPcElrOffset() override { return vals.thumbPcElrOffset; }
300  bool abortDisable(ThreadContext* tc) override { return vals.abortDisable; }
301  bool fiqDisable(ThreadContext* tc) override { return vals.fiqDisable; }
302 
304  ExceptionClass ec(ThreadContext *tc) const override { return vals.ec; }
305  bool
306  il(ThreadContext *tc) const override
307  {
308  // ESR.IL = 1 if exception cause is unknown (EC = 0)
309  return ec(tc) == ExceptionClass::UNKNOWN ||
310  !machInst.thumb || machInst.bigThumb;
311  }
312  uint32_t iss() const override { return issRaw; }
313 };
314 
315 class Reset : public ArmFaultVals<Reset>
316 {
317  protected:
318  Addr getVector(ThreadContext *tc) override;
319 
320  public:
321  void invoke(ThreadContext *tc, const StaticInstPtr &inst =
322  nullStaticInstPtr) override;
323 };
324 
325 class UndefinedInstruction : public ArmFaultVals<UndefinedInstruction>
326 {
327  protected:
328  bool unknown;
329  bool disabled;
331  const char *mnemonic;
332 
333  public:
335  bool _unknown,
336  const char *_mnemonic = NULL,
337  bool _disabled = false) :
339  unknown(_unknown), disabled(_disabled),
341  {}
342  UndefinedInstruction(ExtMachInst mach_inst, uint32_t _iss,
343  ExceptionClass _overrideEc, const char *_mnemonic = NULL) :
344  ArmFaultVals<UndefinedInstruction>(mach_inst, _iss),
345  unknown(false), disabled(true), overrideEc(_overrideEc),
346  mnemonic(_mnemonic)
347  {}
348 
349  void invoke(ThreadContext *tc, const StaticInstPtr &inst =
350  nullStaticInstPtr) override;
351  bool routeToHyp(ThreadContext *tc) const override;
352  uint32_t vectorCatchFlag() const override { return 0x02000002; }
353 
355  ExceptionClass ec(ThreadContext *tc) const override;
356  uint32_t iss() const override;
357 };
358 
359 class SupervisorCall : public ArmFaultVals<SupervisorCall>
360 {
361  protected:
363  public:
364  SupervisorCall(ExtMachInst mach_inst, uint32_t _iss,
365  ExceptionClass _overrideEc = ExceptionClass::INVALID) :
366  ArmFaultVals<SupervisorCall>(mach_inst, _iss),
367  overrideEc(_overrideEc)
368  {
369  bStep = true;
370  }
371 
372  void invoke(ThreadContext *tc, const StaticInstPtr &inst =
373  nullStaticInstPtr) override;
374  bool routeToHyp(ThreadContext *tc) const override;
375  uint32_t vectorCatchFlag() const override { return 0x04000404; }
376 
378  ExceptionClass ec(ThreadContext *tc) const override;
379  uint32_t iss() const override;
380 };
381 
382 class SecureMonitorCall : public ArmFaultVals<SecureMonitorCall>
383 {
384  public:
386  ArmFaultVals<SecureMonitorCall>(mach_inst)
387  {
388  bStep = true;
389  }
390 
391  void invoke(ThreadContext *tc, const StaticInstPtr &inst =
392  nullStaticInstPtr) override;
393  uint32_t vectorCatchFlag() const override { return 0x00000400; }
394 
396  ExceptionClass ec(ThreadContext *tc) const override;
397  uint32_t iss() const override;
398 };
399 
400 class SupervisorTrap : public ArmFaultVals<SupervisorTrap>
401 {
402  protected:
405 
406  public:
407  SupervisorTrap(ExtMachInst mach_inst, uint32_t _iss,
408  ExceptionClass _overrideEc = ExceptionClass::INVALID) :
409  ArmFaultVals<SupervisorTrap>(mach_inst, _iss),
410  overrideEc(_overrideEc)
411  {}
412 
413  bool routeToHyp(ThreadContext *tc) const override;
414 
416  ExceptionClass ec(ThreadContext *tc) const override;
417  uint32_t iss() const override;
418 };
419 
420 class SecureMonitorTrap : public ArmFaultVals<SecureMonitorTrap>
421 {
422  protected:
425 
426  public:
427  SecureMonitorTrap(ExtMachInst mach_inst, uint32_t _iss,
428  ExceptionClass _overrideEc = ExceptionClass::INVALID) :
429  ArmFaultVals<SecureMonitorTrap>(mach_inst, _iss),
430  overrideEc(_overrideEc)
431  {}
432 
434  ExceptionClass ec(ThreadContext *tc) const override;
435 };
436 
437 class HypervisorCall : public ArmFaultVals<HypervisorCall>
438 {
439  public:
440  HypervisorCall(ExtMachInst mach_inst, uint32_t _imm);
441 
442  bool routeToHyp(ThreadContext *tc) const override;
443  bool routeToMonitor(ThreadContext *tc) const override;
444  uint32_t vectorCatchFlag() const override { return 0xFFFFFFFF; }
445 
447  ExceptionClass ec(ThreadContext *tc) const override;
448 };
449 
450 class HypervisorTrap : public ArmFaultVals<HypervisorTrap>
451 {
452  protected:
455 
456  public:
457  HypervisorTrap(ExtMachInst mach_inst, uint32_t _iss,
458  ExceptionClass _overrideEc = ExceptionClass::INVALID) :
459  ArmFaultVals<HypervisorTrap>(mach_inst, _iss),
460  overrideEc(_overrideEc)
461  {}
462 
464  ExceptionClass ec(ThreadContext *tc) const override;
465 };
466 
467 template <class T>
468 class AbortFault : public ArmFaultVals<T>
469 {
470  protected:
484  bool write;
486  uint8_t source;
487  uint8_t srcEncoded;
488  bool stage2;
489  bool s1ptw;
492 
493  public:
494  AbortFault(Addr _faultAddr, bool _write, TlbEntry::DomainType _domain,
495  uint8_t _source, bool _stage2,
498  faultAddr(_faultAddr), OVAddr(0), write(_write),
499  domain(_domain), source(_source), srcEncoded(0),
500  stage2(_stage2), s1ptw(false), tranMethod(_tranMethod),
501  debugType(_debug)
502  {}
503 
504  bool getFaultVAddr(Addr &va) const override;
505 
506  void invoke(ThreadContext *tc, const StaticInstPtr &inst =
507  nullStaticInstPtr) override;
508 
509  FSR getFsr(ThreadContext *tc) const override;
510  uint8_t getFaultStatusCode(ThreadContext *tc) const;
511  bool abortDisable(ThreadContext *tc) override;
512  bool isStage2() const override { return stage2; }
513  void annotate(ArmFault::AnnotationIDs id, uint64_t val) override;
514  void setSyndrome(ThreadContext *tc, MiscRegIndex syndrome_reg) override;
515  bool isMMUFault() const;
516 };
517 
518 class PrefetchAbort : public AbortFault<PrefetchAbort>
519 {
520  public:
524 
525  PrefetchAbort(Addr _addr, uint8_t _source, bool _stage2 = false,
528  AbortFault<PrefetchAbort>(_addr, false, TlbEntry::DomainType::NoAccess,
529  _source, _stage2, _tranMethod, _debug)
530  {}
531 
532  // @todo: external aborts should be routed if SCR.EA == 1
533  bool routeToMonitor(ThreadContext *tc) const override;
534  bool routeToHyp(ThreadContext *tc) const override;
535  uint32_t vectorCatchFlag() const override { return 0x08000808; }
536 
538  ExceptionClass ec(ThreadContext *tc) const override;
539  bool il(ThreadContext *tc) const override { return true; }
540  uint32_t iss() const override;
541 };
542 
543 class DataAbort : public AbortFault<DataAbort>
544 {
545  public:
549  bool isv;
550  uint8_t sas;
551  uint8_t sse;
552  uint8_t srt;
553  uint8_t cm;
554 
555  // AArch64 only
556  bool sf;
557  bool ar;
558 
559  DataAbort(Addr _addr, TlbEntry::DomainType _domain, bool _write, uint8_t _source,
560  bool _stage2=false,
563  AbortFault<DataAbort>(_addr, _write, _domain, _source, _stage2,
564  _tranMethod, _debug_type),
565  isv(false), sas (0), sse(0), srt(0), cm(0), sf(false), ar(false)
566  {}
567 
568  // @todo: external aborts should be routed if SCR.EA == 1
569  bool routeToMonitor(ThreadContext *tc) const override;
570  bool routeToHyp(ThreadContext *tc) const override;
571  void annotate(AnnotationIDs id, uint64_t val) override;
572  uint32_t vectorCatchFlag() const override { return 0x10001010; }
573 
575  ExceptionClass ec(ThreadContext *tc) const override;
576  bool il(ThreadContext *tc) const override;
577  uint32_t iss() const override;
578 };
579 
580 class VirtualDataAbort : public AbortFault<VirtualDataAbort>
581 {
582  public:
586 
587  VirtualDataAbort(Addr _addr, TlbEntry::DomainType _domain, bool _write,
588  uint8_t _source) :
589  AbortFault<VirtualDataAbort>(_addr, _write, _domain, _source, false)
590  {}
591 
592  void invoke(ThreadContext *tc, const StaticInstPtr &inst) override;
593 };
594 
595 class Interrupt : public ArmFaultVals<Interrupt>
596 {
597  public:
598  bool routeToMonitor(ThreadContext *tc) const override;
599  bool routeToHyp(ThreadContext *tc) const override;
600  bool abortDisable(ThreadContext *tc) override;
601  uint32_t vectorCatchFlag() const override { return 0x40004040; }
602 };
603 
604 class VirtualInterrupt : public ArmFaultVals<VirtualInterrupt>
605 {
606  public:
608 };
609 
610 class FastInterrupt : public ArmFaultVals<FastInterrupt>
611 {
612  public:
613  bool routeToMonitor(ThreadContext *tc) const override;
614  bool routeToHyp(ThreadContext *tc) const override;
615  bool abortDisable(ThreadContext *tc) override;
616  bool fiqDisable(ThreadContext *tc) override;
617  uint32_t vectorCatchFlag() const override { return 0x80008080; }
618 };
619 
620 class VirtualFastInterrupt : public ArmFaultVals<VirtualFastInterrupt>
621 {
622  public:
624 };
625 
627 class PCAlignmentFault : public ArmFaultVals<PCAlignmentFault>
628 {
629  protected:
632  public:
633  PCAlignmentFault(Addr fault_pc) : faultPC(fault_pc)
634  {}
635  void invoke(ThreadContext *tc, const StaticInstPtr &inst =
636  nullStaticInstPtr) override;
637  bool routeToHyp(ThreadContext *tc) const override;
638 
640  bool il(ThreadContext *tc) const override { return true; }
641 };
642 
644 class SPAlignmentFault : public ArmFaultVals<SPAlignmentFault>
645 {
646  public:
648  bool routeToHyp(ThreadContext *tc) const override;
649 
651  bool il(ThreadContext *tc) const override { return true; }
652 };
653 
655 class SystemError : public ArmFaultVals<SystemError>
656 {
657  public:
658  SystemError();
659  void invoke(ThreadContext *tc, const StaticInstPtr &inst =
660  nullStaticInstPtr) override;
661  bool routeToMonitor(ThreadContext *tc) const override;
662  bool routeToHyp(ThreadContext *tc) const override;
663 
665  bool il(ThreadContext *tc) const override { return true; }
666 };
667 
669 class SoftwareBreakpoint : public ArmFaultVals<SoftwareBreakpoint>
670 {
671  public:
672  SoftwareBreakpoint(ExtMachInst mach_inst, uint32_t _iss);
673  bool routeToHyp(ThreadContext *tc) const override;
674 
676  ExceptionClass ec(ThreadContext *tc) const override;
677 };
678 
679 class HardwareBreakpoint : public ArmFaultVals<HardwareBreakpoint>
680 {
681  private:
683  public:
684  void invoke(ThreadContext *tc, const StaticInstPtr &inst =
685  nullStaticInstPtr) override;
686  HardwareBreakpoint(Addr _vaddr, uint32_t _iss);
687  bool routeToHyp(ThreadContext *tc) const override;
688 
690  ExceptionClass ec(ThreadContext *tc) const override;
691  bool il(ThreadContext *tc) const override { return true; }
692 };
693 
694 class Watchpoint : public ArmFaultVals<Watchpoint>
695 {
696  private:
698  bool write;
699  bool cm;
700 
701  public:
702  Watchpoint(ExtMachInst mach_inst, Addr vaddr, bool _write, bool _cm);
703  void invoke(ThreadContext *tc, const StaticInstPtr &inst =
704  nullStaticInstPtr) override;
705  bool routeToHyp(ThreadContext *tc) const override;
706  void annotate(AnnotationIDs id, uint64_t val) override;
707 
709  ExceptionClass ec(ThreadContext *tc) const override;
710  bool il(ThreadContext *tc) const override { return true; }
711  uint32_t iss() const override;
712 };
713 
714 class SoftwareStepFault : public ArmFaultVals<SoftwareStepFault>
715 {
716  private:
717  bool isldx;
718  bool stepped;
719 
720  public:
721  SoftwareStepFault(ExtMachInst mach_inst, bool is_ldx, bool stepped);
722  bool routeToHyp(ThreadContext *tc) const override;
723 
725  ExceptionClass ec(ThreadContext *tc) const override;
726  bool il(ThreadContext *tc) const override { return true; }
727  uint32_t iss() const override;
728 };
729 
730 // A fault that flushes the pipe, excluding the faulting instructions
731 class ArmSev : public ArmFaultVals<ArmSev>
732 {
733  public:
734  ArmSev() {}
735  void invoke(ThreadContext *tc, const StaticInstPtr &inst =
736  nullStaticInstPtr) override;
737 };
738 
740 class IllegalInstSetStateFault : public ArmFaultVals<IllegalInstSetStateFault>
741 {
742  public:
744  bool routeToHyp(ThreadContext *tc) const override;
745 
747  bool il(ThreadContext *tc) const override { return true; }
748 };
749 
750 /*
751  * Explicitly declare template static member variables to avoid warnings
752  * in some clang versions
753  */
778 
789 bool getFaultVAddr(Fault fault, Addr &va);
790 
791 } // namespace ArmISA
792 } // namespace gem5
793 
794 #endif // __ARM_FAULTS_HH__
ArmFault::TranMethod tranMethod
Definition: faults.hh:490
AbortFault(Addr _faultAddr, bool _write, TlbEntry::DomainType _domain, uint8_t _source, bool _stage2, ArmFault::TranMethod _tranMethod=ArmFault::UnknownTran, ArmFault::DebugType _debug=ArmFault::NODEBUG)
Definition: faults.hh:494
Addr OVAddr
Original virtual address.
Definition: faults.hh:483
Addr faultAddr
The virtual address the fault occured at.
Definition: faults.hh:477
void setSyndrome(ThreadContext *tc, MiscRegIndex syndrome_reg) override
Definition: faults.cc:1150
uint8_t getFaultStatusCode(ThreadContext *tc) const
Definition: faults.cc:1161
TlbEntry::DomainType domain
Definition: faults.hh:485
ArmFault::DebugType debugType
Definition: faults.hh:491
bool isStage2() const override
Definition: faults.hh:512
void annotate(ArmFault::AnnotationIDs id, uint64_t val) override
Definition: faults.cc:1223
bool abortDisable(ThreadContext *tc) override
Definition: faults.cc:1212
bool getFaultVAddr(Addr &va) const override
Definition: faults.cc:1259
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition: faults.cc:1068
FSR getFsr(ThreadContext *tc) const override
Definition: faults.cc:1187
bool isMMUFault() const
Definition: faults.cc:1242
virtual bool routeToMonitor(ThreadContext *tc) const override
Definition: faults.hh:279
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.hh:304
FaultOffset offset64(ThreadContext *tc) override
Definition: faults.cc:978
bool il(ThreadContext *tc) const override
Definition: faults.hh:306
uint8_t armPcOffset(bool is_hyp) override
Definition: faults.hh:285
bool fiqDisable(ThreadContext *tc) override
Definition: faults.hh:301
uint32_t iss() const override
Definition: faults.hh:312
uint8_t armPcElrOffset() override
Definition: faults.hh:298
bool abortDisable(ThreadContext *tc) override
Definition: faults.hh:300
OperatingMode nextMode() override
Definition: faults.hh:276
FaultName name() const override
Definition: faults.hh:271
static FaultVals vals
Definition: faults.hh:266
uint8_t thumbPcOffset(bool is_hyp) override
Definition: faults.hh:292
uint8_t thumbPcElrOffset() override
Definition: faults.hh:299
FaultOffset offset(ThreadContext *tc) override
Definition: faults.cc:958
virtual FaultOffset offset(ThreadContext *tc)=0
ExceptionLevel toEL
Definition: faults.hh:75
virtual FSR getFsr(ThreadContext *tc) const
Definition: faults.hh:256
OperatingMode toMode
Definition: faults.hh:77
virtual bool routeToMonitor(ThreadContext *tc) const =0
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition: faults.cc:477
FaultSource
Generic fault source enums used to index into {short/long/aarch64}DescFaultSources[] to get the actua...
Definition: faults.hh:96
@ SynchExtAbtOnTranslTableWalkLL
Definition: faults.hh:99
MiscRegIndex getFaultAddrReg64() const
Definition: faults.cc:382
virtual uint32_t iss() const =0
static uint8_t shortDescFaultSources[NumFaultSources]
Encodings of the fault sources when the short-desc.
Definition: faults.hh:125
virtual bool routeToHyp(ThreadContext *tc) const
Definition: faults.hh:244
void invoke32(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr)
Definition: faults.cc:504
virtual uint8_t thumbPcOffset(bool is_hyp)=0
MiscRegIndex getSyndromeReg64() const
Definition: faults.cc:366
virtual void annotate(AnnotationIDs id, uint64_t val)
Definition: faults.hh:239
virtual Addr getVector(ThreadContext *tc)
Definition: faults.cc:311
virtual bool il(ThreadContext *tc) const =0
ArmStaticInst * instrAnnotate(const StaticInstPtr &inst)
Definition: faults.cc:747
virtual FaultOffset offset64(ThreadContext *tc)=0
virtual bool abortDisable(ThreadContext *tc)=0
virtual uint32_t vectorCatchFlag() const
Definition: faults.hh:254
void update(ThreadContext *tc)
Definition: faults.cc:428
static uint8_t longDescFaultSources[NumFaultSources]
Encodings of the fault sources when the long-desc.
Definition: faults.hh:128
void invoke64(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr)
Definition: faults.cc:637
virtual bool isStage2() const
Definition: faults.hh:255
virtual uint8_t armPcOffset(bool is_hyp)=0
virtual uint8_t thumbPcElrOffset()=0
ExtMachInst machInst
Definition: faults.hh:67
virtual bool fiqDisable(ThreadContext *tc)=0
OperatingMode getToMode() const
Definition: faults.hh:259
virtual bool getFaultVAddr(Addr &va) const
Definition: faults.hh:258
bool vectorCatch(ThreadContext *tc, const StaticInstPtr &inst)
Definition: faults.cc:733
static uint8_t aarch64FaultSources[NumFaultSources]
Encodings of the fault sources in AArch64 state.
Definition: faults.hh:130
ExceptionLevel fromEL
Definition: faults.hh:74
virtual uint8_t armPcElrOffset()=0
virtual OperatingMode nextMode()=0
virtual ExceptionClass ec(ThreadContext *tc) const =0
Addr getVector64(ThreadContext *tc)
Definition: faults.cc:343
virtual void setSyndrome(ThreadContext *tc, MiscRegIndex syndrome_reg)
Definition: faults.cc:398
ArmFault(ExtMachInst mach_inst=0, uint32_t _iss=0)
Definition: faults.hh:215
OperatingMode fromMode
Definition: faults.hh:76
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition: faults.cc:1764
static const MiscRegIndex FarIndex
Definition: faults.hh:547
bool routeToHyp(ThreadContext *tc) const override
Definition: faults.cc:1367
uint32_t iss() const override
Definition: faults.cc:1391
void annotate(AnnotationIDs id, uint64_t val) override
Definition: faults.cc:1419
DataAbort(Addr _addr, TlbEntry::DomainType _domain, bool _write, uint8_t _source, bool _stage2=false, ArmFault::TranMethod _tranMethod=ArmFault::UnknownTran, ArmFault::DebugType _debug_type=ArmFault::NODEBUG)
Definition: faults.hh:559
bool il(ThreadContext *tc) const override
Definition: faults.cc:1354
uint32_t vectorCatchFlag() const override
Definition: faults.hh:572
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.cc:1325
bool routeToMonitor(ThreadContext *tc) const override
Definition: faults.cc:1360
static const MiscRegIndex HFarIndex
Definition: faults.hh:548
static const MiscRegIndex FsrIndex
Definition: faults.hh:546
bool fiqDisable(ThreadContext *tc) override
Definition: faults.cc:1521
bool abortDisable(ThreadContext *tc) override
Definition: faults.cc:1511
bool routeToMonitor(ThreadContext *tc) const override
Definition: faults.cc:1495
bool routeToHyp(ThreadContext *tc) const override
Definition: faults.cc:1503
uint32_t vectorCatchFlag() const override
Definition: faults.hh:617
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition: faults.cc:1637
bool routeToHyp(ThreadContext *tc) const override
Definition: faults.cc:1618
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.cc:1627
bool il(ThreadContext *tc) const override
Definition: faults.hh:691
HardwareBreakpoint(Addr _vaddr, uint32_t _iss)
Definition: faults.cc:1613
bool routeToMonitor(ThreadContext *tc) const override
Definition: faults.cc:933
HypervisorCall(ExtMachInst mach_inst, uint32_t _imm)
Definition: faults.cc:926
uint32_t vectorCatchFlag() const override
Definition: faults.hh:444
bool routeToHyp(ThreadContext *tc) const override
Definition: faults.cc:939
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.cc:945
ExceptionClass overrideEc
Definition: faults.hh:454
HypervisorTrap(ExtMachInst mach_inst, uint32_t _iss, ExceptionClass _overrideEc=ExceptionClass::INVALID)
Definition: faults.hh:457
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.cc:951
Illegal Instruction Set State fault (AArch64 only)
Definition: faults.hh:741
bool il(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.hh:747
bool routeToHyp(ThreadContext *tc) const override
Definition: faults.cc:1810
uint32_t vectorCatchFlag() const override
Definition: faults.hh:601
bool abortDisable(ThreadContext *tc) override
Definition: faults.cc:1482
bool routeToHyp(ThreadContext *tc) const override
Definition: faults.cc:1474
bool routeToMonitor(ThreadContext *tc) const override
Definition: faults.cc:1466
PC alignment fault (AArch64 only)
Definition: faults.hh:628
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition: faults.cc:1536
bool il(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.hh:640
bool routeToHyp(ThreadContext *tc) const override
Definition: faults.cc:1545
Addr faultPC
The unaligned value of the PC.
Definition: faults.hh:631
PCAlignmentFault(Addr fault_pc)
Definition: faults.hh:633
PrefetchAbort(Addr _addr, uint8_t _source, bool _stage2=false, ArmFault::TranMethod _tranMethod=ArmFault::UnknownTran, ArmFault::DebugType _debug=ArmFault::NODEBUG)
Definition: faults.hh:525
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.cc:1266
uint32_t iss() const override
Definition: faults.cc:1291
static const MiscRegIndex FarIndex
Definition: faults.hh:522
bool il(ThreadContext *tc) const override
Definition: faults.hh:539
uint32_t vectorCatchFlag() const override
Definition: faults.hh:535
static const MiscRegIndex HFarIndex
Definition: faults.hh:523
bool routeToHyp(ThreadContext *tc) const override
Definition: faults.cc:1310
bool routeToMonitor(ThreadContext *tc) const override
Definition: faults.cc:1303
static const MiscRegIndex FsrIndex
Definition: faults.hh:521
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition: faults.cc:777
Addr getVector(ThreadContext *tc) override
Definition: faults.cc:759
Stack pointer alignment fault (AArch64 only)
Definition: faults.hh:645
bool routeToHyp(ThreadContext *tc) const override
Definition: faults.cc:1555
bool il(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.hh:651
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.cc:1028
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition: faults.cc:1019
uint32_t iss() const override
Definition: faults.cc:907
uint32_t vectorCatchFlag() const override
Definition: faults.hh:393
SecureMonitorCall(ExtMachInst mach_inst)
Definition: faults.hh:385
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.cc:1060
SecureMonitorTrap(ExtMachInst mach_inst, uint32_t _iss, ExceptionClass _overrideEc=ExceptionClass::INVALID)
Definition: faults.hh:427
Software Breakpoint (AArch64 only)
Definition: faults.hh:670
bool routeToHyp(ThreadContext *tc) const override
Definition: faults.cc:1598
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.cc:1608
SoftwareBreakpoint(ExtMachInst mach_inst, uint32_t _iss)
Definition: faults.cc:1593
bool routeToHyp(ThreadContext *tc) const override
Definition: faults.cc:1733
bool il(ThreadContext *tc) const override
Definition: faults.hh:726
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.cc:1743
uint32_t iss() const override
Definition: faults.cc:1753
SoftwareStepFault(ExtMachInst mach_inst, bool is_ldx, bool stepped)
Definition: faults.cc:1724
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition: faults.cc:865
uint32_t vectorCatchFlag() const override
Definition: faults.hh:375
ExceptionClass overrideEc
Definition: faults.hh:362
bool routeToHyp(ThreadContext *tc) const override
Definition: faults.cc:884
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.cc:892
uint32_t iss() const override
Definition: faults.cc:899
SupervisorCall(ExtMachInst mach_inst, uint32_t _iss, ExceptionClass _overrideEc=ExceptionClass::INVALID)
Definition: faults.hh:364
bool routeToHyp(ThreadContext *tc) const override
Definition: faults.cc:1034
SupervisorTrap(ExtMachInst mach_inst, uint32_t _iss, ExceptionClass _overrideEc=ExceptionClass::INVALID)
Definition: faults.hh:407
ExceptionClass overrideEc
Definition: faults.hh:404
uint32_t iss() const override
Definition: faults.cc:1041
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.cc:1051
System error (AArch64 only)
Definition: faults.hh:656
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition: faults.cc:1566
bool il(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.hh:665
bool routeToMonitor(ThreadContext *tc) const override
Definition: faults.cc:1573
bool routeToHyp(ThreadContext *tc) const override
Definition: faults.cc:1582
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition: faults.cc:805
UndefinedInstruction(ExtMachInst mach_inst, uint32_t _iss, ExceptionClass _overrideEc, const char *_mnemonic=NULL)
Definition: faults.hh:342
UndefinedInstruction(ExtMachInst mach_inst, bool _unknown, const char *_mnemonic=NULL, bool _disabled=false)
Definition: faults.hh:334
uint32_t vectorCatchFlag() const override
Definition: faults.hh:352
bool routeToHyp(ThreadContext *tc) const override
Definition: faults.cc:828
uint32_t iss() const override
Definition: faults.cc:836
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.cc:915
VirtualDataAbort(Addr _addr, TlbEntry::DomainType _domain, bool _write, uint8_t _source)
Definition: faults.hh:587
static const MiscRegIndex FsrIndex
Definition: faults.hh:583
void invoke(ThreadContext *tc, const StaticInstPtr &inst) override
Definition: faults.cc:1457
static const MiscRegIndex FarIndex
Definition: faults.hh:584
static const MiscRegIndex HFarIndex
Definition: faults.hh:585
Watchpoint(ExtMachInst mach_inst, Addr vaddr, bool _write, bool _cm)
Definition: faults.cc:1663
bool il(ThreadContext *tc) const override
Definition: faults.hh:710
bool routeToHyp(ThreadContext *tc) const override
Definition: faults.cc:1690
void annotate(AnnotationIDs id, uint64_t val) override
Definition: faults.cc:1700
ExceptionClass ec(ThreadContext *tc) const override
Syndrome methods.
Definition: faults.cc:1715
uint32_t iss() const override
Definition: faults.cc:1670
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition: faults.cc:1681
ThreadContext is the external interface to all thread state for anything outside of the CPU.
@ MODE_UNDEFINED
Definition: types.hh:295
bool getFaultVAddr(Fault fault, Addr &va)
Returns true if the fault passed as a first argument was triggered by a memory access,...
Definition: faults.cc:1817
MiscRegIndex
Definition: misc.hh:64
@ MISCREG_HDFAR
Definition: misc.hh:294
@ MISCREG_IFAR
Definition: misc.hh:291
@ MISCREG_DFAR
Definition: misc.hh:288
@ MISCREG_IFSR
Definition: misc.hh:276
@ MISCREG_DFSR
Definition: misc.hh:273
@ MISCREG_HIFAR
Definition: misc.hh:295
Addr FaultOffset
Definition: faults.hh:60
Bitfield< 8 > va
Definition: misc_types.hh:282
Bitfield< 63 > val
Definition: misc.hh:776
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::shared_ptr< FaultBase > Fault
Definition: types.hh:248
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
const char * FaultName
Definition: faults.hh:53
const StaticInstPtr nullStaticInstPtr
Statically allocated null StaticInstPtr.
const OperatingMode nextMode
Definition: faults.hh:178
const uint16_t lowerEL32Offset
Definition: faults.hh:176
const FaultOffset offset
Definition: faults.hh:170
FaultVals(const FaultName &name_, FaultOffset offset_, uint16_t curr_elt_offset, uint16_t curr_elh_offset, uint16_t lower_el64_offset, uint16_t lower_el32_offset, OperatingMode next_mode, uint8_t arm_pc_offset, uint8_t thumb_pc_offset, uint8_t arm_pc_elr_offset, uint8_t thumb_pc_elr_offset, bool hyp_trappable, bool abort_disable, bool fiq_disable, ExceptionClass ec_)
Definition: faults.hh:196
const ExceptionClass ec
Definition: faults.hh:194
const uint16_t lowerEL64Offset
Definition: faults.hh:175

Generated on Wed Dec 21 2022 10:22:24 for gem5 by doxygen 1.9.1