This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: libgcj and the NPTL posix threads implementation


I'm a bit confused, in part because I'm an X86 assembly amateur.

I assume both of the proposals below retrieve a value stored at an offset from
%gs?  (What's "move"?  Is it different from "mov" or a typo?) Won't %gs itself do as
a thread-specific value?  Doesn't that always point to a thread-specific
area, independent of the thread package and tls implementation?

Hans

> -----Original Message-----
> From: Anthony Green [mailto:green@redhat.com]
> Sent: Monday, March 01, 2004 2:00 PM
> To: Jeff Sturm
> Cc: Boehm, Hans; 'Michael Koch'; java@gcc.gnu.org
> Subject: RE: libgcj and the NPTL posix threads implementation
> 
> 
> On Mon, 2004-03-01 at 13:08, Jeff Sturm wrote:
> > On Sun, 29 Feb 2004, Anthony Green wrote:
> > > + inline _Jv_ThreadId_t
> > > + _Jv_ThreadSelf (void)
> > > + {
> > > +   size_t id;
> > > +   asm ("mov %%gs:0x8, %0" : "=r"(id));
> > > +   return id;
> > > + }
> > 
> > I'm curious what the special significance of offset 0x8 might be.
> 
> I believe that returns the posix thread ID, however, as you say...
> 
> >   As I
> > understand TLS on glibc, "move %gs:0, %eax" would place the 
> thread pointer
> > in %eax, which is sufficient for these purposes as a 
> pointer to an opaque
> > per-thread structure.
> 
> Yes, that would work as well.
> 
> AG
> 
> -- 
> Anthony Green <green@redhat.com>
> Red Hat, Inc.
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]