From e24c161e9d16483a1d97402557f7756e26afb6cf Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 13 Jun 2007 00:00:00 +0200 Subject: TLS support for libthreads. * libthreads/cprocs.c (cproc_create): Call into glibc to allocate static TLS block. * libthreads/cthread_internals.h (tcbhead_t): New structure; as in glibc. (cproc_setup): Take TCB parameter. (_dl_allocate_tls): Declare; from glibc. * libthreads/alpha/thread.c (cproc_setup): Compile-time warning for missing TLS support. * libthreads/i386/thread.c (cproc_setup): Imlement TLS support. --- libthreads/cthread_internals.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'libthreads/cthread_internals.h') diff --git a/libthreads/cthread_internals.h b/libthreads/cthread_internals.h index 7c557428..84264004 100644 --- a/libthreads/cthread_internals.h +++ b/libthreads/cthread_internals.h @@ -147,6 +147,14 @@ # endif #endif +/* Type of the TCB. */ +typedef struct +{ + void *tcb; /* Points to this structure. */ + void *dtv; /* Vector of pointers to TLS data. */ + thread_t self; /* This thread's control port. */ +} tcbhead_t; + /* * Low-level thread implementation. * This structure must agree with struct ur_cthread in cthreads.h @@ -291,4 +299,10 @@ extern void cproc_prepare(cproc_t _child, void (*cthread_body_pc)()); extern void cproc_setup(cproc_t _child, thread_t _mach_thread, - void (*_routine)(cproc_t)); + tcbhead_t *tcb, void (*_routine)(cproc_t)); + + +/* From glibc. */ + +/* Dynamic linker TLS allocation. */ +extern void *_dl_allocate_tls(void *); -- cgit v1.2.3