From patchwork Tue Oct 17 15:37:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 116138 Delivered-To: patch@linaro.org Received: by 10.80.163.170 with SMTP id s39csp1373701edb; Tue, 17 Oct 2017 08:42:15 -0700 (PDT) X-Received: by 10.55.215.93 with SMTP id m90mr19069042qki.197.1508254935047; Tue, 17 Oct 2017 08:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508254935; cv=none; d=google.com; s=arc-20160816; b=vNHZU4WoLIouo3W/ka2tz8DzesO2BMjhjv2vI7GqM85UeqS1t5NwRz7zBAuiVWyGc4 pHiMq2o7ofTY5CxI6vVjto5tJ9AWjmaf/XML6OiGk3HGGvxsIdZzr/zFkicFNL0Pn8Sf KxmqSBBrZxohIDSrGq7y6i5zk3p37TqPBEkffTS7EPSuF5OHQxAwzgAE81MJQABHbPzb CGbO7dXhDuX2eUv6DMwweCk5gxzaf13OU5pG08L+zbbmDbKFIPL3aTwkStL+k0asqm3e ZBwda96dqmgfZsnm8pcKuuwPt0gnQNLBB0thCrEL3NJzYv4i824kDzPAePVGQSN/QZmF dB9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=DujOZWDLQXyTmFWZGQ6qNVKoVqZ6fqxl5TfOEJNh3AQ=; b=d68uYW0vKfQgn/F786XovS16AAtmxoaOu1d1WeaxHiTrxKI6uVqQ83wFxYKoTlVJlC lMPuDE920jaey0K1Zq6JlhZLacr8nYxOXtNKACsdGydRuLhG7TyrgsOmJ0cApZ6zGOpZ vpFH250oyK7GUoWJDniuoMeBoUo7mdzRQ31RNqJUzTwOnq45wB3kf74lsPRZpHRnQiqy jsik+HvoLGrRutWw5kSFkMGV8D1nKKGSso2cPoKpQgTK1kNzAq94iQ2KBhxoZriatVry EjuwmyouP1Q7MsAtBx2sEINQQ600rmzBbS9oUduGCiuvmmksbEV/UFQ6VPq+80/hw9dg Yh/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=B6Pdn1Fx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t30si1593205qtg.264.2017.10.17.08.42.14 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Oct 2017 08:42:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=B6Pdn1Fx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:40107 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4U0S-0007RF-Pj for patch@linaro.org; Tue, 17 Oct 2017 11:42:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4TwE-0004CC-42 for qemu-devel@nongnu.org; Tue, 17 Oct 2017 11:37:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4TwC-0005kI-UU for qemu-devel@nongnu.org; Tue, 17 Oct 2017 11:37:50 -0400 Received: from mail-pf0-x22a.google.com ([2607:f8b0:400e:c00::22a]:44614) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e4TwC-0005k0-M2 for qemu-devel@nongnu.org; Tue, 17 Oct 2017 11:37:48 -0400 Received: by mail-pf0-x22a.google.com with SMTP id x7so1620398pfa.1 for ; Tue, 17 Oct 2017 08:37:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=DujOZWDLQXyTmFWZGQ6qNVKoVqZ6fqxl5TfOEJNh3AQ=; b=B6Pdn1Fxz6C4w0DZ9Wtv9vTL90mEWdTChex9w3uiMDAxxaOVKd6TRqv5MxXblewY9s LawLseK7j9x0Pjmqyiwm2R3Yx2JLtSo4uNxL3pQCTBFM0LCMTCN3SyqH/xCij52u+L90 Wqw+yRoW1bBanTWLLaaXEoBVSvejnwrWd51xc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DujOZWDLQXyTmFWZGQ6qNVKoVqZ6fqxl5TfOEJNh3AQ=; b=kwNWo0oBXJLO3DwvFRLBoIwd/sCmY0VK59E1nuIbRrNDwaoBGCFxmSvISfxDs1lIH6 oKdAVetuCD9tq732I66mSoBcc2xrj6xGayLqzZuYWx+AwYTyqqp6oYgJf90z22V6IMxt BJD5cCbnhMAdq7ErBt2fFwJwLQjJtshxldI/dAbfb9gON/VQgu6/+16yVN7AQpmNRiwK jUA3F59TOgws8Mn0IkDwyu8Tx1DVtr7XC/Q2DIlPnOMAokwwjwbRD3MkM5D4DR1v3OZX HDb62GfXpgd4eCbqOH5nmE1W9t0m78efsswEdWf7PtK3bmETvR7PDFtKuFOKYQWNzw1l 0bJQ== X-Gm-Message-State: AMCzsaXXuAWVkVeoFbrCATlVizwsE+4F2tIVS61hyPQoj1esk8PoMaz4 sFD+mw5Bt3IT9WqvfptSXd56FPkTLcg= X-Google-Smtp-Source: ABhQp+R1WTjnGaG0U0cJjwKYo6whmD6AdAtaGxBV3/aSDtgxtO0jNH1O2lro7eEqVd+nA5HhL85/zQ== X-Received: by 10.84.164.104 with SMTP id m37mr4356311plg.242.1508254667351; Tue, 17 Oct 2017 08:37:47 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-104-76.tukw.qwest.net. [97.126.104.76]) by smtp.gmail.com with ESMTPSA id y84sm20094415pff.158.2017.10.17.08.37.46 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Oct 2017 08:37:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 17 Oct 2017 08:37:35 -0700 Message-Id: <20171017153742.10026-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171017153742.10026-1-richard.henderson@linaro.org> References: <20171017153742.10026-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::22a Subject: [Qemu-devel] [PATCH v5 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Tested-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé 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.6 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 a736ae9a81..2164dfcc3b 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 c6399a3a0d..2863e2c0b0 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -10681,6 +10681,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, @@ -10742,6 +10762,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"; }