From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KloDX-0004NF-WA for qemu-devel@nongnu.org; Fri, 03 Oct 2008 13:13:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KloDV-0004N3-QY for qemu-devel@nongnu.org; Fri, 03 Oct 2008 13:13:26 -0400 Received: from [199.232.76.173] (port=41199 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KloDV-0004N0-KE for qemu-devel@nongnu.org; Fri, 03 Oct 2008 13:13:25 -0400 Received: from mu-out-0910.google.com ([209.85.134.186]:43695) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KloDV-0002Tu-7K for qemu-devel@nongnu.org; Fri, 03 Oct 2008 13:13:25 -0400 Received: by mu-out-0910.google.com with SMTP id w1so2189031mue.2 for ; Fri, 03 Oct 2008 10:13:24 -0700 (PDT) Message-ID: Date: Fri, 3 Oct 2008 20:13:24 +0300 From: "Blue Swirl" Subject: Re: [Qemu-devel] [PATCH] Fix symbol lookup for mips64* targets In-Reply-To: <48E5EF45.6070900@mail.berlios.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <48E52067.6080408@mail.berlios.de> <20081002215256.GD13440@networkno.de> <48E5EF45.6070900@mail.berlios.de> 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 On 10/3/08, Stefan Weil wrote: > Thiemo Seufer schrieb: > > > Stefan Weil wrote: > > > >> For 64 bit targets, lookup_symbol() compares a 64-bit target address > >> with a 32 bit symbol address. This only works for addresses less than 2^32. > >> > >> MIPS64 kernels use addresses larger than 0xffffffff80000000, > >> so qemu.log never shows symbolic names. > >> > >> My patch is a workaround which works with Qemu's 32 bit address hack. > >> Please apply it to Qemu trunk. > >> > >> Maybe a better solution would use symbol addresses without shortening > >> them to 32 bits. > >> > >> Regards > >> Stefan > >> > >> > > > > > >> Fix symbol lookup for mips64* targets. > >> > >> Signed-off-by: Stefan Weil > >> > >> Index: disas.c > >> =================================================================== > >> --- disas.c (Revision 5400) > >> +++ disas.c (Arbeitskopie) > >> @@ -309,6 +309,11 @@ > >> struct syminfo *s; > >> target_ulong addr; > >> > >> +#if defined(TARGET_MIPS64) > >> + /* Adresses in syminfos are 32 bit values. */ > >> + orig_addr &= 0xffffffff; > >> > > > > This isn't true in general, not all MIPS64 kernels use the -msym32 > > optimization. > > > > > > Thiemo > > Nor does my MIPS64 kernel: it uses 64 bit symbol addresses. > > The current Qemu loads these addresses, reduces them to 32 bit and > stores the reduced 32 bit addresses. So the 32 bit addresses are made > by Qemu. They have nothing to do with kernel compile flags. > > In lookup_symbol, Qemu compares real 64 bit addresses to the reduced > 32 bit addresses which does not work for addresses larger than 2^32. > x86_64 kernels have no problem because they have small addresses. > MIPS64 kernels have a problem because they have large addresses. > I don't know whether ppc64 and sparc64 work, maybe someone who > has such kernels can do a "nm vmlinux". Sparc64 kernel is located below 4G. > My patch is only a workaround which reduces the real 64 bit addresses > to 32 bit, too. > > I suggest to apply it to Qemu trunk (because it is small and it improves > the current situation) and to add a note to the TODO list: > - store symbol addresses in full size (important for 64 bit targets) We could be more ambitious and make the symbol size depend on target. It does not look too hard.