From 0a0383e2b58be315682bd9149c6818efb52a3506 Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Tue, 13 Feb 2018 17:06:42 -0500 Subject: [PATCH] m68k: implement move to/from usp register instruction 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. Backports commit 2a8327e8a8288e301a2f01bc3ca2d465a3a4ca78 from qemu --- qemu/target-m68k/translate.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/qemu/target-m68k/translate.c b/qemu/target-m68k/translate.c index 1a05fd0e..dc4c407b 100644 --- a/qemu/target-m68k/translate.c +++ b/qemu/target-m68k/translate.c @@ -2046,22 +2046,28 @@ DISAS_INSN(move_to_sr) DISAS_INSN(move_from_usp) { + TCGContext *tcg_ctx = s->uc->tcg_ctx; + if (IS_USER(s)) { gen_exception(s, s->pc - 2, EXCP_PRIVILEGE); return; } - /* TODO: Implement USP. */ - gen_exception(s, s->pc - 2, EXCP_ILLEGAL); + + tcg_gen_ld_i32(tcg_ctx, AREG(insn, 0), tcg_ctx->cpu_env, + offsetof(CPUM68KState, sp[M68K_USP])); } DISAS_INSN(move_to_usp) { + TCGContext *tcg_ctx = s->uc->tcg_ctx; + if (IS_USER(s)) { gen_exception(s, s->pc - 2, EXCP_PRIVILEGE); return; } - /* TODO: Implement USP. */ - gen_exception(s, s->pc - 2, EXCP_ILLEGAL); + + tcg_gen_st_i32(tcg_ctx, AREG(insn, 0), tcg_ctx->cpu_env, + offsetof(CPUM68KState, sp[M68K_USP])); } DISAS_INSN(halt)