{
return csprintf("%-10s (inst %#08x)", "unknown", machInst & mask(32));
}
+
+McrMrcMiscInst::McrMrcMiscInst(const char *_mnemonic, ExtMachInst _machInst,
+ uint64_t _iss, MiscRegIndex _miscReg)
+ : ArmStaticInst(_mnemonic, _machInst, No_OpClass)
+{
+ flags[IsNonSpeculative] = true;
+ iss = _iss;
+ miscReg = _miscReg;
+}
+
+Fault
+McrMrcMiscInst::execute(ExecContext *xc, Trace::InstRecord *traceData) const
+{
+ uint32_t cpsr = xc->readMiscReg(MISCREG_CPSR);
+ uint32_t hcr = xc->readMiscReg(MISCREG_HCR);
+ uint32_t scr = xc->readMiscReg(MISCREG_SCR);
+ uint32_t hdcr = xc->readMiscReg(MISCREG_HDCR);
+ uint32_t hstr = xc->readMiscReg(MISCREG_HSTR);
+ uint32_t hcptr = xc->readMiscReg(MISCREG_HCPTR);
+
+ bool hypTrap = mcrMrc15TrapToHyp(miscReg, hcr, cpsr, scr, hdcr, hstr,
+ hcptr, iss);
+ if (hypTrap) {
+ return std::make_shared<HypervisorTrap>(machInst, iss,
+ EC_TRAPPED_CP15_MCR_MRC);
+ } else {
+ return NoFault;
+ }
+}
+
+std::string
+McrMrcMiscInst::generateDisassembly(Addr pc, const SymbolTable *symtab) const
+{
+ return csprintf("%-10s (pipe flush)", mnemonic);
+}
+
+McrMrcImplDefined::McrMrcImplDefined(const char *_mnemonic,
+ ExtMachInst _machInst, uint64_t _iss,
+ MiscRegIndex _miscReg)
+ : McrMrcMiscInst(_mnemonic, _machInst, _iss, _miscReg)
+{}
+
+Fault
+McrMrcImplDefined::execute(ExecContext *xc, Trace::InstRecord *traceData) const
+{
+ uint32_t cpsr = xc->readMiscReg(MISCREG_CPSR);
+ uint32_t hcr = xc->readMiscReg(MISCREG_HCR);
+ uint32_t scr = xc->readMiscReg(MISCREG_SCR);
+ uint32_t hdcr = xc->readMiscReg(MISCREG_HDCR);
+ uint32_t hstr = xc->readMiscReg(MISCREG_HSTR);
+ uint32_t hcptr = xc->readMiscReg(MISCREG_HCPTR);
+
+ bool hypTrap = mcrMrc15TrapToHyp(miscReg, hcr, cpsr, scr, hdcr, hstr,
+ hcptr, iss);
+ if (hypTrap) {
+ return std::make_shared<HypervisorTrap>(machInst, iss,
+ EC_TRAPPED_CP15_MCR_MRC);
+ } else {
+ return std::make_shared<UndefinedInstruction>(machInst, false,
+ mnemonic);
+ }
+}
+
+std::string
+McrMrcImplDefined::generateDisassembly(Addr pc,
+ const SymbolTable *symtab) const
+{
+ return csprintf("%-10s (implementation defined)", mnemonic);
+}
Addr pc, const SymbolTable *symtab) const override;
};
+/**
+ * Certain mrc/mcr instructions act as nops or flush the pipe based on what
+ * register the instruction is trying to access. This inst/class exists so that
+ * we can still check for hyp traps, as the normal nop instruction
+ * does not.
+ */
+class McrMrcMiscInst : public ArmStaticInst
+{
+ protected:
+ uint64_t iss;
+ MiscRegIndex miscReg;
+
+ public:
+ McrMrcMiscInst(const char *_mnemonic, ExtMachInst _machInst,
+ uint64_t _iss, MiscRegIndex _miscReg);
+
+ Fault execute(ExecContext *xc,
+ Trace::InstRecord *traceData) const override;
+
+ std::string generateDisassembly(
+ Addr pc, const SymbolTable *symtab) const override;
+
+};
+
+/**
+ * This class is also used for IMPLEMENTATION DEFINED registers, whose mcr/mrc
+ * behaviour is trappable even for unimplemented registers.
+ */
+class McrMrcImplDefined : public McrMrcMiscInst
+{
+ public:
+ McrMrcImplDefined(const char *_mnemonic, ExtMachInst _machInst,
+ uint64_t _iss, MiscRegIndex _miscReg);
+
+ Fault execute(ExecContext *xc,
+ Trace::InstRecord *traceData) const override;
+
+ std::string generateDisassembly(
+ Addr pc, const SymbolTable *symtab) const override;
+
+};
+
#endif
fullMnemonic.size() ? fullMnemonic.c_str() : mnemonic);
}
-McrMrcMiscInst::McrMrcMiscInst(const char *_mnemonic, ExtMachInst _machInst,
- uint64_t _iss, MiscRegIndex _miscReg)
- : ArmStaticInst(_mnemonic, _machInst, No_OpClass)
-{
- flags[IsNonSpeculative] = true;
- iss = _iss;
- miscReg = _miscReg;
-}
-
-Fault
-McrMrcMiscInst::execute(ExecContext *xc, Trace::InstRecord *traceData) const
-{
- uint32_t cpsr = xc->readMiscReg(MISCREG_CPSR);
- uint32_t hcr = xc->readMiscReg(MISCREG_HCR);
- uint32_t scr = xc->readMiscReg(MISCREG_SCR);
- uint32_t hdcr = xc->readMiscReg(MISCREG_HDCR);
- uint32_t hstr = xc->readMiscReg(MISCREG_HSTR);
- uint32_t hcptr = xc->readMiscReg(MISCREG_HCPTR);
-
- bool hypTrap = mcrMrc15TrapToHyp(miscReg, hcr, cpsr, scr, hdcr, hstr,
- hcptr, iss);
- if (hypTrap) {
- return std::make_shared<HypervisorTrap>(machInst, iss,
- EC_TRAPPED_CP15_MCR_MRC);
- } else {
- return NoFault;
- }
-}
-
-std::string
-McrMrcMiscInst::generateDisassembly(Addr pc, const SymbolTable *symtab) const
-{
- return csprintf("%-10s (pipe flush)", mnemonic);
-}
-
-McrMrcImplDefined::McrMrcImplDefined(const char *_mnemonic,
- ExtMachInst _machInst, uint64_t _iss,
- MiscRegIndex _miscReg)
- : McrMrcMiscInst(_mnemonic, _machInst, _iss, _miscReg)
-{}
-
-Fault
-McrMrcImplDefined::execute(ExecContext *xc, Trace::InstRecord *traceData) const
-{
- uint32_t cpsr = xc->readMiscReg(MISCREG_CPSR);
- uint32_t hcr = xc->readMiscReg(MISCREG_HCR);
- uint32_t scr = xc->readMiscReg(MISCREG_SCR);
- uint32_t hdcr = xc->readMiscReg(MISCREG_HDCR);
- uint32_t hstr = xc->readMiscReg(MISCREG_HSTR);
- uint32_t hcptr = xc->readMiscReg(MISCREG_HCPTR);
-
- bool hypTrap = mcrMrc15TrapToHyp(miscReg, hcr, cpsr, scr, hdcr, hstr,
- hcptr, iss);
- if (hypTrap) {
- return std::make_shared<HypervisorTrap>(machInst, iss,
- EC_TRAPPED_CP15_MCR_MRC);
- } else {
- return std::make_shared<UndefinedInstruction>(machInst, false,
- mnemonic);
- }
-}
-
-std::string
-McrMrcImplDefined::generateDisassembly(Addr pc,
- const SymbolTable *symtab) const
-{
- return csprintf("%-10s (implementation defined)", mnemonic);
-}
-
IllegalExecInst::IllegalExecInst(ExtMachInst _machInst)
: ArmStaticInst("Illegal Execution", _machInst, No_OpClass)
{}
Addr pc, const SymbolTable *symtab) const override;
};
-/**
- * Certain mrc/mcr instructions act as nops or flush the pipe based on what
- * register the instruction is trying to access. This inst/class exists so that
- * we can still check for hyp traps, as the normal nop instruction
- * does not.
- */
-class McrMrcMiscInst : public ArmStaticInst
-{
- protected:
- uint64_t iss;
- MiscRegIndex miscReg;
-
- public:
- McrMrcMiscInst(const char *_mnemonic, ExtMachInst _machInst,
- uint64_t _iss, MiscRegIndex _miscReg);
-
- Fault execute(ExecContext *xc,
- Trace::InstRecord *traceData) const override;
-
- std::string generateDisassembly(
- Addr pc, const SymbolTable *symtab) const override;
-
-};
-
-/**
- * This class is also used for IMPLEMENTATION DEFINED registers, whose mcr/mrc
- * behaviour is trappable even for unimplemented registers.
- */
-class McrMrcImplDefined : public McrMrcMiscInst
-{
- public:
- McrMrcImplDefined(const char *_mnemonic, ExtMachInst _machInst,
- uint64_t _iss, MiscRegIndex _miscReg);
-
- Fault execute(ExecContext *xc,
- Trace::InstRecord *traceData) const override;
-
- std::string generateDisassembly(
- Addr pc, const SymbolTable *symtab) const override;
-
-};
-
/**
* This class is modelling instructions which are not going to be
* executed since they are flagged as Illegal Execution Instructions