Date: Wed, 22 Nov 2000 12:34:15 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: Daniel Eischen <eischen@vigrid.com> Cc: arch@FreeBSD.org, Arun Sharma <arun@sharmas.dhs.org> Subject: Re: Thread-specific data and KSEs Message-ID: <XFMail.001122123415.jhb@FreeBSD.org> In-Reply-To: <Pine.SUN.3.91.1001122071825.3503A-100000@pcnet1.pcnet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 22-Nov-00 Daniel Eischen wrote: > On Mon, 20 Nov 2000, Arun Sharma wrote: >> Linux threads implementation uses %gs to store a pointer to >> the thread structure. A segment register can only be loaded >> with a selector that points to a valid entry in a LDT or a GDT >> on x86. > > Hmm, OK. So if I initially load the LDT with entries (they > don't have to point to anything unless I want to really > use gs to point to something), then I can use gs. Entries in the LDT have to point to something, that's all they can do. You could in theory make them all be zero length or some such, but you might need more thread-local storage than a single 16-bit integer that would require 4k of backing store to avoid causing seg faults. If each KSE has its own LDT, on the other hand, then you can use a fixed entry in the LDT to point to the thread-local data (so that %gs doesn't have to change) much like we do for per-CPU data with %fs in the kernel. You can then use stuff similar to machine/globals.h to access each variable in the threaddata struct. -- John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.001122123415.jhb>