61 ccprintf(ss,
", #%d, #%d", imm1, imm2);
93 if (el <=
EL1 && checkEL1Trap(tc, misc_reg, el, ec, immediate)) {
94 return std::make_shared<SupervisorTrap>(
machInst, immediate,
ec);
99 checkEL2Trap(tc, misc_reg, el, ec, immediate)) {
100 return std::make_shared<HypervisorTrap>(
machInst, immediate,
ec);
105 checkEL3Trap(tc, misc_reg, el, ec, immediate)) {
106 return std::make_shared<SecureMonitorTrap>(
machInst, immediate,
ec);
115 uint32_t &immediate)
const 119 bool trap_to_sup =
false;
124 if ((el ==
EL0 && cpacr.fpen != 0x3) ||
125 (el ==
EL1 && !(cpacr.fpen & 0x1))) {
128 immediate = 0x1E00000;
140 uint32_t &immediate)
const 147 bool trap_to_hyp =
false;
155 trap_to_hyp = cptr.tfp;
157 immediate = 0x1E00000;
161 trap_to_hyp = cptr.tcpac && el ==
EL1;
176 ((hcr.trvm && miscRead) || (hcr.tvm && !miscRead)) &&
192 trap_to_hyp = hcr.ttlb && el ==
EL1;
199 trap_to_hyp = hcr.tpu && el <=
EL1;
206 trap_to_hyp = hcr.tpc && el <=
EL1;
212 trap_to_hyp = hcr.tsw && el ==
EL1;
216 trap_to_hyp = hcr.tacr && el ==
EL1;
229 trap_to_hyp = el==
EL1 && hcr.apk == 0;
264 trap_to_hyp = hcr.tid3 && el ==
EL1;
271 trap_to_hyp = hcr.tid2 && el <=
EL1;
277 trap_to_hyp = hcr.tid1 && el ==
EL1;
280 trap_to_hyp = hcr.tidcp && el ==
EL1;
286 if (isa->haveGICv3CpuIfc())
287 trap_to_hyp = hcr.fmo && el ==
EL1;
294 if (isa->haveGICv3CpuIfc())
295 trap_to_hyp = hcr.imo && el ==
EL1;
308 uint32_t &immediate)
const 312 bool trap_to_mon =
false;
319 trap_to_mon = cptr.tfp;
321 immediate = 0x1E00000;
325 if (el ==
EL1 || el ==
EL2) {
326 trap_to_mon = cptr.tcpac;
331 trap_to_mon = cptr.tcpac;
358 return (
imm & 0x1) << 22;
360 panic(
"Not a valid PSTATE field register\n");
367 std::stringstream
ss;
379 std::stringstream
ss;
391 std::stringstream
ss;
407 Fault fault = trap(tc, miscReg, el,
imm);
412 }
else if (warning) {
413 warn_once(
"\tinstruction '%s' unimplemented\n", fullMnemonic.c_str());
417 return std::make_shared<UndefinedInstruction>(
machInst,
false,
426 return csprintf(
"%-10s (implementation defined)", fullMnemonic.c_str());
#define panic(...)
This implements a cprintf based panic() function.
void ccprintf(cp::Print &print)
void printMnemonic(std::ostream &os, const std::string &suffix="", bool withPred=true, bool withCond64=false, ConditionCode cond64=COND_UC) const
decltype(nullptr) constexpr NoFault
bool haveSecurity() const
Returns true if this system implements the Security Extensions.
Fault trap(ThreadContext *tc, MiscRegIndex misc_reg, ExceptionLevel el, uint32_t immediate) const
RegVal miscRegImm() const
Returns the "register view" of the immediate field.
std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const override
Internal function to generate disassembly string.
const char * mnemonic
Base mnemonic (e.g., "add").
bool checkEL1Trap(ThreadContext *tc, const MiscRegIndex misc_reg, ExceptionLevel el, ExceptionClass &ec, uint32_t &immediate) const
std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const override
Internal function to generate disassembly string.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
bool checkEL3Trap(ThreadContext *tc, const MiscRegIndex misc_reg, ExceptionLevel el, ExceptionClass &ec, uint32_t &immediate) const
bool ELIs64(ThreadContext *tc, ExceptionLevel el)
const ExtMachInst machInst
The binary machine instruction.
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
std::string csprintf(const char *format, const Args &...args)
std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const override
Internal function to generate disassembly string.
void printIntReg(std::ostream &os, RegIndex reg_idx, uint8_t opWidth=0) const
Print a register name for disassembly given the unique dependence tag number (FP or int)...
Fault execute(ExecContext *xc, Trace::InstRecord *traceData) const override
bool haveVirtualization() const
Returns true if this system implements the virtualization Extensions.
virtual BaseISA * getIsaPtr()=0
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void printMiscReg(std::ostream &os, RegIndex reg_idx) const
std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const override
Internal function to generate disassembly string.
virtual ThreadContext * tcBase()=0
Returns a pointer to the ThreadContext.
std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const override
Internal function to generate disassembly string.
bool inSecureState(ThreadContext *tc)
std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const override
Internal function to generate disassembly string.
virtual RegVal readMiscReg(RegIndex misc_reg)=0
std::shared_ptr< FaultBase > Fault
MachInst encoding() const
Returns the real encoding of the instruction: the machInst field is in fact always 64 bit wide and co...
bool checkEL2Trap(ThreadContext *tc, const MiscRegIndex misc_reg, ExceptionLevel el, ExceptionClass &ec, uint32_t &immediate) const