Following Marcus Meissner's advice how to build a WoW64 setup (thanks!), I have succeeded in building a set of co-installable i386/amd64 Debian packages. Those won't make it into the "wheezy" release as I was just a bit late for the freeze, but I have uploaded packages to experimental.
What didn't work was building the 64-bits of wine on Debian/kfreebsd-amd64 (Debian userland including GNU libc on a FreeBSD kernel): <https://buildd.debian.org/status/fetch.php%3Fpkg%3Dwine%26arch%3Dkfreebsd-amd64%26ver%3D1.4.1-1.2%26stamp%3D1341358832> Apparently the reason is that the uc_mcontext structure does not store the DS, ES, FS, and GS registers. After I made the changes below, everything compiled, but how useful is the result? Are those registers contained in uc_mcontext on "plain" FreeBSD? Cheers, -Hilko
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c index 7d2b8d5..8190f03 100644 --- a/dlls/ntdll/signal_x86_64.c +++ b/dlls/ntdll/signal_x86_64.c @@ -183,10 +183,12 @@ extern int arch_prctl(int func, void *ptr); #define R15_sig(context) ((context)->uc_mcontext.mc_r15) #define CS_sig(context) ((context)->uc_mcontext.mc_cs) +#if 0 #define DS_sig(context) ((context)->uc_mcontext.mc_ds) #define ES_sig(context) ((context)->uc_mcontext.mc_es) #define FS_sig(context) ((context)->uc_mcontext.mc_fs) #define GS_sig(context) ((context)->uc_mcontext.mc_gs) +#endif #define SS_sig(context) ((context)->uc_mcontext.mc_ss) #define EFL_sig(context) ((context)->uc_mcontext.mc_rflags) @@ -1415,8 +1417,16 @@ static void save_context( CONTEXT *context, const ucontext_t *sigcontext ) context->R15 = R15_sig(sigcontext); context->Rip = RIP_sig(sigcontext); context->SegCs = CS_sig(sigcontext); +#ifdef FS_sig context->SegFs = FS_sig(sigcontext); +#else + __asm__("movw %%fs,%0" : "=m" (context->SegFs)); +#endif +#ifdef GS_sig context->SegGs = GS_sig(sigcontext); +#else + __asm__("movw %%gs,%0" : "=m" (context->SegGs)); +#endif context->EFlags = EFL_sig(sigcontext); #ifdef DS_sig context->SegDs = DS_sig(sigcontext); @@ -1467,8 +1477,12 @@ static void restore_context( const CONTEXT *context, ucontext_t *sigcontext ) R15_sig(sigcontext) = context->R15; RIP_sig(sigcontext) = context->Rip; CS_sig(sigcontext) = context->SegCs; +#ifdef FS_sig FS_sig(sigcontext) = context->SegFs; +#endif +#ifdef GS_sig GS_sig(sigcontext) = context->SegGs; +#endif EFL_sig(sigcontext) = context->EFlags; #ifdef DS_sig DS_sig(sigcontext) = context->SegDs;