diff mbox series

[v4,7/9] ppc: Support Capstone in disas_set_info

Message ID 20170928165414.7339-8-richard.henderson@linaro.org
State Superseded
Headers show
Series Support the Capstone disassembler | expand

Commit Message

Richard Henderson Sept. 28, 2017, 4:54 p.m. UTC
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 disas.c                     | 4 ++++
 target/ppc/translate_init.c | 6 ++++++
 2 files changed, 10 insertions(+)

-- 
2.13.5

Comments

Philippe Mathieu-Daudé Oct. 2, 2017, 1:56 p.m. UTC | #1
On 09/28/2017 01:54 PM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


> ---

>   disas.c                     | 4 ++++

>   target/ppc/translate_init.c | 6 ++++++

>   2 files changed, 10 insertions(+)

> 

> diff --git a/disas.c b/disas.c

> index 23c4742f8d..0d212f2ac5 100644

> --- a/disas.c

> +++ b/disas.c

> @@ -449,6 +449,10 @@ void disas(FILE *out, void *code, unsigned long size)

>   #elif defined(_ARCH_PPC)

>       s.info.disassembler_options = (char *)"any";

>       print_insn = print_insn_ppc;

> +    s.info.cap_arch = CS_ARCH_PPC;

> +# ifdef _ARCH_PPC64

> +    s.info.cap_mode = CS_MODE_64;

> +# endif

>   #elif defined(__aarch64__) && defined(CONFIG_ARM_A64_DIS)

>       print_insn = print_insn_arm_a64;

>       s.info.cap_arch = CS_ARCH_ARM64;

> diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c

> index 2863e2c0b0..69a9485f66 100644

> --- a/target/ppc/translate_init.c

> +++ b/target/ppc/translate_init.c

> @@ -35,6 +35,7 @@

>   #include "mmu-book3s-v3.h"

>   #include "sysemu/qtest.h"

>   #include "qemu/cutils.h"

> +#include "disas/capstone.h"

>   

>   //#define PPC_DUMP_CPU

>   //#define PPC_DEBUG_SPR

> @@ -10699,6 +10700,11 @@ static void ppc_disas_set_info(CPUState *cs, disassemble_info *info)

>       }

>       info->disassembler_options = (char *)"any";

>       info->print_insn = print_insn_ppc;

> +

> +    info->cap_arch = CS_ARCH_PPC;

> +#ifdef TARGET_PPC64

> +    info->cap_mode = CS_MODE_64;

> +#endif

>   }

>   

>   static Property ppc_cpu_properties[] = {

>
diff mbox series

Patch

diff --git a/disas.c b/disas.c
index 23c4742f8d..0d212f2ac5 100644
--- a/disas.c
+++ b/disas.c
@@ -449,6 +449,10 @@  void disas(FILE *out, void *code, unsigned long size)
 #elif defined(_ARCH_PPC)
     s.info.disassembler_options = (char *)"any";
     print_insn = print_insn_ppc;
+    s.info.cap_arch = CS_ARCH_PPC;
+# ifdef _ARCH_PPC64
+    s.info.cap_mode = CS_MODE_64;
+# endif
 #elif defined(__aarch64__) && defined(CONFIG_ARM_A64_DIS)
     print_insn = print_insn_arm_a64;
     s.info.cap_arch = CS_ARCH_ARM64;
diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c
index 2863e2c0b0..69a9485f66 100644
--- a/target/ppc/translate_init.c
+++ b/target/ppc/translate_init.c
@@ -35,6 +35,7 @@ 
 #include "mmu-book3s-v3.h"
 #include "sysemu/qtest.h"
 #include "qemu/cutils.h"
+#include "disas/capstone.h"
 
 //#define PPC_DUMP_CPU
 //#define PPC_DEBUG_SPR
@@ -10699,6 +10700,11 @@  static void ppc_disas_set_info(CPUState *cs, disassemble_info *info)
     }
     info->disassembler_options = (char *)"any";
     info->print_insn = print_insn_ppc;
+
+    info->cap_arch = CS_ARCH_PPC;
+#ifdef TARGET_PPC64
+    info->cap_mode = CS_MODE_64;
+#endif
 }
 
 static Property ppc_cpu_properties[] = {