Date: Fri, 18 Jul 2003 16:41:38 -0700 (PDT) From: Julian Elischer <julian@elischer.org> To: Alexander Kabaev <ak03@gte.com> Cc: Marcel Moolenaar <marcel@xcllnt.net> Subject: Re: Rearranging kse mailbox Message-ID: <Pine.BSF.4.21.0307181623040.14696-100000@InterJet.elischer.org> In-Reply-To: <20030718181848.414318dd.ak03@gte.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 18 Jul 2003, Alexander Kabaev wrote: > On Fri, 18 Jul 2003 15:15:58 -0700 (PDT) > Julian Elischer <julian@elischer.org> wrote: > > > > Static TLS space preceeds the location pointed to by the tp (the %gs > > segment on x86). > > I wonder how this can work for multiple threads per KSE scenario. My mistake.. the 'tp' (thread pointer) on ia32 is defined as %gs:0 not %gs In other words, the thread pointer in ia32 has an extra level of indirection. The segment referred to by %gs contains the KSE mailbox and the first entry of that is the tp (thread pointer). to quote the spec: "Since the IA-32 is low on registers the thread register is encoded indirectly through the %gs segment register.. The only requirement about this register is that the actual thread pointer (tp) can be loaded from the absolute address 0 via the %gs register. The following code would load the thread poiinter in(to) the %eax register" " movl %gs:0 %eax " since in libthr %gs points to an entry in an array of pointers to thread structures, and in libkse %gs points to a kse mailbox, the first entry of which can be a pointer to the thread structure, both libraries are OK, and the static TLS storage would be allocated immediatly preceding that structure (in both cases). We could even 'fix' libc_r to set the %gs pointing to a single location and make that location always point at the current thread.. so Even that could be made to work. > > -- > Alexander Kabaev >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0307181623040.14696-100000>