Re: thread-local storage, especially on x86
Re: thread-local storage, especially on x86
- Subject: Re: thread-local storage, especially on x86
- From: Alexei Kosut <email@hidden>
- Date: Mon, 12 Sep 2005 11:55:20 -0700
On Sep 11, 2005, at 10:35 AM, Gary Byers wrote:
The Darwin kernel offers a function - thread_set_user_ldt() - which
allows user-level code to set up a segment selector which can be
loaded into %fs and used to address a specified address range. (The
name of this function may be a little misleading, since it seems that
that segment descriptor is shared by all threads in the calling
process.) Comments prefacing that function suggest the possibility
(if I understand correctly) of allocating and maintaing this selector
on a per-thread basis; it's much easier for me to imagine that
behavior being useful than it is for me to imagine a use for the
current behavior.
thread_set_user_ldt is per-thread, not per-process. The kernel re-
uses the same selector for multiple threads, but changes the segment
descriptors in the LDT during a context switch. Each thread gets its
own area.
Note that the thread_set_user_ldt kernel function and it's Mach trap
userspace equivalent are not part of the Mac OS X or Darwin supported
API, and may change from release to release.
Alexei
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden