From patchwork Thu Oct 19 15:51:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 116409 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp649807qgn; Thu, 19 Oct 2017 08:56:39 -0700 (PDT) X-Received: by 10.200.2.158 with SMTP id p30mr2968269qtg.255.1508428599535; Thu, 19 Oct 2017 08:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508428599; cv=none; d=google.com; s=arc-20160816; b=Pqb6xcGv/a/1HH2JqzcpFRA7tCGk+ud+80K2zOiMnJAVHWIK2V7Zj5/TOJvdOlrn3M YmG/04nc2Yer2rQU21kADLvKILdn1JQJ2xxs+mOjFL0n0LtTWN7YxrjbHK20c3q24+Po L2VOHPt6JuIf1kxkIxxxUMTTKUTOF+GijH0iGKbuosdxs8ys81TTAR6JcHQOXoJrVV/u d5KOwyXJh4kNfRfIdnsOlFycAS7nR0Dj1oEnkAvlACVysL+sLjXNjyyGzrToUshslbBS JPVNU5yGgwP00r6NkqzhAAy7qy4lwpCdL3SZaZFNy97Emv3h3nkxx47V5GeVhe/l50K/ G8hA== 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=dlDugfezSuwtwOm5io0AheHNwAqAkeRVA5S1k9AELUjO4xXGioZx/eW45vu/PsBR49 BSzHUmDLntQ0r3VfXw/jx+RBNFRVHdsDksDOtpOn3ivifzIakFmcH+dRvCYIR1UX9Z+A WNngpXElQNxjaUdQWPW3Vzru8NqVV/Kbssk3IssnzzynBtWM+FHWnILWq7/1f3ChieNV 0QvaRs9UGy62w88v/hq9+LrFdIvzxeEqZgu2uIyWXnJ8qkqOhi1JgLmniv4zRy1m2AFa lkgmmeMDut8G8b0AOPiR8x/zz/QRU7DDTj3K4OHb5iciEJcIFf+fl8g2wUmCsGqWlt3R 4hAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YEkSIPCM; 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 b74si1902078qkg.64.2017.10.19.08.56.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 19 Oct 2017 08:56:39 -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=YEkSIPCM; 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]:49847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5DBV-0001zR-AE for patch@linaro.org; Thu, 19 Oct 2017 11:56:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5D6z-000790-3Y for qemu-devel@nongnu.org; Thu, 19 Oct 2017 11:51:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5D6v-0000Cd-Iw for qemu-devel@nongnu.org; Thu, 19 Oct 2017 11:51:57 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:51592) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e5D6v-0000C3-BM for qemu-devel@nongnu.org; Thu, 19 Oct 2017 11:51:53 -0400 Received: by mail-pf0-x244.google.com with SMTP id n14so6858616pfh.8 for ; Thu, 19 Oct 2017 08:51:53 -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=YEkSIPCMX8o3whyQO1ww7FPS7HadKT/L5VX6pzfLgdgAzLbFPj1bDUGM0LgJQApamk LzN2439vs+mB2lf7lzfuhlmWX2cT9gYZFAXY59Qpw4JVSkfPFlv4dXhPPnBzP3hx1V/s m8gZwFGXriQd8FAFphK8HlRVyJXxFGFAz2Svs= 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=UG8pUK9OUkExJHlDGBfRiLkC0hWXI6YtwHl16Q734CSkfNTOUCTKkVd94vy05Je4u0 1IiM/caeXkUZacWtF35mFwdPHSFcKI1PHdrUgAJI3OZl6OvV0hPHmrHRCfImXYWVCQsf 5NdsM4gdXwGVR/lpfYjlqDMJAZUz9gf+tGz10XN6jM8W9GbRZs9ZmOiujOSLIDSsmOWW k2ZbjshwwWRJwLeM+GoaOOwLogoTME9EZQeyFLS8ZLeorS9kXZ58b1vhdC40vl5SGGlt /c7YWZtXNZUoq6TsZRaKbge1vajCyhOdGcf7rGsnFrdGCAhU0Bi0YMyPayHjyOjJWkUU 5HuQ== X-Gm-Message-State: AMCzsaUzPh13SD0JvPx7eEhJPJ2cJ4UvW+Du1D1s2d1uxPUcwOgaZV4k 1OtTUfxYevfpw72/UJ1MiBG1xAMWBak= X-Google-Smtp-Source: ABhQp+R385Nr/iuWvJG1qLHlte7Pi3No3kKBtJ7P6SZi40QAGaBTDL5hnbDF9/iyFTSdXq7EtYNEbg== X-Received: by 10.98.55.133 with SMTP id e127mr1972585pfa.130.1508428311887; Thu, 19 Oct 2017 08:51:51 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-165-104.tukw.qwest.net. [97.113.165.104]) by smtp.gmail.com with ESMTPSA id 76sm27971114pfq.4.2017.10.19.08.51.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Oct 2017 08:51:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 19 Oct 2017 08:51:39 -0700 Message-Id: <20171019155146.30434-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171019155146.30434-1-richard.henderson@linaro.org> References: <20171019155146.30434-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::244 Subject: [Qemu-devel] [PATCH v6 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: , Cc: kraxel@redhat.com 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"; }