123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- #ifndef _TLS_H
- #define _TLS_H
- # include <pt-machine.h>
- #ifndef __ASSEMBLER__
- # include <stdbool.h>
- # include <stddef.h>
- # include <stdint.h>
- typedef union dtv
- {
- size_t counter;
- void *pointer;
- } dtv_t;
- typedef struct
- {
- void *tcb;
- dtv_t *dtv;
- void *self;
- } tcbhead_t;
- #if defined FLOATING_STACKS && defined HAVE_TLS_SUPPORT
- # include <sysdep.h>
- # include <linuxthreads/descr.h>
- # define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
- # define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
- # define TLS_TCB_SIZE sizeof (struct _pthread_descr_struct)
- # define TLS_TCB_ALIGN __alignof__ (struct _pthread_descr_struct)
- # define TLS_DTV_AT_TP 1
- # define INSTALL_DTV(descr, dtvp) \
- ((tcbhead_t *) (descr))->dtv = dtvp + 1
- # define INSTALL_NEW_DTV(dtv) \
- ({ struct _pthread_descr_struct *__descr; \
- THREAD_SETMEM (__descr, p_header.data.dtvp, (dtv)); })
- # define GET_DTV(descr) \
- (((tcbhead_t *) (descr))->dtv)
- # define TLS_INIT_TP(descr, secondcall) \
- ({ \
- void *_descr = (descr); \
- int result; \
- tcbhead_t *head = _descr; \
- \
- head->tcb = _descr; \
- \
- head->self = _descr; \
- \
- __asm__ ("ldc %0,gbr" : : "r" (_descr)); \
- \
- 0; \
- })
- # define THREAD_DTV() \
- ({ struct _pthread_descr_struct *__descr; \
- THREAD_GETMEM (__descr, p_header.data.dtvp); })
- #endif
- #endif
- #endif
|