From patchwork Tue Sep 26 20:14:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9972689 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 803A76037E for ; Tue, 26 Sep 2017 20:19:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72209265B9 for ; Tue, 26 Sep 2017 20:19:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66C2328BD9; Tue, 26 Sep 2017 20:19:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9BC42265B9 for ; Tue, 26 Sep 2017 20:19:16 +0000 (UTC) Received: from localhost ([::1]:50993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwwK3-00063I-9e for patchwork-qemu-devel@patchwork.kernel.org; Tue, 26 Sep 2017 16:19:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43911) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwwFX-0002sp-Vo for qemu-devel@nongnu.org; Tue, 26 Sep 2017 16:14:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwwFW-00037L-Rm for qemu-devel@nongnu.org; Tue, 26 Sep 2017 16:14:35 -0400 Received: from mail-pf0-x231.google.com ([2607:f8b0:400e:c00::231]:46177) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dwwFW-00036r-JQ for qemu-devel@nongnu.org; Tue, 26 Sep 2017 16:14:34 -0400 Received: by mail-pf0-x231.google.com with SMTP id r68so6078448pfj.3 for ; Tue, 26 Sep 2017 13:14:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8gn2Vjfcpv8lszaAxHBwoyqNNNQxwByUaJ2hAt6cgTg=; b=Sk/FPBQI/Q14KWMYUKamVg0v0yKOzWgqFwL9ujRdJiV6Dnd6slo6TVIodjjRchIRbC WyyoyJIH+UWo39DMQS9x7qlJ/bVl0C+8EdjiCMhJrZZxrG4Mel6SglXwQL7bVjw5BQl/ oLYxUjcTr/L68ZniirImou0Sz8+0rL92S8cC4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8gn2Vjfcpv8lszaAxHBwoyqNNNQxwByUaJ2hAt6cgTg=; b=BjnTCivbKf4vLMURKmTZFCLRRR6Gb+T4LS/Ry5cGMMASv0U7zoZN6gDAvT2O8l1n5G ibW98gFBxhdqFpw4eAbdvoxpJH/1eTHZNmPoJRUwbCZZuQ9IQfpaiXWw/oyN8dmpuAeW jQLf9AcSyLwLiX6Cf9hWD6MtzFyCDftfBXP8/FdUh98yOk4TpzI2WgjQH0aaY/jRlq+k v7YyxH0tR3/cvx+xFBq7AqgoBw8qtbiY3G6qYhNN/jIMFIQx3UE/22pShazuIlG00OvP hiJHiWORqFEnaCWbnRS+Va0g5b8IkdRPWT9XqPN5RFkQuAfRWOSzg9keLdWWq7rja002 O2iw== X-Gm-Message-State: AHPjjUjXKX6Dca4iZ25NY8ocIx5VhIBgXL4IYkK1k4GLU6MxUQ8WnM0g ErynIoFpDAL/gD4yQ3z5L6VOzniZ0xs= X-Google-Smtp-Source: AOwi7QDTAl+DYgY+VVkCnV1rlT6VzNETgpGZJ9Kv1q19IxaxQELggbC939VhR3+5yOPtPli4U05cNA== X-Received: by 10.98.87.23 with SMTP id l23mr11908315pfb.77.1506456873429; Tue, 26 Sep 2017 13:14:33 -0700 (PDT) Received: from bigtime.twiddle.net ([70.35.39.2]) by smtp.gmail.com with ESMTPSA id r138sm15582470pgr.12.2017.09.26.13.14.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Sep 2017 13:14:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 26 Sep 2017 13:14:20 -0700 Message-Id: <20170926201427.2833-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170926201427.2833-1-richard.henderson@linaro.org> References: <20170926201427.2833-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::231 Subject: [Qemu-devel] [PATCH v3 2/9] target/ppc: Convert to disas_set_info hook X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-ppc@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- 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 1184bec678..d55ad61dbb 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 466bf97347..5524b171e0 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -10643,6 +10643,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, @@ -10704,6 +10724,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"; }