qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] m68k: implement move to/from usp register instructi


From: gerg
Subject: [Qemu-devel] [PATCH] m68k: implement move to/from usp register instruction
Date: Thu, 13 Sep 2012 16:33:00 +1000

From: Greg Ungerer <address@hidden>

Fill out the code support for the move to/from usp instructions. They are
being decoded, but there is no code to support there actions. So add it.

Current versions of Linux running on the ColdFire 5208 use these instructions.

Signed-off-by: Greg Ungerer <address@hidden>
---
 target-m68k/helper.c    |   10 ++++++++++
 target-m68k/helpers.h   |    2 ++
 target-m68k/translate.c |   10 ++++++----
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index eac0053..722dbd9 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -229,6 +229,16 @@ void HELPER(movec)(CPUM68KState *env, uint32_t reg, 
uint32_t val)
     }
 }
 
+uint32_t HELPER(move_from_usp)(CPUM68KState * env)
+{
+    return env->sp[M68K_USP];
+}
+
+void HELPER(move_to_usp)(CPUM68KState * env, uint32_t val)
+{
+    env->sp[M68K_USP] = val;
+}
+
 void HELPER(set_macsr)(CPUM68KState *env, uint32_t val)
 {
     uint32_t acc;
diff --git a/target-m68k/helpers.h b/target-m68k/helpers.h
index cb8a0c7..bca780b 100644
--- a/target-m68k/helpers.h
+++ b/target-m68k/helpers.h
@@ -13,6 +13,8 @@ DEF_HELPER_3(sar_cc, i32, env, i32, i32)
 DEF_HELPER_2(xflag_lt, i32, i32, i32)
 DEF_HELPER_2(set_sr, void, env, i32)
 DEF_HELPER_3(movec, void, env, i32, i32)
+DEF_HELPER_1(move_from_usp, i32, env)
+DEF_HELPER_2(move_to_usp, void, env, i32)
 
 DEF_HELPER_2(f64_to_i32, f32, env, f64)
 DEF_HELPER_2(f64_to_f32, f32, env, f64)
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 9fc1e31..5609240 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -1976,22 +1976,24 @@ DISAS_INSN(move_to_sr)
 
 DISAS_INSN(move_from_usp)
 {
+    TCGv reg;
     if (IS_USER(s)) {
         gen_exception(s, s->pc - 2, EXCP_PRIVILEGE);
         return;
     }
-    /* TODO: Implement USP.  */
-    gen_exception(s, s->pc - 2, EXCP_ILLEGAL);
+    reg = AREG(insn, 0);
+    gen_helper_move_from_usp(reg, cpu_env);
 }
 
 DISAS_INSN(move_to_usp)
 {
+    TCGv reg;
     if (IS_USER(s)) {
         gen_exception(s, s->pc - 2, EXCP_PRIVILEGE);
         return;
     }
-    /* TODO: Implement USP.  */
-    gen_exception(s, s->pc - 2, EXCP_ILLEGAL);
+    reg = AREG(insn, 0);
+    gen_helper_move_to_usp(cpu_env, reg);
 }
 
 DISAS_INSN(halt)
-- 
1.7.0.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]