Added suppot for illegal or unknown instruction type program
interrupt.
* Check if instruction is unknown or invalid and incase its unknown
raise Illegal type program interrupt.
* Added Illegal instruction interrupt handler.
Change-Id: Ib203cfc3542f47b9e0141a2a3f170dc6becf8a90
Signed-off-by: Kajol Jain <kajoljain797@gmail.com>
#include "sim/faults.hh"
#define SRR1_PRI_BIT 17
+#define SRR1_ILLEGAL_INSTR_BIT 18
#define setbit(shift, mask) ( (uint64_t)1 << shift | mask)
#define unsetbit(shift,mask) ( ~((uint64_t)1 << shift) & mask)
}
};
+class ProgramIllegalInterrupt : public ProgramInterrupt
+{
+ public:
+ ProgramIllegalInterrupt()
+ {
+ }
+ virtual void invoke(ThreadContext * tc, const StaticInstPtr &inst =
+ StaticInst::nullStaticInstPtr)
+ {
+ ProgramInterrupt::invoke(tc, inst ,setBitMask(SRR1_ILLEGAL_INSTR_BIT));
+ }
+};
+
class ProgramPriInterrupt : public ProgramInterrupt
{
public:
Fault
Unknown::execute(ExecContext *xc, Trace::InstRecord *traceData) const
{
- panic("attempt to execute unknown instruction at %#x"
+ if (FullSystem) {
+ return std::make_shared<ProgramIllegalInterrupt>();
+ } else {
+ panic("attempt to execute unknown instruction at %#x"
"(inst 0x%08x, opcode 0x%x, binary: %s)",
xc->pcState().pc(), machInst, PO, inst2string(machInst));
- return std::make_shared<UnimplementedOpcodeFault>();
+ return std::make_shared<UnimplementedOpcodeFault>();
+ }
}
}};