qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: Richard Henderson <richard.henderson@linaro.org>,
	Thomas Huth <huth@tuxfamily.org>,
	Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [PATCH v6 09/17] target/m68k: softmmu cleanup
Date: Wed,  3 Jan 2018 00:41:00 +0100	[thread overview]
Message-ID: <20180102234108.32713-10-laurent@vivier.eu> (raw)
In-Reply-To: <20180102234108.32713-1-laurent@vivier.eu>

don't compile supervisor only instructions in linux-user mode

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/m68k/translate.c | 39 +++++++++++++++++++++++++++++++++------
 1 file changed, 33 insertions(+), 6 deletions(-)

diff --git a/target/m68k/translate.c b/target/m68k/translate.c
index 662a518f16..ae3fd3db26 100644
--- a/target/m68k/translate.c
+++ b/target/m68k/translate.c
@@ -4392,6 +4392,7 @@ DISAS_INSN(move_from_sr)
     DEST_EA(env, insn, OS_WORD, sr, NULL);
 }
 
+#if defined(CONFIG_SOFTMMU)
 DISAS_INSN(move_to_sr)
 {
     if (IS_USER(s)) {
@@ -4424,6 +4425,11 @@ DISAS_INSN(move_to_usp)
 
 DISAS_INSN(halt)
 {
+    if (IS_USER(s)) {
+        gen_exception(s, s->insn_pc, EXCP_PRIVILEGE);
+        return;
+    }
+
     gen_exception(s, s->pc, EXCP_HALT_INSN);
 }
 
@@ -4507,6 +4513,7 @@ DISAS_INSN(wdebug)
     /* TODO: Implement wdebug.  */
     cpu_abort(CPU(cpu), "WDEBUG not implemented");
 }
+#endif
 
 DISAS_INSN(trap)
 {
@@ -5064,10 +5071,16 @@ DISAS_INSN(fscc)
     tcg_temp_free(tmp);
 }
 
+#if defined(CONFIG_SOFTMMU)
 DISAS_INSN(frestore)
 {
     M68kCPU *cpu = m68k_env_get_cpu(env);
 
+    if (IS_USER(s)) {
+        gen_exception(s, s->insn_pc, EXCP_PRIVILEGE);
+        return;
+    }
+
     /* TODO: Implement frestore.  */
     cpu_abort(CPU(cpu), "FRESTORE not implemented");
 }
@@ -5076,9 +5089,15 @@ DISAS_INSN(fsave)
 {
     M68kCPU *cpu = m68k_env_get_cpu(env);
 
+    if (IS_USER(s)) {
+        gen_exception(s, s->insn_pc, EXCP_PRIVILEGE);
+        return;
+    }
+
     /* TODO: Implement fsave.  */
     cpu_abort(CPU(cpu), "FSAVE not implemented");
 }
+#endif
 
 static inline TCGv gen_mac_extract_word(DisasContext *s, TCGv val, int upper)
 {
@@ -5503,7 +5522,9 @@ void register_m68k_insns (CPUM68KState *env)
     INSN(not,       4680, fff8, CF_ISA_A);
     INSN(not,       4600, ff00, M68000);
     INSN(undef,     46c0, ffc0, M68000);
+#if defined(CONFIG_SOFTMMU)
     INSN(move_to_sr, 46c0, ffc0, CF_ISA_A);
+#endif
     INSN(nbcd,      4800, ffc0, M68000);
     INSN(linkl,     4808, fff8, M68000);
     BASE(pea,       4840, ffc0);
@@ -5518,7 +5539,9 @@ void register_m68k_insns (CPUM68KState *env)
     BASE(tst,       4a00, ff00);
     INSN(tas,       4ac0, ffc0, CF_ISA_B);
     INSN(tas,       4ac0, ffc0, M68000);
+#if defined(CONFIG_SOFTMMU)
     INSN(halt,      4ac8, ffff, CF_ISA_A);
+#endif
     INSN(pulse,     4acc, ffff, CF_ISA_A);
     BASE(illegal,   4afc, ffff);
     INSN(mull,      4c00, ffc0, CF_ISA_A);
@@ -5529,14 +5552,16 @@ void register_m68k_insns (CPUM68KState *env)
     BASE(trap,      4e40, fff0);
     BASE(link,      4e50, fff8);
     BASE(unlk,      4e58, fff8);
+#if defined(CONFIG_SOFTMMU)
     INSN(move_to_usp, 4e60, fff8, USP);
     INSN(move_from_usp, 4e68, fff8, USP);
-    BASE(nop,       4e71, ffff);
     BASE(stop,      4e72, ffff);
     BASE(rte,       4e73, ffff);
+    INSN(movec,     4e7b, ffff, CF_ISA_A);
+#endif
+    BASE(nop,       4e71, ffff);
     INSN(rtd,       4e74, ffff, RTD);
     BASE(rts,       4e75, ffff);
-    INSN(movec,     4e7b, ffff, CF_ISA_A);
     BASE(jump,      4e80, ffc0);
     BASE(jump,      4ec0, ffc0);
     INSN(addsubq,   5000, f080, M68000);
@@ -5640,19 +5665,21 @@ void register_m68k_insns (CPUM68KState *env)
     BASE(undef_fpu, f000, f000);
     INSN(fpu,       f200, ffc0, CF_FPU);
     INSN(fbcc,      f280, ffc0, CF_FPU);
-    INSN(frestore,  f340, ffc0, CF_FPU);
-    INSN(fsave,     f300, ffc0, CF_FPU);
     INSN(fpu,       f200, ffc0, FPU);
     INSN(fscc,      f240, ffc0, FPU);
     INSN(fbcc,      f280, ff80, FPU);
+#if defined(CONFIG_SOFTMMU)
+    INSN(frestore,  f340, ffc0, CF_FPU);
+    INSN(fsave,     f300, ffc0, CF_FPU);
     INSN(frestore,  f340, ffc0, FPU);
     INSN(fsave,     f300, ffc0, FPU);
     INSN(intouch,   f340, ffc0, CF_ISA_A);
     INSN(cpushl,    f428, ff38, CF_ISA_A);
-    INSN(move16_mem, f600, ffe0, M68040);
-    INSN(move16_reg, f620, fff8, M68040);
     INSN(wddata,    fb00, ff00, CF_ISA_A);
     INSN(wdebug,    fbc0, ffc0, CF_ISA_A);
+#endif
+    INSN(move16_mem, f600, ffe0, M68040);
+    INSN(move16_reg, f620, fff8, M68040);
 #undef INSN
 }
 
-- 
2.14.3

  parent reply	other threads:[~2018-01-02 23:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-02 23:40 [Qemu-devel] [PATCH v6 00/17] target/m68k: supervisor mode (part 1) Laurent Vivier
2018-01-02 23:40 ` [Qemu-devel] [PATCH v6 01/17] target-m68k: sync CC_OP before gen_jmp_tb() Laurent Vivier
2018-01-02 23:40 ` [Qemu-devel] [PATCH v6 02/17] target/m68k: fix gen_get_ccr() Laurent Vivier
2018-01-02 23:40 ` [Qemu-devel] [PATCH v6 03/17] linux-user, m68k: correctly manage SR in context Laurent Vivier
2018-01-02 23:40 ` [Qemu-devel] [PATCH v6 04/17] target/m68k: use insn_pc to generate instruction fault address Laurent Vivier
2018-01-02 23:40 ` [Qemu-devel] [PATCH v6 05/17] target/m68k: add CPU_LOG_INT trace Laurent Vivier
2018-01-03  9:53   ` Philippe Mathieu-Daudé
2018-01-03 21:44   ` Richard Henderson
2018-01-02 23:40 ` [Qemu-devel] [PATCH v6 06/17] target/m68k: manage 680x0 stack frames Laurent Vivier
2018-01-02 23:40 ` [Qemu-devel] [PATCH v6 07/17] target/m68k: add chk and chk2 Laurent Vivier
2018-01-03 21:52   ` Richard Henderson
2018-01-03 23:40     ` Laurent Vivier
2018-01-04  0:32       ` Richard Henderson
2018-01-02 23:40 ` [Qemu-devel] [PATCH v6 08/17] target/m68k: add move16 Laurent Vivier
2018-01-03 21:54   ` Richard Henderson
2018-01-02 23:41 ` Laurent Vivier [this message]
2018-01-02 23:41 ` [Qemu-devel] [PATCH v6 10/17] target/m68k: add cpush/cinv Laurent Vivier
2018-01-02 23:41 ` [Qemu-devel] [PATCH v6 11/17] target/m68k: add reset Laurent Vivier
2018-01-02 23:41 ` [Qemu-devel] [PATCH v6 12/17] target/m68k: implement fsave/frestore Laurent Vivier
2018-01-02 23:41 ` [Qemu-devel] [PATCH v6 13/17] target/m68k: move CCR/SR functions Laurent Vivier
2018-01-02 23:41 ` [Qemu-devel] [PATCH v6 14/17] target/m68k: add 680x0 "move to SR" instruction Laurent Vivier
2018-01-02 23:41 ` [Qemu-devel] [PATCH v6 15/17] target/m68k: add andi/ori/eori to SR/CCR Laurent Vivier
2018-01-02 23:41 ` [Qemu-devel] [PATCH v6 16/17] target/m68k: add the Interrupt Stack Pointer Laurent Vivier
2018-01-03 21:58   ` Richard Henderson
2018-01-02 23:41 ` [Qemu-devel] [PATCH v6 17/17] target/m68k: fix m68k_cpu_dump_state() Laurent Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180102234108.32713-10-laurent@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=huth@tuxfamily.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).