arch-power: Added Illegal type Program interrupt support
authorKajol Jain <kajoljain797@gmail.com>
Tue, 11 Jun 2019 08:59:35 +0000 (14:29 +0530)
committerKajol Jain <kajoljain797@gmail.com>
Wed, 12 Jun 2019 07:08:35 +0000 (12:38 +0530)
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>
src/arch/power/faults.hh
src/arch/power/isa/formats/unknown.isa

index 8139e203e6ad78052d243d71c2534b9133d18a63..29a057154ab55415b88ecec768466358338dfb87 100644 (file)
@@ -37,6 +37,7 @@
 #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)
@@ -157,6 +158,19 @@ class ProgramInterrupt : public PowerInterrupt
     }
 };
 
+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:
index 1d420f3a071c2fb0e976cac138d09c0abd6d511c..49976d9fc059956c151d9185f0744717f59ad2aa 100644 (file)
@@ -73,10 +73,14 @@ output exec {{
     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>();
+        }
     }
 }};