From patchwork Wed Jun 4 12:43:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 355897 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5B06A14008F for ; Wed, 4 Jun 2014 22:46:23 +1000 (EST) Received: from localhost ([::1]:60695 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsAaD-0000m8-6q for incoming@patchwork.ozlabs.org; Wed, 04 Jun 2014 08:46:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsAZ2-0007mv-Gj for qemu-devel@nongnu.org; Wed, 04 Jun 2014 08:45:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsAYv-0008B6-Ct for qemu-devel@nongnu.org; Wed, 04 Jun 2014 08:45:08 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45051 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsAYv-0008As-6z; Wed, 04 Jun 2014 08:45:01 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 42A77AC67; Wed, 4 Jun 2014 12:45:00 +0000 (UTC) From: Alexander Graf To: qemu-ppc@nongnu.org Date: Wed, 4 Jun 2014 14:43:03 +0200 Message-Id: <1401885899-16524-3-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1401885899-16524-1-git-send-email-agraf@suse.de> References: <1401885899-16524-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: Tom Musta , qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 002/118] monitor: QEMU Monitor Instruction Disassembly Incorrect for PowerPC LE Mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Tom Musta The monitor support for disassembling instructions does not honor the MSR[LE] bit for PowerPC processors. This change enhances the monitor_disas() routine by supporting a flag bit for Little Endian mode. Bit 16 is used since that bit was used in the analagous guest disassembly routine target_disas(). Also, to be consistent with target_disas(), the disassembler bfd_mach field can be passed in the flags argument. Reported-by: Anton Blanchard Signed-off-by: Tom Musta Reviewed-by: Peter Maydell Signed-off-by: Alexander Graf --- disas.c | 14 ++++++++++++-- monitor.c | 4 ++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/disas.c b/disas.c index 1397167..44a019a 100644 --- a/disas.c +++ b/disas.c @@ -445,6 +445,8 @@ monitor_fprintf(FILE *stream, const char *fmt, ...) return 0; } +/* Disassembler for the monitor. + See target_disas for a description of flags. */ void monitor_disas(Monitor *mon, CPUArchState *env, target_ulong pc, int nb_insn, int is_physical, int flags) { @@ -485,11 +487,19 @@ void monitor_disas(Monitor *mon, CPUArchState *env, s.info.mach = bfd_mach_sparc_v9b; #endif #elif 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; + s.info.mach = bfd_mach_ppc64; #else - s.info.mach = bfd_mach_ppc; + s.info.mach = bfd_mach_ppc; #endif + } + if ((flags >> 16) & 1) { + s.info.endian = BFD_ENDIAN_LITTLE; + } print_insn = print_insn_ppc; #elif defined(TARGET_M68K) print_insn = print_insn_m68k; diff --git a/monitor.c b/monitor.c index 593679a..a7a0f85 100644 --- a/monitor.c +++ b/monitor.c @@ -1283,6 +1283,10 @@ static void memory_dump(Monitor *mon, int count, int format, int wsize, } } #endif +#ifdef TARGET_PPC + flags = msr_le << 16; + flags |= env->bfd_mach; +#endif monitor_disas(mon, env, addr, count, is_physical, flags); return; }