From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DQYx0-0005Ui-9o for qemu-devel@nongnu.org; Tue, 26 Apr 2005 18:54:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DQYwz-0005Tp-4x for qemu-devel@nongnu.org; Tue, 26 Apr 2005 18:54:41 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DQYwy-0003Is-UA for qemu-devel@nongnu.org; Tue, 26 Apr 2005 18:54:40 -0400 Received: from [65.74.133.9] (helo=mail.codesourcery.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1DQYrn-00072c-4D for qemu-devel@nongnu.org; Tue, 26 Apr 2005 18:49:19 -0400 From: Paul Brook Date: Tue, 26 Apr 2005 23:45:26 +0100 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_HSsbCihhlMt7qwf" Message-Id: <200504262345.27326.paul@codesourcery.com> Subject: [Qemu-devel] [patch] Thumb disassembly Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --Boundary-00=_HSsbCihhlMt7qwf Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline The attached patch implements disassembly of arm thumb instructions in the debugging dumps. Paul --Boundary-00=_HSsbCihhlMt7qwf Content-Type: text/x-diff; charset="us-ascii"; name="patch.qemu_disas_thumb" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch.qemu_disas_thumb" Index: arm-dis.c =================================================================== RCS file: /cvsroot/qemu/qemu/arm-dis.c,v retrieving revision 1.2 diff -u -p -r1.2 arm-dis.c --- arm-dis.c 9 Jul 2003 17:10:32 -0000 1.2 +++ arm-dis.c 26 Apr 2005 22:41:39 -0000 @@ -1556,6 +1556,11 @@ print_insn_arm (pc, info) } is_thumb = force_thumb; + if (pc & 1) + { + is_thumb = 1; + pc &= ~(bfd_vma) 1; + } #if 0 if (!is_thumb && info->symbols != NULL) Index: disas.c =================================================================== RCS file: /cvsroot/qemu/qemu/disas.c,v retrieving revision 1.21 diff -u -p -r1.21 disas.c --- disas.c 23 Apr 2005 18:16:07 -0000 1.21 +++ disas.c 26 Apr 2005 22:41:39 -0000 @@ -108,8 +108,20 @@ bfd_vma bfd_getb32 (const bfd_byte *addr return (bfd_vma) v; } -/* Disassemble this for me please... (debugging). 'flags' is only used - for i386: non zero means 16 bit code */ +#ifdef TARGET_ARM +static int +print_insn_thumb1(bfd_vma pc, disassemble_info *info) +{ + return print_insn_arm(pc | 1, info); +} +#endif + +/* Disassemble this for me please... (debugging). 'flags' has teh following + values: + i386 - nonzero means 16 bit code + arm - nonzero means thumb code + other targets - unused + */ void target_disas(FILE *out, target_ulong code, target_ulong size, int flags) { target_ulong pc; @@ -137,7 +149,10 @@ void target_disas(FILE *out, target_ulon disasm_info.mach = bfd_mach_i386_i386; print_insn = print_insn_i386; #elif defined(TARGET_ARM) - print_insn = print_insn_arm; + if (flags) + print_insn = print_insn_thumb1; + else + print_insn = print_insn_arm; #elif defined(TARGET_SPARC) print_insn = print_insn_sparc; #elif defined(TARGET_PPC) --Boundary-00=_HSsbCihhlMt7qwf--