From owner-freebsd-arch Wed Nov 22 12:34:15 2000 Delivered-To: freebsd-arch@freebsd.org Received: from pike.osd.bsdi.com (pike.osd.bsdi.com [204.216.28.222]) by hub.freebsd.org (Postfix) with ESMTP id 3B17837B4C5 for ; Wed, 22 Nov 2000 12:34:13 -0800 (PST) Received: from laptop.baldwin.cx (john@jhb-laptop.osd.bsdi.com [204.216.28.241]) by pike.osd.bsdi.com (8.11.0/8.9.3) with ESMTP id eAMKY4046218; Wed, 22 Nov 2000 12:34:04 -0800 (PST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Wed, 22 Nov 2000 12:34:15 -0800 (PST) From: John Baldwin To: Daniel Eischen Subject: Re: Thread-specific data and KSEs Cc: arch@FreeBSD.org, Arun Sharma Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 -- 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