diff mbox

[RFC,v1,26/29] target-arc: RTIE

Message ID 1473373930-31547-27-git-send-email-mrolnik@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michael Rolnik Sept. 8, 2016, 10:32 p.m. UTC
Signed-off-by: Michael Rolnik <mrolnik@gmail.com>
---
 target-arc/helper.h         |  1 +
 target-arc/op_helper.c      | 21 +++++++++++++++++++++
 target-arc/translate-inst.c | 10 ++++++++++
 target-arc/translate-inst.h |  2 ++
 4 files changed, 34 insertions(+)
diff mbox

Patch

diff --git a/target-arc/helper.h b/target-arc/helper.h
index 14769b1..abfd0d2 100644
--- a/target-arc/helper.h
+++ b/target-arc/helper.h
@@ -24,4 +24,5 @@  DEF_HELPER_2(normw, i32, env, i32)
 DEF_HELPER_2(lr, tl, env, i32)
 DEF_HELPER_2(sr, void, i32, i32)
 DEF_HELPER_1(halt, void, env)
+DEF_HELPER_1(rtie, void, env)
 
diff --git a/target-arc/op_helper.c b/target-arc/op_helper.c
index b07939c..a3f6a46 100644
--- a/target-arc/op_helper.c
+++ b/target-arc/op_helper.c
@@ -416,4 +416,25 @@  void helper_halt(CPUARCState *env)
     /* TODO: implement */
 }
 
+void helper_rtie(CPUARCState *env)
+{
+    if (env->stat.AEf) {
+        CPU_PCL(env) = env->eret;
+        env->stat = env->stat_er;
+        env->bta = env->erbta;
+    } else if (env->stat.A2f) {
+        CPU_PCL(env) = CPU_ILINK2(env);
+        env->stat = env->stat_l2;
+        env->bta = env->bta_l2;
+    } else if (env->stat.A1f) {
+        CPU_PCL(env) = CPU_ILINK1(env);
+        env->stat = env->stat_l1;
+        env->bta = env->bta_l1;
+    } else {
+        CPU_PCL(env) = env->eret;
+        env->stat = env->stat_er;
+        env->bta = env->stat.AEf;
+    }
+}
+
 
diff --git a/target-arc/translate-inst.c b/target-arc/translate-inst.c
index 87a00ca..743f2be 100644
--- a/target-arc/translate-inst.c
+++ b/target-arc/translate-inst.c
@@ -2803,3 +2803,13 @@  int arc_gen_SWI(DisasCtxt *ctx)
     return  BS_EXCP;
 }
 
+/*
+    RTIE
+*/
+int arc_gen_RTIE(DisasCtxt *ctx)
+{
+    gen_helper_rtie(cpu_env);
+
+    return  BS_BRANCH;
+}
+
diff --git a/target-arc/translate-inst.h b/target-arc/translate-inst.h
index f7f988b..8bbac4f 100644
--- a/target-arc/translate-inst.h
+++ b/target-arc/translate-inst.h
@@ -169,3 +169,5 @@  int arc_gen_UNIMP(DisasCtxt *c);
 int arc_gen_SWI(DisasCtxt *c);
 int arc_gen_TRAP(DisasCtxt *c, TCGv src1);
 
+int arc_gen_RTIE(DisasCtxt *c);
+