qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v7 07/11] i386: Support Capstone in disas_set_info
Date: Sat, 21 Oct 2017 17:46:17 -0700	[thread overview]
Message-ID: <20171022004621.28372-8-richard.henderson@linaro.org> (raw)
In-Reply-To: <20171022004621.28372-1-richard.henderson@linaro.org>

Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 disas.c           | 4 ++++
 target/i386/cpu.c | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/disas.c b/disas.c
index e392a2926e..63dc573e9f 100644
--- a/disas.c
+++ b/disas.c
@@ -438,9 +438,13 @@ void disas(FILE *out, void *code, unsigned long size)
 #elif defined(__i386__)
     s.info.mach = bfd_mach_i386_i386;
     print_insn = print_insn_i386;
+    s.info.cap_arch = CS_ARCH_X86;
+    s.info.cap_mode = CS_MODE_32;
 #elif defined(__x86_64__)
     s.info.mach = bfd_mach_x86_64;
     print_insn = print_insn_i386;
+    s.info.cap_arch = CS_ARCH_X86;
+    s.info.cap_mode = CS_MODE_64;
 #elif defined(_ARCH_PPC)
     s.info.disassembler_options = (char *)"any";
     print_insn = print_insn_ppc;
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 13b2f8fbc5..cf890b763b 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -51,6 +51,8 @@
 #include "hw/i386/apic_internal.h"
 #endif
 
+#include "disas/capstone.h"
+
 
 /* Cache topology CPUID constants: */
 
@@ -4106,6 +4108,11 @@ static void x86_disas_set_info(CPUState *cs, disassemble_info *info)
                   : env->hflags & HF_CS32_MASK ? bfd_mach_i386_i386
                   : bfd_mach_i386_i8086);
     info->print_insn = print_insn_i386;
+
+    info->cap_arch = CS_ARCH_X86;
+    info->cap_mode = (env->hflags & HF_CS64_MASK ? CS_MODE_64
+                      : env->hflags & HF_CS32_MASK ? CS_MODE_32
+                      : CS_MODE_16);
 }
 
 static Property x86_cpu_properties[] = {
-- 
2.13.6

  parent reply	other threads:[~2017-10-22  0:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-22  0:46 [Qemu-devel] [PATCH v7 00/11] Support the Capstone disassembler Richard Henderson
2017-10-22  0:46 ` [Qemu-devel] [PATCH v7 01/11] target/i386: Convert to disas_set_info hook Richard Henderson
2017-10-22  0:46 ` [Qemu-devel] [PATCH v7 02/11] target/ppc: " Richard Henderson
2017-10-22  0:46 ` [Qemu-devel] [PATCH v7 03/11] target/arm: Move BE32 disassembler fixup Richard Henderson
2017-10-24 21:35   ` Philippe Mathieu-Daudé
2017-10-22  0:46 ` [Qemu-devel] [PATCH v7 04/11] target/arm: Don't set INSN_ARM_BE32 for CONFIG_USER_ONLY Richard Henderson
2017-10-25 13:27   ` Philippe Mathieu-Daudé
2017-10-22  0:46 ` [Qemu-devel] [PATCH v7 05/11] disas: Remove unused flags arguments Richard Henderson
2017-10-22  0:46 ` [Qemu-devel] [PATCH v7 06/11] disas: Support the Capstone disassembler library Richard Henderson
2017-10-24 16:59   ` Philippe Mathieu-Daudé
2017-10-22  0:46 ` Richard Henderson [this message]
2017-10-22  0:46 ` [Qemu-devel] [PATCH v7 08/11] arm: Support Capstone in disas_set_info Richard Henderson
2017-10-22  0:46 ` [Qemu-devel] [PATCH v7 09/11] ppc: " Richard Henderson
2017-10-22  0:46 ` [Qemu-devel] [PATCH v7 10/11] disas: Remove monitor_disas_is_physical Richard Henderson
2017-10-22  0:46 ` [Qemu-devel] [PATCH v7 11/11] disas: Add capstone as submodule Richard Henderson
2017-10-24 16:45   ` Philippe Mathieu-Daudé
2017-10-24 19:40     ` Richard Henderson
2017-10-25 13:23       ` Philippe Mathieu-Daudé
2017-10-22  0:59 ` [Qemu-devel] [PATCH v7 00/11] Support the Capstone disassembler no-reply
2017-10-22  0:59 ` no-reply
2017-10-22  0:59 ` no-reply

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=20171022004621.28372-8-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=qemu-devel@nongnu.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).