From patchwork Wed Oct 25 12:30:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 117118 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp1693481edm; Wed, 25 Oct 2017 05:34:31 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TrBYc3FNeTbiIKpdl0yfPXdS3PQuYE19BrULyl4TkIPx8NO37vdmCC1bGSQZgq8p1yvk/L X-Received: by 10.37.217.86 with SMTP id q83mr1133084ybg.137.1508934871472; Wed, 25 Oct 2017 05:34:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508934871; cv=none; d=google.com; s=arc-20160816; b=iIGAyRuwc5TjTJ0WgQPbyqT5ToK50bN3867bI9OnXBWFH9q6cXQ4s2vD0Q9dTJ/dk5 VrkLhFERLSX4r9UIJn1yJVztdZgSp/iFpVQUBEdJ89AlSg1h953infwlreW07Me63y8H 5dEnHqsvqnSCjc0FQ7b/qKYFXKBqPLcYwvi7joclgxBnMU9qPYppE2pA7TCAiockhXzh I026IxgL8Q2QSqtETO6PL97rHgZHGrTttuMdp5LkhFxAUcQ3sbFX2f/KyAT5SmlyDhpS IHY7tzCx3FxDfG7b1MuGXznirkhYJGivoNOWZ0TOCyuO3fzG7xM2uFwXMjk12uH4ZKYQ eOUQ== 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=/LpK6D7McN6vBLyZwhejQizFGQYb6MJuJmPPhtR5cyw=; b=bwreQLHLk8c+wmnFr1sZgJ0UZ+SyzjsIv6gtBwUKCziQSpuEvm5v6W+bklb3vdLMEG MtMxbhgVcHreMuOviKrPZL6WnfuOZK8FLzed5h5/V7B3Cp6WLEFumjXkxxfAHC8+S/F4 /vmKGQyXee4f2n+c7x3+gnlhMbTkwVDGmWClo9mm4ch+SCh6fpoezKudcx6UQW5CovC4 t7BACLCUvT+mO1yOa46QqZYOscLdePQIXIDxWyn+sUUfPb5R8loXW8IKym5q8eLJ3GSA CRxGbDsbaB+Nfdoeq0fJc8Y0XrXPE957EIjAIwkm//WJNbfd+aeQxnPdSA8cDSXoXVQb TZyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kLgTtqgX; 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 c191si425714ywh.619.2017.10.25.05.34.31 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 25 Oct 2017 05:34:31 -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=kLgTtqgX; 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]:48093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7KtC-0001YL-QM for patch@linaro.org; Wed, 25 Oct 2017 08:34:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7Kq0-0007Vo-CJ for qemu-devel@nongnu.org; Wed, 25 Oct 2017 08:31:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7Kpv-0007zY-K4 for qemu-devel@nongnu.org; Wed, 25 Oct 2017 08:31:12 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:52865) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e7Kpv-0007zG-AO for qemu-devel@nongnu.org; Wed, 25 Oct 2017 08:31:07 -0400 Received: by mail-wm0-x244.google.com with SMTP id t139so1626414wmt.1 for ; Wed, 25 Oct 2017 05:31:07 -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=/LpK6D7McN6vBLyZwhejQizFGQYb6MJuJmPPhtR5cyw=; b=kLgTtqgXRbkS8y3oxJB6ZpjoZVnIuPt13vYd8DzwHSj7oRBdcOhj6F1d8xuCQCNTBb gdGDJWfQsCHe4dqUkPoXUJIvj/s3zZ/s1uv+yk3/Fh0GsxXkwECJyJAlbaXcrewqxltU 5I2iQVOxGsU9l7nGXS21da//Ik/Jz+rvrqrVE= 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=/LpK6D7McN6vBLyZwhejQizFGQYb6MJuJmPPhtR5cyw=; b=dI24DRBiBJ874nE7MOor1d9poIqbfGT2QYy2tt+UAUiK5JOoCk1FNbljsU1PrFWdnH 4w4udaKdxJ2qPuBlmUaI9SSt49jA+BY0CKE8h2KyzKMgLlrV6EIRfQgVrQqMKSRvV6UF wedb1wrOZBloqlB0Xa6asPylc7/7yo2U7TGan2F9FR4rvBy/bRXxSNZ8r0WUBZLdqNaQ ZNlKZJLt3WlbjcXkMe6EDAVrxBpLtyxLVmZiOMwkrFyKPaAYtOfCkpXp5Z0/DKBukYuV TYhBfrUa0jv8TgICPIubI3SkWXocfwHsXKjlzvN5BOc4qLlwn0sQUm+nAk2RL3svySEK 9dDg== X-Gm-Message-State: AMCzsaUjLrs+Pbv2NNb+C9+zJfIsZomWEVaB0Fj0Pmdg2wT2ymy+Wdlp k5o5we6UmhquXcG2A7eywy7E7m4PLGQ= X-Received: by 10.28.125.206 with SMTP id y197mr1790352wmc.85.1508934663190; Wed, 25 Oct 2017 05:31:03 -0700 (PDT) Received: from cloudburst.twiddle.net ([62.168.35.105]) by smtp.gmail.com with ESMTPSA id 61sm2263446wrg.58.2017.10.25.05.31.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2017 05:31:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 25 Oct 2017 14:30:47 +0200 Message-Id: <20171025123056.3165-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171025123056.3165-1-richard.henderson@linaro.org> References: <20171025123056.3165-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: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 02/11] 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 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 7e22a80da6..88d16fbd57 100644 --- a/disas.c +++ b/disas.c @@ -204,23 +204,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; } @@ -380,22 +363,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 a81ff69d75..cddbf92564 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -7407,12 +7407,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 7b9bf6a773..9b4353437a 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -10519,6 +10519,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, @@ -10582,6 +10602,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"; }