|
From: Maarten L. <m.b...@gm...> - 2008-12-05 22:23:40
Attachments:
patch
testcase.c
|
Hi all,
I've been playing around a bit with valgrind to see how well it would
support wine in 64 bits mode, but it seems I'm hitting a brick wall.
Wine 64-bits uses the arch_prctl call to be able to set a 64-bits
pointer to %gs for thread local storage.
I came up with the following patch.. well hack, but it is not sufficient
it seems. Valgrind still bombs out, this time with:
==2295== Conditional jump or move depends on uninitialised value(s)
==2295== at 0x4C5D97D: arch_prctl (in /lib/libc-2.7.so)
==2295== by 0x7BF01421: init_current_teb (pthread.c:152)
==2295== by 0x555B6BA: thread_init (thread.c:299)
==2295== by 0x5535633: __wine_process_init (loader.c:2597)
==2295== by 0x462F5FC: wine_init (loader.c:656)
==2295== by 0x7BF016C8: main (main.c:110)
vex amd64->IR: unhandled instruction bytes: 0x65 0x48 0x8B 0x4 0x25 0x30
==2295== Process terminating with default action of signal 4 (SIGILL)
==2295== Illegal opcode at address 0x7BF01446
==2295== at 0x7BF01446: get_current_teb (pthread.c:184)
==2295== by 0x555A91E: NtCurrentTeb (thread.c:1474)
==2295== by 0x5552419: ntdll_get_thread_data (ntdll_misc.h:194)
==2295== by 0x555405F: server_init_process (server.c:961)
==2295== by 0x555B6FC: thread_init (thread.c:308)
==2295== by 0x5535633: __wine_process_init (loader.c:2597)
==2295== by 0x462F5FC: wine_init (loader.c:656)
==2295== by 0x7BF016C8: main (main.c:110)
The code for NtCurrentTeb is:
extern inline struct _TEB * WINAPI NtCurrentTeb(void)
{
struct _TEB *teb;
__asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb));
return teb;
}
I'm guessing I will need to add another hack in
VEX/priv/guest-amd64/toIR.c but I don't exactly see what. Would any
valgrind dev be willing to help me with win64 TLS in wine64? I attached
a minimal testcase, in the hope that it makes it easier to fix
valgrind's handling of %gs.
Cheers,
Maarten.
|
Maarten Lankhorst wrote: > I've been playing around a bit with valgrind to see how well it would > support wine in 64 bits mode ... The VEX translator needs work to understand the segment prefixes (%gs, etc.) and the instructions which tend the x86 segment registers. I got valgrind+wine working enough on i386 to produce useful results in some cases. Patches were needed on both sides. For starters, see my series of 15 posts: [Valgrind-developers] valgrind(memcheck) + wine: patch 0/14 Summary and index 07/09/2008 09:53 AM and my wine patches archived in http://www.winehq.org/pipermail/wine-patches/2008-July/author.html It seemed to me that not too many people, neither in the valgrind camp nor in the wine camp, were enthusiastic about such efforts. -- |
|
From: Dan K. <da...@ke...> - 2008-12-06 01:53:49
|
On Fri, Dec 5, 2008 at 4:02 PM, John Reiser <jr...@bi...> wrote: > I got valgrind+wine working enough on i386 to produce useful results > in some cases. Patches were needed on both sides. For starters, > see my series of 15 posts: > [Valgrind-developers] valgrind(memcheck) + wine: patch 0/14 Summary and index > 07/09/2008 09:53 AM > and my wine patches archived in > http://www.winehq.org/pipermail/wine-patches/2008-July/author.html > It seemed to me that not too many people, neither in the valgrind camp > nor in the wine camp, were enthusiastic about such efforts. I'm enthusiastic :-) It seems pretty important to me. And it might be particularly helpful in bringing up win64 support. Unfortunately, I han't had time to help push John's patches upstream. I intend to have another stab at that sometime, but working on the native port of Chrome to Linux is taking up all my daytime hours. - Dan |