From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ETA3A-00058I-Ek for qemu-devel@nongnu.org; Fri, 21 Oct 2005 23:28:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ETA38-00056L-Ph for qemu-devel@nongnu.org; Fri, 21 Oct 2005 23:28:04 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ETA38-00056I-Kj for qemu-devel@nongnu.org; Fri, 21 Oct 2005 23:28:02 -0400 Received: from [65.74.133.11] (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 1ETA38-0003Hb-JW for qemu-devel@nongnu.org; Fri, 21 Oct 2005 23:28:02 -0400 From: Paul Brook Date: Sat, 22 Oct 2005 04:27:57 +0100 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_+GbWD5XVwE+lI8P" Message-Id: <200510220427.58362.paul@codesourcery.com> Subject: [Qemu-devel] [patch] Thumb symbol lookup 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=_+GbWD5XVwE+lI8P Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Some Arm ABIs use the low bit of a symbol address to mark thumb function symbols (instruction are always halfword aligned). The patch below makes lookup_symbol ignore this bit when comparing addresses. Paul --Boundary-00=_+GbWD5XVwE+lI8P Content-Type: text/x-diff; charset="us-ascii"; name="patch.qemu_disas_taddr" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch.qemu_disas_taddr" Index: disas.c =================================================================== RCS file: /cvsroot/qemu/qemu/disas.c,v retrieving revision 1.25 diff -u -p -r1.25 disas.c --- disas.c 23 Jul 2005 22:39:53 -0000 1.25 +++ disas.c 22 Oct 2005 03:23:10 -0000 @@ -279,6 +279,7 @@ const char *lookup_symbol(target_ulong o /* Hack, because we know this is x86. */ Elf32_Sym *sym; struct syminfo *s; + target_ulong addr; for (s = syminfos; s; s = s->next) { sym = s->disas_symtab; @@ -290,8 +291,13 @@ const char *lookup_symbol(target_ulong o if (ELF_ST_TYPE(sym[i].st_info) != STT_FUNC) continue; - if (orig_addr >= sym[i].st_value - && orig_addr < sym[i].st_value + sym[i].st_size) + addr = sym[i].st_value; +#ifdef TARGET_ARM + /* The bottom address bit marks a Thumb symbol. */ + addr &= ~(target_ulong)1; +#endif + if (orig_addr >= addr + && orig_addr < addr + sym[i].st_size) return s->disas_strtab + sym[i].st_name; } } --Boundary-00=_+GbWD5XVwE+lI8P--