From patchwork Sun Oct 22 00:46:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 116613 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3185598qgn; Sat, 21 Oct 2017 17:47:04 -0700 (PDT) X-Received: by 10.237.60.3 with SMTP id t3mr13204154qte.138.1508633224126; Sat, 21 Oct 2017 17:47:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508633224; cv=none; d=google.com; s=arc-20160816; b=Ryho1Hx439eeJFY4PH4vZSv7BaFN847ormrNAfESsnH3PWGMRUiPr+Ja2rvlZL2pe3 twtQol8dD809n6Si445h8E0Ezgt2kS3Ya4RCKbif762U2yTNMCPBxk2xgIQT0qL6Pxdj oFZadGfC2YxIRY6gmIfFPvmyiE0YkleRN5mRHVBYWc7h4lto0tMCGGTIo1omMDtcHq2C E48wq0YpT6Gh4xlJKCfnP7flwm4M21SDYt6CXQzoTJE4N1kern0sbQqF3/Zh+quqm8Oh K6mW68bK51lk2ZLSny0LHz9om0UG5kjVA/78xS8J3P7mWIbED06izJXS3xpURUlkAQLS sX8w== 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=/LpK6D7McN6vBLyZwhejQizFGQYb6MJuJmPPhtR5cyw=; b=CJ+Klme0UU2d4qc2nYxOlvPgvgN20QgVvspi6VdHzvem+O+BLoX5jEiYR7g/i+QfD4 F/Ze40tH7WQNatvDi2did/89o1R/0TvDTgY6SDrwBMinxowd38HF9ZpjWySjXXUk2w8Q NoCjisBe2ZqXBb/NTd1xAu2ncUOH5MBEDEDue2Eglx1v4iRqzAHedu0bUk7YctccSDke ZCVmKW9cN5ABfBtZcW7yFL9MPM3ZU2/+hgxmSmI2YOAkgsxObuwWOxPzZi20Wpi1olOS pHt4ydgJ6t3IPt8154JYrrjZZ2zGYWv/5l0uap1ApxpIfIuUdKS07bBLnMKjRx9D1RA1 yPTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GxS0bhIv; 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 q28si3585796qtj.171.2017.10.21.17.47.03 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 21 Oct 2017 17:47:04 -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=GxS0bhIv; 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]:59623 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e64Pu-0002E8-0H for patch@linaro.org; Sat, 21 Oct 2017 20:47:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e64PP-0002CQ-IB for qemu-devel@nongnu.org; Sat, 21 Oct 2017 20:46:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e64PN-0008Cv-DB for qemu-devel@nongnu.org; Sat, 21 Oct 2017 20:46:31 -0400 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:54795) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e64PN-0008C2-5J for qemu-devel@nongnu.org; Sat, 21 Oct 2017 20:46:29 -0400 Received: by mail-pg0-x241.google.com with SMTP id l24so9199298pgu.11 for ; Sat, 21 Oct 2017 17:46:29 -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=/LpK6D7McN6vBLyZwhejQizFGQYb6MJuJmPPhtR5cyw=; b=GxS0bhIvaa67xDx0KAGSoKsTy5eNUrLwCZrtEMPAp2qJEis45wklF8Tc2zG26bln3c Pzi1CGzoA/1wXz3llpexZUISucdcF9kL8FusforJnSZyNpGjzVxY8v2nNNt8CgB6XuM3 YTCtFC2U4BOpWee4FUjO6XvzhZ5letKKUzMBs= 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=/LpK6D7McN6vBLyZwhejQizFGQYb6MJuJmPPhtR5cyw=; b=rtA5cVGpKdqCqgPPB+lVuL1zPFjGglJKEjYjRvHoBL8W3Veqn7NWkmAo7T7cMK0QNS FbUAhS0VdGKN2jHt5GwFolNo1lIovgJUYVGtLbHMfNxiZPJagiNyyXl/2AzkFsH9Cc2D ZwlGuXmmITLO8ZOu1hHzB236PclceWPi7IbKsQ64rgHrcSK94cgl2cGXW3gFcuOWj0lD tLFN5QBE/it7+K3IwChf/eeiF8ZiztbTcL17pHQbRMGSebv2TB2Q+mELTDR4DUxNYHCg 0ynM4VocNr/I/IdH9SRrS0cwfTgDIkK/QV/d5sbJIEMWr0XRRsv2GiThV0QkVNo/NPyT G1iQ== X-Gm-Message-State: AMCzsaUYheqmIlJQBhaTRKnPvcAa0a7cuO9po4AefGERZdvtqwwCiVGn +088x3188GYXRDPquLWDhRwLagkp+tU= X-Google-Smtp-Source: ABhQp+R7Dr/5DL0+W2y03UzLcTEm9UJy1pCrvB8AeooRTOneIWN5FZRa75KiF9fcbxi3xURM8P9H7Q== X-Received: by 10.99.131.66 with SMTP id h63mr8047974pge.156.1508633187788; Sat, 21 Oct 2017 17:46:27 -0700 (PDT) Received: from cloudburst.twiddle.net (174-21-9-158.tukw.qwest.net. [174.21.9.158]) by smtp.gmail.com with ESMTPSA id j12sm5766728pgs.35.2017.10.21.17.46.26 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2017 17:46:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 21 Oct 2017 17:46:12 -0700 Message-Id: <20171022004621.28372-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171022004621.28372-1-richard.henderson@linaro.org> References: <20171022004621.28372-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:c05::241 Subject: [Qemu-devel] [PATCH v7 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: , 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"; }