qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Fix symbol lookup for mips64* targets


From: Blue Swirl
Subject: Re: [Qemu-devel] [PATCH] Fix symbol lookup for mips64* targets
Date: Fri, 3 Oct 2008 20:13:24 +0300

On 10/3/08, Stefan Weil <address@hidden> 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 <address@hidden>
>  >>
>  >> 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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]