From patchwork Thu Sep 14 18:35:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 112609 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp1094763qgf; Thu, 14 Sep 2017 11:37:45 -0700 (PDT) X-Received: by 10.237.35.37 with SMTP id h34mr34774927qtc.51.1505414265934; Thu, 14 Sep 2017 11:37:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505414265; cv=none; d=google.com; s=arc-20160816; b=Je2A/rnPLh9G6LdsujdRVw3I7p7eEtuFhnZYJkmM1PUyRz7wq0oMXUkh6wvCjSmyS0 tf5CoZPDXgjH9g5OGCN5GGuHtEZNDUDN0umh0ACz30A+RjDFwUTHq94rapHVmUBJbRM9 9rWq06qPsFGr+9adeEai4rrmrFgU9ubmrl6MTY23w5OIdV/DA2DiOWsC7UHgb7rRnrT2 1cPROOcRGHcQSRyGT+EhdpgFUdQLu2YdDZgTmPSsuqVlOvkVOe2K7V08DKyLNw+FuKqw HwCfUp/Mazy2xbfY1ePttYf6Tm8huUuZLhS+WfLbFwCqNLV5dToyHQBMG1vZXWzLsHnt zyEQ== 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:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=K4ojG0ieDAtEo2YnrLLt/bBoyg89hA4hX7rGuCkv49c=; b=FPBt6aLJmF/EW9hsGcczcfKoJ7RHrqbPoM5OMMb/vkaMuPIdrsOMoq7/nV6k5bJTXD TWc5yYiFhi37wSpNA4Xyoubp/jLF8/KfiQtjdWxogIWjz/LmQ5mf1CxY0kjU2NeCjvBP ZFacfElTeA1iwz1zcdSXuvO3cUM73GI1kgm1VLMICle+pbOk2q1VIQzg58inOzQvFatH NWy+IZnLNbuht0aIP5n8U8dBq8sIqahbnI/ZlSM/EkoqIaXKge/fzJBKGzBR7xG1JobD Wccy5s1CuEIOK6RQS2PlQPWtlXamY3aeJYSUz2bA/tTB/DEly//NQv8JQb4dmJT+01Al 6oTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=RvHshqXG; 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 z75si18100636qkb.484.2017.09.14.11.37.45 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 14 Sep 2017 11:37:45 -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=RvHshqXG; 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]:49453 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsZ1D-0001tu-Lg for patch@linaro.org; Thu, 14 Sep 2017 14:37:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsYz0-0000Oy-JQ for qemu-devel@nongnu.org; Thu, 14 Sep 2017 14:35:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dsYyw-0000Oa-Py for qemu-devel@nongnu.org; Thu, 14 Sep 2017 14:35:26 -0400 Received: from mail-pg0-x235.google.com ([2607:f8b0:400e:c05::235]:54885) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dsYyw-0000NR-Ku for qemu-devel@nongnu.org; Thu, 14 Sep 2017 14:35:22 -0400 Received: by mail-pg0-x235.google.com with SMTP id c137so111717pga.11 for ; Thu, 14 Sep 2017 11:35:22 -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; bh=K4ojG0ieDAtEo2YnrLLt/bBoyg89hA4hX7rGuCkv49c=; b=RvHshqXGLMJzpT8k0DOM1saq/ur1qNtu7Sv9/oqBmVYN7eQMEv+ng3R3Rcfh6IUd3R 0EEmJ027bfOAJFWE9s1mCrfoKhBFdUppME4FxtDSd1BdqQtWnzoLvYtcn92CNDsXBjpJ 8zc7Z6BLoVM1i0gMhgOzB8D0rWuEcDWEt3xNE= 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; bh=K4ojG0ieDAtEo2YnrLLt/bBoyg89hA4hX7rGuCkv49c=; b=WzhQbzG6iBDzRUqGa/bgA3xIOSauhOEEMMpOISaAcgU6FXw9UEeD5KUL0Sr5aOeWMH E7hGRwMMqhPAvzHOZKyMhOKIKzazr4HWaX4wjC+6TdaQGWWwKOfOvsuHW7u/+70ErZ0e QHMyYfPsOmqau7cUiuGE8qt4wRXOo5VfIw+4VKW+nmRvWCAFGajOMc3sjviBGnqsgtTW l9voYG9Gy0HPN5Kx/rYoS4Y7rz8Jr0OJt7eG9u8QC2vQ2CWB+G+wgvDWu+mMLdvHAo+7 WNdb5Qkqc8x8sZFnR+P0SMWLw6AVNCh4KNHNsULrAbqT0TovmSz/slKiLUwrV4A6eQLe UxXg== X-Gm-Message-State: AHPjjUhgAdm6klaNKInTIMMZaSZ6aRoea9tNr0JjND8MYofICc09q4at DZ7sM98CyQyLdD7++06y4g== X-Google-Smtp-Source: ADKCNb42E1ohZK11Q4QIRensistMAnKlqUzuZjfxmFu0aaggIrzdcOP3T5VLQWVWPvAkF+Dm7hxd8A== X-Received: by 10.98.236.201 with SMTP id e70mr21935219pfm.13.1505414121286; Thu, 14 Sep 2017 11:35:21 -0700 (PDT) Received: from bigtime.twiddle.net (97-126-103-167.tukw.qwest.net. [97.126.103.167]) by smtp.gmail.com with ESMTPSA id l85sm32473848pfb.176.2017.09.14.11.35.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Sep 2017 11:35:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 14 Sep 2017 11:35:08 -0700 Message-Id: <20170914183516.19537-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170914183516.19537-1-richard.henderson@linaro.org> References: <20170914183516.19537-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::235 Subject: [Qemu-devel] [PATCH 02/10] 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: qemu-ppc@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Cc: qemu-ppc@nongnu.org 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: Alex Bennée 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"; }