WINE tester needed.. (for 5.x)
julian at elischer.org
Tue Jul 29 16:02:54 PDT 2003
The below patch from David Xu changes the LDT allocation routines
to allow the kernel to allocate and free individual LDT entries
as needed. This cleans up the LDT allocation needed in
libkse and libthr, however WINE is the other user of this interface.
(I don't know about the DOS EMULATOR)
This change should also make it possible to rewrite teh FreeBSD WINE
LDT handling code to be a lot simpler.. (you just allocate an LDT as you
need it and let the kernel decide which one you get.
This is important because eventually
WINE will want to compile with pthreads and the two libraries will both
want to allocate LDTs. Currently WINE just "Splats" it's LDTEs in
without even looking to see if they are already in use..
Switching to the new interface should allow Wine to co-exist with libthr
and libkse as well as such things as the Nvidia OpenGL
Basically.. if you ask for a single LDTE at and give a start offset of 0
then it will allocate it for you, and fill it with the
(checked) contents that you provide. If you give a NULL contents
pointer, but give a LDTE offset, it will free that LDTE for you.
If you give a 0 'Number' of LDTEs to free
it will free all of them.
This is backwards compatible with teh current code.
but we'd like someone who can ruun wine to check that it still runs when
these patches are applied to the kernel.
---------- Forwarded message ----------
Date: Tue, 29 Jul 2003 08:55:44 -0400 (EDT)
From: Daniel Eischen <eischen at vigrid.com>
Reply-To: deischen at freebsd.org
To: David Xu <davidxu at viatech.com.cn>
Cc: Julian Elischer <julian at elischer.org>
Subject: Re: KSD/TSD take 2 (was: KSE critical regions)
On Tue, 29 Jul 2003, David Xu wrote:
> I have changed kernel LDT code to allow userland to
> allocate a free entry.
> here is the patch:
> I have added some features to
> i386_set_ldt(int start, union descriptor *descs, int num):
> 1) if descs == NULL, it is used to free LDT entries.
> if start == -1 and num == 0, then whole table will be freed.
> otherwise, entries between start and start+num will be freed.
> 2) if descs != NULL, and if start is -1 and num is 1,
> kernel will find a free LDT entry and copy descs into
> kernel LDT entry.
It would be nicer if we could use start = 0; it seems to
make more sense. But I guess we shouldn't rely on 0 always
being unavailable as an LDT.
> 3) other conditions keep old semantics.
Looks OK to me.
> A patch for libkse to use these new features is available:
> ksd.c becomes rather simple, so I am considering whether
> we still need to force kernel to allocate LDT for userland,
> because there is locking problem and add a group of MD functions
> to every plaform, which always causes trouble and encounter some
> support for AMD64 is in the patch too, it should let 1:1
> run on AMD 64, only one line code changed.
This is true. I think it should be OK to let library do it.
As you say, it eliminates the need for the kernel to have
another MD interface for kse setup. I suppose you could
have cpu_set_upcall() handle it, as long as there was a
link from the kse_upcall to the kse, and the ksd addr
and size was added to the kse. But it's not a problem
to handle it in libpthread, and it would be pretty
simple with the new interface.
> I hope julian can test sys_machdep.c.diff on WINE to
> see if I will break anything.
More information about the freebsd-emulation