cvs commit: src/sys/i386/i386 sys_machdep.c

Daniel Eischen eischen at vigrid.com
Tue Aug 5 17:55:35 PDT 2003


On Tue, 5 Aug 2003, Julian Elischer wrote:

> Warning warning warning....
> 
> The code that Dan shows ends up pointing %gs to the struct pthread
> structure.. however the ELF i386 (and amd64) ABI for TLS assumes that it
> points to a POINTER to the TCB (is that the same thing?). If the TCB
> (Thread control block) is the same thing as the struct pthread then you
> should probably make the first entry be a pointer to istelf or the TLS
> code generated by the linker (when enabled) will point to the wrong
> thing..

For libthr, the struct pthread isn't really the thread control
block.  struct pthread is MI, so you can't rely on it having
a layout that will satisfy all the ABIs.  It isn't correct
now for i386.

libthr will likely need the same sort of arch-dependent
hooks that libpthread just grew (minus the struct kcb
stuff).  The patch I posted just addresses auto-ldt
allocation.

> 
> With the array there is now it just happens to come out right.

But it doesn't really, since the first slot of struct pthread
is not a pointer to the dynamic TLS.

-- 
Dan Eischen



More information about the freebsd-threads mailing list