Patchwork [v2] m68k: implement move to/from usp register instruction

login
register
mail settings
Submitter Greg Ungerer
Date Sept. 13, 2012, 11:37 p.m.
Message ID <1347579475-9293-1-git-send-email-gerg@snapgear.com>
Download mbox | patch
Permalink /patch/183767/
State New
Headers show

Comments

Greg Ungerer - Sept. 13, 2012, 11:37 p.m.
From: Greg Ungerer <gerg@uclinux.org>

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

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

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
---
 target-m68k/translate.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
Richard Henderson - Sept. 14, 2012, 7:38 p.m.
On 09/13/2012 04:37 PM, gerg@snapgear.com wrote:
> From: Greg Ungerer <gerg@uclinux.org>
> 
> Fill out the code support for the move to/from usp instructions. They are
> being decoded, but there is no code to support their actions. So add it.
> 
> Current versions of Linux running on the ColdFire 5208 use these instructions.
> 
> Signed-off-by: Greg Ungerer <gerg@uclinux.org>

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

Patch

diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 9fc1e31..7b55747 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -1980,8 +1980,8 @@  DISAS_INSN(move_from_usp)
         gen_exception(s, s->pc - 2, EXCP_PRIVILEGE);
         return;
     }
-    /* TODO: Implement USP.  */
-    gen_exception(s, s->pc - 2, EXCP_ILLEGAL);
+    tcg_gen_ld_i32(AREG(insn, 0), cpu_env,
+                   offsetof(CPUM68KState, sp[M68K_USP]));
 }
 
 DISAS_INSN(move_to_usp)
@@ -1990,8 +1990,8 @@  DISAS_INSN(move_to_usp)
         gen_exception(s, s->pc - 2, EXCP_PRIVILEGE);
         return;
     }
-    /* TODO: Implement USP.  */
-    gen_exception(s, s->pc - 2, EXCP_ILLEGAL);
+    tcg_gen_st_i32(AREG(insn, 0), cpu_env,
+                   offsetof(CPUM68KState, sp[M68K_USP]));
 }
 
 DISAS_INSN(halt)