123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- #ifndef _TLS_H
- #define _TLS_H
- #ifndef __ASSEMBLER__
- # include <pt-machine.h>
- # include <stdbool.h>
- # include <stddef.h>
- typedef union dtv
- {
- size_t counter;
- struct
- {
- void *val;
- bool is_static;
- } pointer;
- } dtv_t;
- typedef struct
- {
- dtv_t *dtv;
-
- void *private;
- } tcbhead_t;
- #endif
- #ifdef HAVE_TLS_SUPPORT
- # define USE_TLS 1
- # ifndef __ASSEMBLER__
- # include <sysdep.h>
- # define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
- # define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
- # define TLS_TCB_SIZE sizeof (tcbhead_t)
- # define TLS_TCB_ALIGN __alignof__ (tcbhead_t)
- # define TLS_PRE_TCB_SIZE sizeof (struct _pthread_descr_struct)
- # define TLS_DTV_AT_TP 1
- # define INSTALL_DTV(TCBP, DTVP) \
- (((tcbhead_t *) (TCBP))->dtv = (DTVP) + 1)
- # define INSTALL_NEW_DTV(DTV) \
- (((tcbhead_t *)__builtin_thread_pointer ())->dtv = (DTV))
- # define GET_DTV(TCBP) \
- (((tcbhead_t *) (TCBP))->dtv)
- # define TLS_INIT_TP(TCBP, SECONDCALL) \
- (__builtin_set_thread_pointer (TCBP), 0)
- # define THREAD_DTV() \
- (((tcbhead_t *)__builtin_thread_pointer ())->dtv)
- # undef THREAD_SELF
- # define THREAD_SELF \
- ((pthread_descr)__builtin_thread_pointer () - 1)
- # undef INIT_THREAD_SELF
- # define INIT_THREAD_SELF(DESCR, NR) \
- __builtin_set_thread_pointer ((struct _pthread_descr_struct *)(DESCR) + 1)
- # include <linuxthreads/descr.h>
- #define THREAD_GETMEM(descr, member) \
- ((void) sizeof (descr), THREAD_SELF->member)
- #define THREAD_GETMEM_NC(descr, member) \
- ((void) sizeof (descr), THREAD_SELF->member)
- #define THREAD_SETMEM(descr, member, value) \
- ((void) sizeof (descr), THREAD_SELF->member = (value))
- #define THREAD_SETMEM_NC(descr, member, value) \
- ((void) sizeof (descr), THREAD_SELF->member = (value))
- # endif
- #endif
- #endif
|