qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 02/10] target/ppc: Convert to disas_set_info hook
Date: Mon, 18 Sep 2017 12:58:59 +0100	[thread overview]
Message-ID: <874ls0jjzw.fsf@linaro.org> (raw)
In-Reply-To: <20170914183516.19537-3-richard.henderson@linaro.org>


Richard Henderson <richard.henderson@linaro.org> writes:

> Cc: qemu-ppc@nongnu.org
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  disas.c                     | 33 ---------------------------------
>  monitor.c                   |  5 -----
>  target/ppc/translate.c      |  5 +----
>  target/ppc/translate_init.c | 21 +++++++++++++++++++++
>  4 files changed, 22 insertions(+), 42 deletions(-)
>
> diff --git a/disas.c b/disas.c
> index 2be716fdb2..3a375a3b6c 100644
> --- a/disas.c
> +++ b/disas.c
> @@ -205,23 +205,6 @@ void target_disas(FILE *out, CPUState *cpu, target_ulong code,
>          cc->disas_set_info(cpu, &s.info);
>      }
>
> -#if defined(TARGET_PPC)
> -    if ((flags >> 16) & 1) {
> -        s.info.endian = BFD_ENDIAN_LITTLE;
> -    }
> -    if (flags & 0xFFFF) {
> -        /* If we have a precise definition of the instruction set, use it. */
> -        s.info.mach = flags & 0xFFFF;
> -    } else {
> -#ifdef TARGET_PPC64
> -        s.info.mach = bfd_mach_ppc64;
> -#else
> -        s.info.mach = bfd_mach_ppc;
> -#endif
> -    }
> -    s.info.disassembler_options = (char *)"any";
> -    s.info.print_insn = print_insn_ppc;
> -#endif
>      if (s.info.print_insn == NULL) {
>          s.info.print_insn = print_insn_od_target;
>      }
> @@ -381,22 +364,6 @@ void monitor_disas(Monitor *mon, CPUState *cpu,
>          cc->disas_set_info(cpu, &s.info);
>      }
>
> -#if defined(TARGET_PPC)
> -    if (flags & 0xFFFF) {
> -        /* If we have a precise definition of the instruction set, use it. */
> -        s.info.mach = flags & 0xFFFF;
> -    } else {
> -#ifdef TARGET_PPC64
> -        s.info.mach = bfd_mach_ppc64;
> -#else
> -        s.info.mach = bfd_mach_ppc;
> -#endif
> -    }
> -    if ((flags >> 16) & 1) {
> -        s.info.endian = BFD_ENDIAN_LITTLE;
> -    }
> -    s.info.print_insn = print_insn_ppc;
> -#endif
>      if (!s.info.print_insn) {
>          monitor_printf(mon, "0x" TARGET_FMT_lx
>                         ": Asm output not supported on this arch\n", pc);
> diff --git a/monitor.c b/monitor.c
> index 3f3ebc31ef..a0f43f27e7 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -1310,11 +1310,6 @@ static void memory_dump(Monitor *mon, int count, int format, int wsize,
>
>      if (format == 'i') {
>          int flags = 0;
> -#ifdef TARGET_PPC
> -        CPUArchState *env = mon_get_cpu_env();
> -        flags = msr_le << 16;
> -        flags |= env->bfd_mach;
> -#endif
>          monitor_disas(mon, cs, addr, count, is_physical, flags);
>          return;
>      }
> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> index 606b605ba0..bc155f1036 100644
> --- a/target/ppc/translate.c
> +++ b/target/ppc/translate.c
> @@ -7395,12 +7395,9 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)
>  #if defined(DEBUG_DISAS)
>      if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)
>          && qemu_log_in_addr_range(pc_start)) {
> -        int flags;
> -        flags = env->bfd_mach;
> -        flags |= ctx.le_mode << 16;
>          qemu_log_lock();
>          qemu_log("IN: %s\n", lookup_symbol(pc_start));
> -        log_target_disas(cs, pc_start, ctx.nip - pc_start, flags);
> +        log_target_disas(cs, pc_start, ctx.nip - pc_start, 0);
>          qemu_log("\n");
>          qemu_log_unlock();
>      }
> diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c
> index c827d1e388..c7b4a7c02a 100644
> --- a/target/ppc/translate_init.c
> +++ b/target/ppc/translate_init.c
> @@ -10644,6 +10644,26 @@ static gchar *ppc_gdb_arch_name(CPUState *cs)
>  #endif
>  }
>
> +static void ppc_disas_set_info(CPUState *cs, disassemble_info *info)
> +{
> +    PowerPCCPU *cpu = POWERPC_CPU(cs);
> +    CPUPPCState *env = &cpu->env;
> +
> +    if ((env->hflags >> MSR_LE) & 1) {
> +        info->endian = BFD_ENDIAN_LITTLE;
> +    }
> +    info->mach = env->bfd_mach;
> +    if (!env->bfd_mach) {
> +#ifdef TARGET_PPC64
> +        info->mach = bfd_mach_ppc64;
> +#else
> +        info->mach = bfd_mach_ppc;
> +#endif
> +    }
> +    info->disassembler_options = (char *)"any";
> +    info->print_insn = print_insn_ppc;
> +}
> +
>  static Property ppc_cpu_properties[] = {
>      DEFINE_PROP_BOOL("pre-2.8-migration", PowerPCCPU, pre_2_8_migration, false),
>      DEFINE_PROP_BOOL("pre-2.10-migration", PowerPCCPU, pre_2_10_migration,
> @@ -10705,6 +10725,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
>  #ifndef CONFIG_USER_ONLY
>      cc->virtio_is_big_endian = ppc_cpu_is_big_endian;
>  #endif
> +    cc->disas_set_info = ppc_disas_set_info;
>
>      dc->fw_name = "PowerPC,UNKNOWN";
>  }


--
Alex Bennée

  reply	other threads:[~2017-09-18 11:59 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 [this message]
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 ` [Qemu-devel] [PATCH 10/10] target/mips: " Richard Henderson
2017-09-15  2:47   ` 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=874ls0jjzw.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).