arch-power: Added Illegal type Program interrupt support
authorKajol Jain <kajoljain797@gmail.com>
Tue, 11 Jun 2019 08:59:35 +0000 (14:29 +0530)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 24 Jan 2021 03:59:12 +0000 (03:59 +0000)
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 863b3f7b9b37086f8a4a8b8442a9120749bb3bce..6bcd87923bfbf3dd9fa909ba971e8e38f54d100a 100644 (file)
@@ -34,6 +34,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)
@@ -154,6 +155,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 d83f79cf2274f377e55919e8fe2a925cdd734555..38b923bca22ae7e8fa291791e5441337b8fc0b04 100644 (file)
@@ -71,10 +71,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>();
+        }
     }
 }};