arch-power: Added SystemCall Interrupt handler
authorkajoljain379 <kajoljain797@gmail.com>
Sat, 12 Jan 2019 08:43:02 +0000 (14:13 +0530)
committerKajol Jain <kajoljain797@gmail.com>
Wed, 12 Jun 2019 07:06:03 +0000 (12:36 +0530)
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 a6c7f44351ab9357f0e5362b31f1c174ccfce949..47b46cb8bd4cfd6212e117ef5a27fd052ccc59d8 100644 (file)
@@ -139,6 +139,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 799aeb8c66a71e1a7250238a65e63a018784cd7e..97ade360ba25c957ca675d1c5835963224d7269e 100644 (file)
@@ -164,9 +164,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({{ }});
     }