From patchwork Tue May 5 04:45:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 467923 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 2206514012C for ; Tue, 5 May 2015 14:52:22 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=vkIcXCIn; dkim-atps=neutral Received: from localhost ([::1]:36971 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpUqC-00019Q-2O for incoming@patchwork.ozlabs.org; Tue, 05 May 2015 00:52:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpUl2-0002lm-Gu for qemu-devel@nongnu.org; Tue, 05 May 2015 00:47:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YpUky-00061m-Km for qemu-devel@nongnu.org; Tue, 05 May 2015 00:47:00 -0400 Received: from mail-pd0-x234.google.com ([2607:f8b0:400e:c02::234]:33127) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpUky-00061I-DJ for qemu-devel@nongnu.org; Tue, 05 May 2015 00:46:56 -0400 Received: by pdbnk13 with SMTP id nk13so182840793pdb.0 for ; Mon, 04 May 2015 21:46:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=VXLEi6LedjaNkzqTn7ZI4yxos1LYnYqBPzUpC+W18a8=; b=vkIcXCInKfOJ1Swpk/v8i4t/oitaIWaAVoGKJfeDRafjKBjhkLsiDB3ieQu4j5oOFn suT4NcORGeBCSad16G6KcflN0hggLCfjbCgCvZlupCzRwPV/XC/ICbKPHrFcMtW7Lv2d o9wPMb2TtxNVGa8gyGpEKoJGgw7QP2k17NMxVk7fR/6G/ciTDWV4FDiFiNtmCsIfT9OY OtiJ9T4shsgP/xsLkGUYiL2ITFkxdMh9ZuemmKXF7oyE5oIaY3jli45tYw+Zl6Wzi7mg zU5DKJbFZzWaCAspsOyH2giy+R7zXJ5+zusZzphc4rFgkqkGBetDAjKp+RzBQUXPhnmQ wgGg== X-Received: by 10.68.167.131 with SMTP id zo3mr47850181pbb.123.1430801215696; Mon, 04 May 2015 21:46:55 -0700 (PDT) Received: from pcrost-laptop.hsd1.ca.comcast.net (c-24-5-157-48.hsd1.ca.comcast.net. [24.5.157.48]) by mx.google.com with ESMTPSA id pc9sm2623360pdb.6.2015.05.04.21.46.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 May 2015 21:46:54 -0700 (PDT) From: Peter Crosthwaite X-Google-Original-From: Peter Crosthwaite To: qemu-devel@nongnu.org Date: Mon, 4 May 2015 21:45:04 -0700 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c02::234 Cc: peter.maydell@linaro.org, claudio.fontana@gmail.com, Peter Crosthwaite , agraf@suse.de, edgari@xilinx.com, edgar.iglesias@gmail.com, rth@twiddle.net Subject: [Qemu-devel] [PATCH 7/7] disas: arm: Use target_disas impl for monitor 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 As it is more fully featured. It has multi-endian, thumb and AArch64 support whereas the existing monitor disas support only has vanilla AA32 support. E.G. Running an AA64 linux kernel the follow -d in_asm disas happens (taget_disas()): IN: 0x0000000040000000: 580000c0 ldr x0, pc+24 (addr 0x40000018) 0x0000000040000004: aa1f03e1 mov x1, xzr However before this patch, disasing the same from the monitor: (qemu) xp/i 0x40000000 0x0000000040000000: 580000c0 stmdapl r0, {r6, r7} After this patch: (qemu) xp/i 0x40000000 0x0000000040000000: 580000c0 ldr x0, pc+24 (addr 0x40000018) Signed-off-by: Peter Crosthwaite Tested-by: Claudio Fontana Reviewed-by: Claudio Fontana --- disas.c | 48 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/disas.c b/disas.c index 498b05f..e1da40d 100644 --- a/disas.c +++ b/disas.c @@ -208,6 +208,27 @@ target_disas_set_info(int (**print_insn)(bfd_vma pc, disassemble_info *info), s->info.mach = bfd_mach_i386_i386; } *print_insn = print_insn_i386; +#elif defined(TARGET_ARM) + if (flags & 4) { + /* We might not be compiled with the A64 disassembler + * because it needs a C++ compiler; in that case we will + * fall through to the default print_insn_od case. + */ +#if defined(CONFIG_ARM_A64_DIS) + *print_insn = print_insn_arm_a64; +#endif + } else if (flags & 1) { + *print_insn = print_insn_thumb1; + } else { + *print_insn = print_insn_arm; + } + if (flags & 2) { +#ifdef TARGET_WORDS_BIGENDIAN + s->info.endian = BFD_ENDIAN_LITTLE; +#else + s->info.endian = BFD_ENDIAN_BIG; +#endif + } #elif defined(TARGET_SPARC) *print_insn = print_insn_sparc; #ifdef TARGET_SPARC64 @@ -271,28 +292,7 @@ void target_disas(FILE *out, CPUArchState *env, target_ulong code, s.info.buffer_vma = code; s.info.buffer_length = size; -#if defined(TARGET_ARM) - if (flags & 4) { - /* We might not be compiled with the A64 disassembler - * because it needs a C++ compiler; in that case we will - * fall through to the default print_insn_od case. - */ -#if defined(CONFIG_ARM_A64_DIS) - print_insn = print_insn_arm_a64; -#endif - } else if (flags & 1) { - print_insn = print_insn_thumb1; - } else { - print_insn = print_insn_arm; - } - if (flags & 2) { -#ifdef TARGET_WORDS_BIGENDIAN - s.info.endian = BFD_ENDIAN_LITTLE; -#else - s.info.endian = BFD_ENDIAN_BIG; -#endif - } -#elif defined(TARGET_PPC) +#if defined(TARGET_PPC) if ((flags >> 16) & 1) { s.info.endian = BFD_ENDIAN_LITTLE; } @@ -475,9 +475,7 @@ void monitor_disas(Monitor *mon, CPUArchState *env, s.info.buffer_vma = pc; -#if defined(TARGET_ARM) - print_insn = print_insn_arm; -#elif defined(TARGET_ALPHA) +#if defined(TARGET_ALPHA) print_insn = print_insn_alpha; #elif defined(TARGET_PPC) if (flags & 0xFFFF) {