qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: Aurelien Jarno <aurelien@aurel32.net>,
	Yongbok Kim <yongbok.kim@imgtec.com>
Subject: [Qemu-devel] [PATCH 10/10] target/mips: Support Capstone in disas_set_info
Date: Thu, 14 Sep 2017 11:35:16 -0700	[thread overview]
Message-ID: <20170914183516.19537-11-richard.henderson@linaro.org> (raw)
In-Reply-To: <20170914183516.19537-1-richard.henderson@linaro.org>

Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Yongbok Kim <yongbok.kim@imgtec.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/mips/cpu.h            |  2 ++
 target/mips/cpu.c            |  8 --------
 target/mips/translate_init.c | 36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/target/mips/cpu.h b/target/mips/cpu.h
index 74f6a5b098..dca713825d 100644
--- a/target/mips/cpu.h
+++ b/target/mips/cpu.h
@@ -1118,4 +1118,6 @@ static inline void QEMU_NORETURN do_raise_exception(CPUMIPSState *env,
     do_raise_exception_err(env, exception, 0, pc);
 }
 
+void mips_cpu_disas_set_info(CPUState *s, disassemble_info *info);
+
 #endif /* MIPS_CPU_H */
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index 1bb66b7a5a..898f1b3759 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -111,14 +111,6 @@ static void mips_cpu_reset(CPUState *s)
 #endif
 }
 
-static void mips_cpu_disas_set_info(CPUState *s, disassemble_info *info) {
-#ifdef TARGET_WORDS_BIGENDIAN
-    info->print_insn = print_insn_big_mips;
-#else
-    info->print_insn = print_insn_little_mips;
-#endif
-}
-
 static void mips_cpu_realizefn(DeviceState *dev, Error **errp)
 {
     CPUState *cs = CPU(dev);
diff --git a/target/mips/translate_init.c b/target/mips/translate_init.c
index 255d25bacd..1d43b3c36d 100644
--- a/target/mips/translate_init.c
+++ b/target/mips/translate_init.c
@@ -947,3 +947,39 @@ static void msa_reset(CPUMIPSState *env)
     /* set proper signanling bit meaning ("1" means "quiet") */
     set_snan_bit_is_one(0, &env->active_tc.msa_fp_status);
 }
+
+#include "disas/capstone.h"
+
+void mips_cpu_disas_set_info(CPUState *s, disassemble_info *info)
+{
+    MIPSCPU *cpu = MIPS_CPU(s);
+    CPUMIPSState *env = &cpu->env;
+    int insn_flags = env->cpu_model->insn_flags;
+    int cap_mode;
+
+#ifdef TARGET_WORDS_BIGENDIAN
+    info->print_insn = print_insn_big_mips;
+#else
+    info->print_insn = print_insn_little_mips;
+#endif
+
+    cap_mode = 0;
+    if (insn_flags & ISA_MIPS3) {
+        cap_mode |= CS_MODE_MIPS3;
+    }
+    if (insn_flags & ISA_MIPS32) {
+        cap_mode |= CS_MODE_MIPS32;
+    }
+    if (insn_flags & ISA_MIPS64) {
+        cap_mode |= CS_MODE_MIPS64;
+    }
+    if (insn_flags & ISA_MIPS32R6) {
+        cap_mode |= CS_MODE_MIPS32R6;
+    }
+#ifdef TARGET_MIPS64
+    cap_mode |= CS_MODE_MIPSGP64;
+#endif
+
+    info->cap_arch = CS_ARCH_MIPS;
+    info->cap_mode = cap_mode;
+}
-- 
2.13.5

  parent reply	other threads:[~2017-09-14 18:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14 18:35 [Qemu-devel] [PATCH 00/10] Support the Capstone disassembler Richard Henderson
2017-09-14 18:35 ` [Qemu-devel] [PATCH 01/10] target/i386: Convert to disas_set_info hook Richard Henderson
2017-09-18 11:47   ` Alex Bennée
2017-09-14 18:35 ` [Qemu-devel] [PATCH 02/10] target/ppc: " Richard Henderson
2017-09-18 11:58   ` Alex Bennée
2017-09-14 18:35 ` [Qemu-devel] [PATCH 03/10] disas: Remove unused flags arguments Richard Henderson
2017-09-18 11:59   ` Alex Bennée
2017-09-14 18:35 ` [Qemu-devel] [PATCH 04/10] disas: Support the Capstone disassembler library Richard Henderson
2017-09-15  4:46   ` Philippe Mathieu-Daudé
2017-09-15 16:58     ` Richard Henderson
2017-09-16 18:32   ` Peter Maydell
2017-09-16 18:52   ` Peter Maydell
2017-09-14 18:35 ` [Qemu-devel] [PATCH 05/10] target/i386: Support Capstone in disas_set_info Richard Henderson
2017-09-14 18:35 ` [Qemu-devel] [PATCH 06/10] target/arm: " Richard Henderson
2017-09-14 18:35 ` [Qemu-devel] [PATCH 07/10] target/ppc: " Richard Henderson
2017-09-14 18:35 ` [Qemu-devel] [PATCH 08/10] target/s390x: " Richard Henderson
2017-09-14 18:35 ` [Qemu-devel] [PATCH 09/10] target/sparc: " Richard Henderson
2017-09-14 18:35 ` Richard Henderson [this message]
2017-09-15  2:47   ` [Qemu-devel] [PATCH 10/10] target/mips: " Philippe Mathieu-Daudé
2017-09-15  4:53 ` [Qemu-devel] [PATCH 00/10] Support the Capstone disassembler Philippe Mathieu-Daudé
2017-09-19 16:13   ` Richard Henderson
2017-09-19 17:30     ` Philippe Mathieu-Daudé
2017-09-19 18:36       ` Richard Henderson

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=20170914183516.19537-11-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    --cc=yongbok.kim@imgtec.com \
    /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).