Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Nov 2000 16:52:08 -0800
From:      Jake Burkholder <jburkhol@home.com>
To:        John Baldwin <jhb@FreeBSD.ORG>
Cc:        Jonathan Lemon <jlemon@flugsvamp.com>, arch@FreeBSD.ORG, Daniel Eischen <eischen@vigrid.com>
Subject:   Re: Thread-specific data and KSEs 
Message-ID:  <20001122005208.95369BA7A@io.yi.org>
In-Reply-To: Message from John Baldwin <jhb@FreeBSD.ORG>  of "Tue, 21 Nov 2000 16:07:50 PST." <XFMail.001121160750.jhb@FreeBSD.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001122005208.95369BA7A>