LDT entries and WINE and Threads..

Julian Elischer julian at FreeBSD.org
Tue Jul 8 14:06:52 PDT 2003

I'm looking at this and I think that my interpretation is that 
WINE, under FreeBSD, blindly allocates LDT entries starting at location 17,
without looking to see if they are in use already..

My reason for thinking thios is that the string i386_get_ldt
only occurs once in the WINE source, and that is a prototype declaration
in ./work/wine-20030508/libs/wine/ldt.c (in the port)
In other words, it is not checking first..

This makes it "incompatible" with threads (both libthr and libkse)
and while this isn't an immediate problem, it WILL be a problem because
WINE uses OpenGL and OpenGL used threads (currently linuxthreads)
so it will eventually be a problem..

It seems to me that we could better serve the applications by 
having a differnt API for setting LDTs, and that the kernel
should keep track of which is free and which is not.
I would say that the API should be something like:

int selector = i386_make_ldte(type, base, limit, flags);
where "selector" is what you later stuff into a segment register.
there would be an equivalent
void i386_free_ldte(selector)

i386_get_ldt() could stay as it is I think..

The 'guts' of i386_make_ldte would be used directly by 
kse_create() and set the value of %gs that the upcall returns with.


More information about the freebsd-current mailing list