From patchwork Tue Sep 19 15:03: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: 113023 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp5049822qgf; Tue, 19 Sep 2017 08:26:56 -0700 (PDT) X-Received: by 10.55.20.204 with SMTP id 73mr2371336qku.11.1505834816335; Tue, 19 Sep 2017 08:26:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505834816; cv=none; d=google.com; s=arc-20160816; b=uwswZ3OWD288YKIZxQZdjhKUALKulpdUrrx2Vi5Svd2bNu28G6u96rfbc5Ym4inz9B Xlr9BB3vkmIfBD1nzChnGRojYolFsWovyWmDbWiDvwOs+X8tteLUw3rkU4QxDglpAjq7 gMReULiPA4dmfOEoylw63hDokpYY/2iuEDtxaqzQRXfns4HNLLsLrb/tliT/UAD6/EQQ O4xVE+d7FwiEZyOYztKs02Qq4KeaJ4WBbWKUsvZopkn5O2X3aSFy4TrQSJkF4rhjLEBt q1vH1IY/aSsG51HwG+OJFNp1B5hj5wRYUiVIVs1aKsqELep4K13XW45R04pWVr6hLKBd GTTw== 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=O/5b9DfX6J7dTrC82SbvRXaCWKuYVvKs9Y7LcoX1zsg=; b=Scqg64vy8z8+OaGozPOUruN8WODSaQF44k4HrG4Ul1y5IYGRGfEx84lKCJ8EFGeiHB DJFSKt0+op+l4AlLQF9jdAuoswXyBz8qCqBq1vytHuvf0Wcn1dYu25tinBUo5mjPB5v1 5Ja45Scwh7uAUVjjXmWzIzLaPHp7aWTyuTQzFOQ4cvY0/zfuOFvzH3HsXEhp5HNOyfYO 1ldW8udFCgkZ+HZIDRIVR4Dn86NMB1pN++25rKZYcPRPpAW+XYKM5QtJFrITsrzQXc54 B5od5Jw9nHmYnsU7G5l8H1GVPabIL5Zqzuu2wNy1q967iDO7vlcTO/IjUWVEZyUYjW1E 2kxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=TAVYO0Vq; 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 u2si9160274qkf.143.2017.09.19.08.26.55 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 19 Sep 2017 08:26:56 -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=TAVYO0Vq; 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]:43534 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duKQI-0003Wt-2g for patch@linaro.org; Tue, 19 Sep 2017 11:26:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duK3c-00082g-Cm for qemu-devel@nongnu.org; Tue, 19 Sep 2017 11:03:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duK3X-0003dY-Ev for qemu-devel@nongnu.org; Tue, 19 Sep 2017 11:03:28 -0400 Received: from mail-io0-x232.google.com ([2607:f8b0:4001:c06::232]:52408) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1duK3X-0003cz-9l for qemu-devel@nongnu.org; Tue, 19 Sep 2017 11:03:23 -0400 Received: by mail-io0-x232.google.com with SMTP id i197so714487ioe.9 for ; Tue, 19 Sep 2017 08:03:23 -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=O/5b9DfX6J7dTrC82SbvRXaCWKuYVvKs9Y7LcoX1zsg=; b=TAVYO0Vqf37+KTeCm0NuU41vNl3h6O0gatYd8L4tFjVhu9IZZoD2+g3lBewyldWURp 1QEHX18BMGwa2L22+XopxQhbD1MbmgU73/uEpRJ9ENImq2TOu903kBwoptdn+FdhfJiS TmzanvyCSjPPqe6VYt9KufHmq6AiilcCP7wNQ= 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=O/5b9DfX6J7dTrC82SbvRXaCWKuYVvKs9Y7LcoX1zsg=; b=JFIlsQz1TaQ7JruadQrcjLibZGIxLNMjQpg2BfSOjDuX0LSvMs9sRen6azDQmHSg7v Xjvm8zVwSVEVrVlaT/7L5oas4nmt+GuSDZDVJXc86iuNwv5QwxBynS7xRW/++16aADHm +wN6ezMuB1NljrgE3YEhU5aagSjT2UKMgD3v1idM9mm2lwiTKhWL906hEc+TjQQyZuuy MG81JKNu5xHkKpziseMR3Fit/Gk8U/+LFNW8P8ainkoMbet1ba+6oHfemamSHwf9FoTJ D1h/kgGDH+5lnq45WkoEbLVtMpSk5PAyegdmKq0cT5ujRptCJy1VZm9yglYhiC6lbMqP Od8g== X-Gm-Message-State: AHPjjUg1g/9h4Ra9Ev3iS/QTod67NkprruXAHvWWBnM7MQbwRcObAUZz 27toy44ga2bsU11J9OIXyFFDXjdc9aQ= X-Google-Smtp-Source: AOwi7QBkGGluaLt0pghoX9KF+GFxFtDACo+QCtph3HMsUubV+2swuZO9z/HKY+5NpmZakxGcWGNNzQ== X-Received: by 10.202.108.3 with SMTP id h3mr1896865oic.53.1505833402222; Tue, 19 Sep 2017 08:03:22 -0700 (PDT) Received: from bigtime.twiddle.net (162.189-204-159.bestel.com.mx. [189.204.159.162]) by smtp.gmail.com with ESMTPSA id h63sm360621otb.59.2017.09.19.08.03.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Sep 2017 08:03:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 10:03:07 -0500 Message-Id: <20170919150313.10833-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170919150313.10833-1-richard.henderson@linaro.org> References: <20170919150313.10833-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:4001:c06::232 Subject: [Qemu-devel] [PATCH v2 2/8] 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: David Gibson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Cc: David Gibson 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 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 d9d364bb9e..23fda1c0d2 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"; }