WINE vs. FreeBSD

Tijl Coosemans tijl at
Sun Jul 23 16:31:49 UTC 2006

On Sunday 23 July 2006 11:18, Divacky Roman wrote:
> On Sat, Jul 22, 2006 at 07:15:35PM -0400, Daniel Eischen wrote:
> > I think it is because WINE stomps on or TLS.  Nothing we can
> > do about that except patch wine so it doesn't.  Look at the
> > console messages for:
> >
> >   Warning: pid XXX used static ldt allocation

Wine's LDT code could probably be improved to bring in LDT_AUTO_ALLOC 
and/or use the GDT entry for %fs through i386_set_fsbase() for TLS 
instead of allocating an LDT entry (per thread). But, I don't think 
this is currently a problem. As far as I can see FreeBSD's TLS support 
doesn't use the LDT (anymore) so wine's static ldt allocation can't 
possibly interfere with it.

> I dont know details but judging from what linux does I think it might
> be that wine requires more then one GDT entry for TLS areas. at least
> comment in linux sources suggests so.
> linux has 3 GDT entries for TLS while fbsd just 1.

Wine on FreeBSD doesn't use the GDT (yet?). It allocates LDT entries for 
TLS which should work just as well.

In any case, FreeBSD and Linux don't differ that much in this.

FreeBSD has 2 GDT entries available, one for %gs which is used by the 
threading libs (following I 
suppose) and one for %fs which is used by win32 code so wine could use 
this instead of the LDT way. The related (undocumented) libc functions 
are i386_get_fsbase, i386_set_fsbase, i386_get_gsbase and 

Linux reserves 3 GDT entries, that can be manipulated through one 
syscall (set_thread_area) and then it's up to the user to point %fs 
or %gs (or some other selector?) to one of these entries.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-hackers mailing list