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: 114289 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4239991qgf; Tue, 26 Sep 2017 13:18:23 -0700 (PDT) X-Received: by 10.200.39.13 with SMTP id g13mr18260790qtg.234.1506457103176; Tue, 26 Sep 2017 13:18:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506457103; cv=none; d=google.com; s=arc-20160816; b=da+JDHCZ5WcVWQVxctTqE+CODggXfWnMMKY0oeEIttr0PYLA5446gMY6uDfGMUc6Vw 424YLeAkYzdjtjcpgllaX7N0Y3FCb1TEI/+vIWlMg5Dc+s9b9rRCOJtxY9ToVv6aa42X 2mTXUKqxALosOLhdHIKO/eECUQ1thsculmNKcMHJUHcQ6MgbbzkNfb+WSL2bGVsPkJCh T2q8LLTB5NUg1TsOrq4w/qUsig05MmLTGFFuZh+k8W8ohYNDBbuVgHktUBoDRbtCu4Qq NMENSf+fiOdBkWg5W/YqS6AeK6SAu1ddHyu2Jl8GlpI4dOZDUnArO0PpIE7mKZn/Y6rJ 6VQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=8gn2Vjfcpv8lszaAxHBwoyqNNNQxwByUaJ2hAt6cgTg=; b=FLNknPvmXNdiEfsMAx8nD1MpLqGRCYH3Ag3t6smkbOWgE1LHrmMCo5UZUc8kHG8WNR 2bJ9z1YlJZDU603IgCqXxxc5UflK/MnSJoHW9TmjjPL9kZRAd45jl8HRxLgq5TJOiCN/ ao3qwhUozV/QkK80dRMIDo4kFt2f7vatQ1X+vqQ4k6zbV+g3KlPIKfSNoacKi4Q/4RQx 3CRpH4cnwPLSRjyq1R1mu+WtapBysJOUnWe7eAbyvtnNQ+3MstTHsvw/WLYHK+DJujFv 3uITnX6xLOTh9ohL0gNja7w2sGIISmw/G4AG2cEWIPhzRtPISjY5JNqvQA6yUzxAfTKM E7NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Sk/FPBQI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [208.118.235.17]) by mx.google.com with ESMTPS id a22si1157809qtc.268.2017.09.26.13.18.22 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 26 Sep 2017 13:18:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Sk/FPBQI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwwJA-00063I-Mt for patch@linaro.org; Tue, 26 Sep 2017 16:18:20 -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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.13.5 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"; }