[MPlayer-dev-eng] Re: [Patch] Auto LDT creation in FreeBSD
Dan Eischen
eischen at vigrid.com
Thu Sep 4 03:07:27 CEST 2003
Dan Eischen wrote:
> Hi,
>
> I'm a FreeBSD developer working on our new threads library.
> The new threads library uses LDTs on x86 and this doesn't
> work with threaded applications/libraries that also make
> use of LDTs. To solve this problem, we massaged the
> i386_set_ldt() interface in FreeBSD to allow for dynamic/auto
> LDT creation. The kernel will find an unused LDT and
> return it to the caller. Using this interface allows
> both the threads library and other applications/libraries
> to use LDTs without clashing with one another.
>
> The patch to mplayer to allow it to work with our new
> threads library is here:
>
> http://www.freebsd.org/cgi/query-pr.cgi?pr=56358
>
> Can you guys please incorporate this or something like
> it into HEAD? Thanks.
BTW, the comment at the beginning of loader/ldt_keeper.c isn't
quite correct in its assumptions:
* This file MUST be in main library because LDT must
* be modified before program creates first thread
* - avifile includes this file from C++ code
* and initializes it at the start of player!
* it might sound like a hack and it really is - but
* as aviplay is deconding video with more than just one
* thread currently it's necessary to do it this way
* this might change in the future
The threads library implementation is free to use LDTs before
the first thread is created. Consider that main() _is_ the
initial thread and may have an LDT allocated for it when
the threads library is initialized. The threads library
may even be initialized before main() starts or any constructors
are run. I don't think an application can make any assumptions
about LDT usage. At any rate, this assumption doesn't hold
true under FreeBSD.
--
Dan Eischen
More information about the MPlayer-dev-eng
mailing list