From owner-freebsd-arch Tue Nov 21 16:52:11 2000 Delivered-To: freebsd-arch@freebsd.org Received: from io.yi.org (h24-69-199-88.gv.shawcable.net [24.69.199.88]) by hub.freebsd.org (Postfix) with ESMTP id 57C9737B4CF; Tue, 21 Nov 2000 16:52:09 -0800 (PST) Received: from io.yi.org (localhost.gvcl1.bc.wave.home.com [127.0.0.1]) by io.yi.org (Postfix) with ESMTP id 95369BA7A; Tue, 21 Nov 2000 16:52:08 -0800 (PST) X-Mailer: exmh version 2.1.1 10/15/1999 To: John Baldwin Cc: Jonathan Lemon , arch@FreeBSD.ORG, Daniel Eischen Subject: Re: Thread-specific data and KSEs In-Reply-To: Message from John Baldwin of "Tue, 21 Nov 2000 16:07:50 PST." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 21 Nov 2000 16:52:08 -0800 From: Jake Burkholder Message-Id: <20001122005208.95369BA7A@io.yi.org> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > On 21-Nov-00 Jonathan Lemon wrote: > > On Tue, Nov 21, 2000 at 06:51:59PM -0500, Daniel Eischen wrote: > >> I'm going to start working on the user-side of the new threads > >> library. I need to be able to quickly get at the current KSE > >> (or perhaps KSEG). Can we define a register on each architecture > >> that should not be used by FreeBSD ABI compliant applications? > >> The register doesn't have to be 32 bits or larger, just large > >> enough to hold the maximum number of KSEs (or KSEGs). > > > > Um. On a i386 I'm not sure this will be practical, there aren't > > a whole lot of architecturally visible registers for use by the > > application. > > Agreed. Just use a regulare per-CPU data variable the same way that 'curproc' > is implemented right now. > Uhh, the way curproc is implemented now is basically what he's talking about. Its addressable through the %fs register, but I don't know how you'd set this up to work from userland. Can you even change the segment registers in user mode? My suggestion would be to have the stacks aligned to some power of 2 boundary and put your per-thread pointer at the top of the stack. Then you can get at it like this: ((stack pointer + (stack size)) & ~(stack size - 1)) - sizeof(void *) and you don't need to know which cpu you're on. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message