Re: nss and pthreads and wine, oh my!

From: Craig Boston <craig_at_xfoil.gank.org>
Date: Wed, 10 Dec 2003 10:56:36 -0600
On Wednesday 10 December 2003 09:56 am, Daniel Eischen wrote:
> The mplayer patch is to make it use LDT_AUTO_ALLOC.  The ldt
> fiddling code (taken from wine) doesn't use LDT_AUTO_ALLOC,
> so I had to make it use it.  See if you can patch wine to
> use LDT_AUTO_ALLOC; it shouldn't be calling i386_set_ldt()
> any other way.

Ah, I see...  Makes sense.

Unfortunately I'm not having much success patching wine in this fashion.  The 
problems are two-fold:

1. The internal API used by wine wants to be able to allocate ldts before 
actually calling i386_set_ldt.  From what I can see, it's never actually used 
in this fasion -- the caller always uses set_ldt right after allocating one.  
I could probably fix this but it would involve making a fairly fundamental 
change to the internals of wine.  Still, it might be ugly-but-doable as a 
BSD-local patch.

Question: Would using some dummy descriptor in i386_set_ldt just to allocate 
the selector do any harm, with the understanding that it would be reset to 
something valid before it's actually used?

2. The wine_ldt_alloc_entries() function takes a count parameter, which is 
documented as "Allocate a number of consecutive ldt entries, without setting 
the LDT contents".  From my perusal of the kernel sources, it seems that 
LDT_AUTO_ALLOC only works when num_sels==1 and doesn't guarantee that 
subsequent allocations are consecutive.  This is a harder problem as it's 
used for emulating a Windows API call "AllocSelectorArray" so we really don't 
have any control over how it's used :(

I'll see what I can come up with for #1.  Any thoughts or comments about how 
to tackle #2 would be appreciated.

Craig
Received on Wed Dec 10 2003 - 07:56:43 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:33 UTC