qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [patch] Thumb symbol lookup
Date: Sat, 22 Oct 2005 04:27:57 +0100	[thread overview]
Message-ID: <200510220427.58362.paul@codesourcery.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 211 bytes --]

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


[-- Attachment #2: patch.qemu_disas_taddr --]
[-- Type: text/x-diff, Size: 1009 bytes --]

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;
 	}
     }

                 reply	other threads:[~2005-10-22  3:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200510220427.58362.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).