From owner-freebsd-threads@FreeBSD.ORG Mon Mar 29 15:40:58 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EEAC516A4CE for ; Mon, 29 Mar 2004 15:40:58 -0800 (PST) Received: from sccrmhc12.comcast.net (sccrmhc12.comcast.net [204.127.202.56]) by mx1.FreeBSD.org (Postfix) with ESMTP id 965D343D2D for ; Mon, 29 Mar 2004 15:40:58 -0800 (PST) (envelope-from julian@elischer.org) Received: from interjet.elischer.org ([24.7.73.28]) by comcast.net (sccrmhc12) with ESMTP id <2004032923405701200n82uqe>; Mon, 29 Mar 2004 23:40:57 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id PAA31562; Mon, 29 Mar 2004 15:49:56 -0800 (PST) Date: Mon, 29 Mar 2004 15:49:54 -0800 (PST) From: Julian Elischer To: Peter Wemm In-Reply-To: <200403291518.33559.peter@wemm.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-threads@freebsd.org Subject: Re: Thread Local Storage X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2004 23:40:59 -0000 On Mon, 29 Mar 2004, Peter Wemm wrote: > On Monday 29 March 2004 02:36 pm, Daniel Eischen wrote: > [..] > > > > > You don't need a syscall at thread switch if you do something > > > > > like: > > > > > > > > > > _thread_switch(...) > > > > > { > > > > > if (tcb doesn't have LDT entry) { > > > > > if (!free LDT entries) > > > > > steal LDT entry from non-running thread; > > > > > allocate LDT entry and point it at TLS goop for tcb. > > > > > } > > > > > load_gs(tcb's LDT sel); > > > > > > > > That's a system call on amd64. > > > > > > I'm not quite up to speed on amd64. So in 64-bit mode it doesn't > > > really have an LDT at all, is that right? > > > > I'm not sure, but you have to make a system call to set it > > or it's equivalent (amd64_set_fsbase()). > > Correct. There are two ways to do these things on this cpu. One is to > use descriptor tables. The catch is that using descriptor tables > forces a 4GB limit. It won't wrap around. The other way is to write > to the MSRs for fsbase/gsbase. But the downside of that is that is a > priviliged operation and needs to be done in supervisor mode. > > I don't *have* an LDT on the amd64 kernel. I'm dreading having to > emulate the i386 sysarch LDT stuff already. Hopefully we can migrate to the GDT idea.. > -- > Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com > "All of this is for nothing if we don't go to the stars" - JMS/B5 > _______________________________________________ > freebsd-threads@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-threads > To unsubscribe, send any mail to "freebsd-threads-unsubscribe@freebsd.org" >