Implementing TLS: step 1

Daniel Eischen eischen at vigrid.com
Thu Jun 19 16:11:53 PDT 2003


On Thu, 19 Jun 2003, Marcel Moolenaar wrote:
> On Thu, Jun 19, 2003 at 03:36:11PM -0700, Julian Elischer wrote:
> > Basically in libKSE there is what the kernel calls a thread, which is
> > interpretted in userspace as a virtual CPU, and this is used to 
> > run user level threads. The kernel sets the thread-pointer register
> > upcorrectly according to which of these "kernel visible threads"
> > is running. This is a legitimate use of the thread pointer register as
> > far as I see.  In 1:1 (libthr) the two things are the same and it stops
> > there.
> 
> It isn't on ia64. The thread pointer register has a predefined
> meaning. You cannot point it to anything else than the TLS in
> a process that has TLS. (if there's no TLS, the TP register is
> unused (=reserved)).
> 
> See also:
> 	http://www.freebsd.org/platforms/ia64/refs.html
> 
> I'm not sure the runtime specification pointed to there has the
> TLS info. I'll update the page ASAP if it's missing.

Please do.  All it says is the TP is the thread pointer and "The
usage of this register is ABI specific.  Programs conforming
to these conventions may not modify this register."  I don't see
how using it to point to a per-KSE structure abuses its intended
use.  You must have a different document in mind.  The one I
looked at was:

  http://developer.intel.com/design/itanium/downloads/24535803.pdf
  Titled: "Itanium Software Conventions and Runtime Architecture Guide",
  May 2001

Or perhaps I just didn't look in the correct section...  The
above quote was from section 5.2.

Thanks,

-- 
Dan Eischen



More information about the freebsd-threads mailing list