From patchwork Thu Sep 28 16:54:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 114457 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp967034qgf; Thu, 28 Sep 2017 09:58:23 -0700 (PDT) X-Received: by 10.55.25.29 with SMTP id k29mr7936695qkh.229.1506617903752; Thu, 28 Sep 2017 09:58:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506617903; cv=none; d=google.com; s=arc-20160816; b=aHwCasWGg0Wtvgmi2/yx5myqKkCVmocK+/+4tOyfEN3tabUlcnZdr6IerDjAAweCeZ tP1xvVZV5DZbzi78ZzvtR3BwpNPDTHnwZ6hBohy/UgeM62CV1FXjBawhYWMxTYT69IdA Vqh5PAGsXarCG7w6TMbtXBjuyVDOMMEqoAbgDUL/RbCk+lt6By00R9yTDxt4e/dyRFjE ULFAwVrg+u8BbFCb+B5vmsnT39eyzImBjuLQUCAqVyMaPSzkJH28r3nmmxBA3a2lfQrn QX4iouMBEEqYexoRW5RNSOskTlop86639KFjNV9nNzfFsV6SWYNVXCnvlLTp8UnqTpSV rfmQ== 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=YvlXf/s1izK4/VvukYL7jCy0edNnDL+IAGRPLjz/ecM=; b=n9uiegrND2OOORuO+oYzjGgCz3A0r9mZopRLDbB7EmFFim4w3v8ihX3gLPkhkfXOXr Le24DVRrcdqenFRWtCuPxfrefEpBJnmqg6RuXrSKHO9p/R50w4qk7HhpwZ3LCrq1kjYh fCI9wTBy+N9R4U61tdqtgUeQ4ojJ9Xsi41jhKaOLqn/Gn77vEUWJidQBCCJ9pWEX12rw 4HA5xr3gxhyKxo2YYb8G9gsP8/jTVRsqPAQeFH8TLvQjmk94jX/XFXjC7QDnbyNRW3I3 JWkX4/5gAV5Hy9Edhg1wQfS+aFVNjlBl+zKcOlyheDKtXFqts+w7grR/Pav4I+RPiGhu U6JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ajg5aQs+; 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 c8si1981458qta.516.2017.09.28.09.58.23 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 28 Sep 2017 09:58:23 -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=Ajg5aQs+; 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]:60074 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxc8j-0007ji-HN for patch@linaro.org; Thu, 28 Sep 2017 12:58:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxc4w-0004mN-0n for qemu-devel@nongnu.org; Thu, 28 Sep 2017 12:54:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxc4s-0004JK-4l for qemu-devel@nongnu.org; Thu, 28 Sep 2017 12:54:26 -0400 Received: from mail-pf0-x22e.google.com ([2607:f8b0:400e:c00::22e]:44059) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dxc4r-0004Ix-MC for qemu-devel@nongnu.org; Thu, 28 Sep 2017 12:54:22 -0400 Received: by mail-pf0-x22e.google.com with SMTP id e1so1146458pfk.1 for ; Thu, 28 Sep 2017 09:54:21 -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=YvlXf/s1izK4/VvukYL7jCy0edNnDL+IAGRPLjz/ecM=; b=Ajg5aQs+NHO6phB0tavOH54Bxh+CPpQPc7gKS266gdRbZ4O7sM0TmTiekCnuFr28gM FG+ddfBZ+uxmVo3QsbdK5iAPi7UfHgdSoiQtYxsjfqC+ju6OgUeGcUveftfGNNipl4CX UnKQcyJQfVD+m2JKYq4hKwpWX7dCH1B4lW4Jo= 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=YvlXf/s1izK4/VvukYL7jCy0edNnDL+IAGRPLjz/ecM=; b=DJ86JG6fjgiL/VMekdx8ehRd8hXyh562Bu9zYxiTNe+j8dlY1biYlHcxPDPMYeCWlU 6jhCPcBVrorFE+XnatgitIfJqAkveIY9I97Y7jO7qYmqq+mm6qLpsksIYDMhUkRKvidO YlDCENcO+Ew1lN9iDg74J+K9m+dPk7n5aHphP79nBYD9+Y44jLxRnlB4HTbNQpbaS/Mc nA7jrBjZA23f5Ru7Mb1Umex/zzee1ukApyBYVsbY7WK9+SwS3IrDyN1RsnjQUnzBYzEQ bR5iFyV9W5DOrF3ldcVggmt7Cq0bGjDon0pEz0bWnfj4lQV95CAG9f5eZErftoLvMIgJ fMjQ== X-Gm-Message-State: AHPjjUidpEEP6TQ0AvUfgCfrY+RTTekoioG6BdtFOKnK39Fh5GgtB567 /Iaq9NJ6NSSiVDc3b9RHZE5dRf9RuC4= X-Google-Smtp-Source: AOwi7QBlN1XyrgXXxMiw4SEUWkRqm/3l7RtPZfvU8fqDzcu15MkWQ2ZhnjYXvoc0p+fp12FY9uuKBw== X-Received: by 10.84.217.214 with SMTP id d22mr4523071plj.389.1506617659972; Thu, 28 Sep 2017 09:54:19 -0700 (PDT) Received: from bigtime.twiddle.net ([70.35.39.2]) by smtp.gmail.com with ESMTPSA id e133sm3062332pfh.177.2017.09.28.09.54.18 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Sep 2017 09:54:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 28 Sep 2017 09:54:07 -0700 Message-Id: <20170928165414.7339-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170928165414.7339-1-richard.henderson@linaro.org> References: <20170928165414.7339-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::22e Subject: [Qemu-devel] [PATCH v4 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" 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 Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé 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 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"; }