From owner-freebsd-threads@FreeBSD.ORG Thu Apr 3 18:22:18 2003 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 01C6637B412 for ; Thu, 3 Apr 2003 18:22:18 -0800 (PST) Received: from k6.locore.ca (k6.locore.ca [198.96.117.170]) by mx1.FreeBSD.org (Postfix) with ESMTP id 08AAF43F85 for ; Thu, 3 Apr 2003 18:22:17 -0800 (PST) (envelope-from jake@k6.locore.ca) Received: from k6.locore.ca (localhost.locore.ca [127.0.0.1]) by k6.locore.ca (8.12.8/8.12.8) with ESMTP id h342TCxS055611; Thu, 3 Apr 2003 21:29:12 -0500 (EST) (envelope-from jake@k6.locore.ca) Received: (from jake@localhost) by k6.locore.ca (8.12.8/8.12.8/Submit) id h342TCRU055610; Thu, 3 Apr 2003 21:29:12 -0500 (EST) Date: Thu, 3 Apr 2003 21:29:11 -0500 From: Jake Burkholder To: Peter Wemm Message-ID: <20030404022911.GA55016@locore.ca> References: <20030403233541.F02592A8A7@canning.wemm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030403233541.F02592A8A7@canning.wemm.org> User-Agent: Mutt/1.4i cc: Daniel Eischen cc: freebsd-threads@freebsd.org Subject: Re: 1:N threading 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: Fri, 04 Apr 2003 02:22:18 -0000 Apparently, On Thu, Apr 03, 2003 at 03:35:41PM -0800, Peter Wemm said words to the effect of; > Daniel Eischen wrote: > > > The patches are available: > > > > http://people.freebsd.org/~deischen/libpthread.diffs > > > > FYI, since this is a new mailing list, the above changes > > are meant to give libpthread M:N capability. > > > > I don't need testers; I have enough bugs that I know about > > to fix. > > + __asm__("movl %%gs, %0" : "=r" (id)); > + id >>= 3; > + if (id - NLDT < 0) > > There is a problem here, NLDT is kernel private and changes depending on > things like whether SMP is enabled or what the maximum number of cpus > is. > > You're trying to find if its a local or global selector, right? > What you really want is bit 2 which tells you which it is. > > #define ISLDT(s) ((s)&SEL_LDT) /* is it local or global */ > #define SEL_LDT 4 /* local descriptor table */ NLDT seems to be invariant, but we should have a sysctl or something to get the first LDT entry that is unused by the kernel. Libthr uses it in order to know which entry to start at. Jake