arch-power: Added SystemCall Interrupt handler
authorkajoljain379 <kajoljain797@gmail.com>
Sat, 12 Jan 2019 08:43:02 +0000 (14:13 +0530)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 24 Jan 2021 03:59:05 +0000 (03:59 +0000)
Added system call interrupt handler.
Added handler calling in decoder file.

Change-Id: I80b99257fe4b96a1a286f17afcec28bb8a849b83
Signed-off-by: kajoljain379 <kajoljain797@gmail.com>
src/arch/power/faults.hh
src/arch/power/isa/decoder.isa

index 1e7fc9f4a3b623511a4ff31f9ee947f30a197345..5e57d1ec31e4f97c74c8ee006049bad7d0e6f5e1 100644 (file)
@@ -136,6 +136,23 @@ class PowerInterrupt : public PowerFaultBase
 };
 
 
+class SystemCallInterrupt : public PowerInterrupt
+{
+  public:
+    SystemCallInterrupt()
+    {
+    }
+    virtual void invoke(ThreadContext * tc, const StaticInstPtr &inst =
+                       StaticInst::nullStaticInstPtr)
+    {
+      //TODO: Right now it not handle case when LEV=0.
+      tc->setIntReg(INTREG_SRR0 , tc->instAddr() + 4);
+      PowerInterrupt::updateSRR1(tc);
+      PowerInterrupt::updateMsr(tc);
+      tc->pcState(SystemCallPCSet);
+    }
+};
+
 class DecrementerInterrupt : public PowerInterrupt
 {
   public:
index 83fc11edd92f6095b8b4f9146f0ff18f889a5c84..a08e10d5e65e37b0cdefb38cf183909b403e1cb3 100644 (file)
@@ -162,9 +162,17 @@ decode PO default Unknown::unknown() {
         }
     }
 
+//TODO:Right now sc instruction not handles LEV=1 case
+
     format IntOp {
-        17: sc({{ xc->syscall(R0, &fault); }},
-               [ IsSyscall, IsNonSpeculative, IsSerializeAfter ]);
+        17: sc({{
+            if (FullSystem) {
+                fault= std::make_shared<SystemCallInterrupt>();
+            } else {
+                xc->syscall(R0, &fault);
+            }
+            }},
+              [ IsSyscall, IsNonSpeculative, IsSerializeAfter ]);
         2: tdi({{ }});
     }