Back to index

glibc  2.9
Classes | Defines | Typedefs | Functions
tls.h File Reference
#include <dl-sysdep.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <sysdep.h>
#include <nptl/descr.h>

Go to the source code of this file.

Classes

union  dtv
struct  tcbhead_t
struct  dtv.pointer

Defines

#define TLS_DTV_AT_TP   1
#define TLS_MULTIPLE_THREADS_IN_TCB   1
#define TLS_INIT_TCB_SIZE   0
#define TLS_INIT_TCB_ALIGN   __alignof__ (struct pthread)
#define TLS_TCB_SIZE   0
#define TLS_TCB_ALIGN   __alignof__ (struct pthread)
#define TLS_PRE_TCB_SIZE
#define PT_THREAD_POINTER   PT_R2
#define TLS_TCB_OFFSET   0x7000
#define INSTALL_DTV(tcbp, dtvp)   ((tcbhead_t *) (tcbp))[-1].dtv = dtvp + 1
#define INSTALL_NEW_DTV(dtv)   (THREAD_DTV() = (dtv))
#define GET_DTV(tcbp)   (((tcbhead_t *) (tcbp))[-1].dtv)
#define TLS_INIT_TP(tcbp, secondcall)   (__thread_register = (void *) (tcbp) + TLS_TCB_OFFSET, NULL)
#define THREAD_DTV()   (((tcbhead_t *) (__thread_register - TLS_TCB_OFFSET))[-1].dtv)
#define THREAD_SELF
#define DB_THREAD_SELF
#define THREAD_GETMEM(descr, member)   ((void)(descr), (THREAD_SELF)->member)
#define THREAD_GETMEM_NC(descr, member, idx)   ((void)(descr), (THREAD_SELF)->member[idx])
#define THREAD_SETMEM(descr, member, value)   ((void)(descr), (THREAD_SELF)->member = (value))
#define THREAD_SETMEM_NC(descr, member, idx, value)   ((void)(descr), (THREAD_SELF)->member[idx] = (value))
#define THREAD_SET_STACK_GUARD(value)
#define THREAD_COPY_STACK_GUARD(descr)
#define THREAD_GET_POINTER_GUARD()
#define THREAD_SET_POINTER_GUARD(value)   (THREAD_GET_POINTER_GUARD () = (value))
#define THREAD_COPY_POINTER_GUARD(descr)
#define NO_TLS_OFFSET   -1
#define THREAD_GSCOPE_FLAG_UNUSED   0
#define THREAD_GSCOPE_FLAG_USED   1
#define THREAD_GSCOPE_FLAG_WAIT   2
#define THREAD_GSCOPE_RESET_FLAG()
#define THREAD_GSCOPE_SET_FLAG()
#define THREAD_GSCOPE_WAIT()   GL(dl_wait_lookup_done) ()

Typedefs

typedef union dtv dtv_t

Functions

register void *__thread_register __asm__ ("r2")

Class Documentation

union dtv

Definition at line 30 of file tls.h.

Class Members
size_t counter
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct dtv pointer
struct tcbhead_t

Definition at line 41 of file tls.h.

Collaboration diagram for tcbhead_t:
Class Members
void * __private
dtv_t * dtv
int gscope_flag
int multiple_threads
uintptr_t pointer_guard
void * private
int private_futex
void * self
uintptr_t stack_guard
uintptr_t sysinfo
void * tcb
unsigned long int vgetcpu_cache
struct dtv.pointer

Definition at line 34 of file tls.h.

Class Members
bool is_static
void * val

Define Documentation

#define DB_THREAD_SELF
Value:
REGISTER (32, 32, PT_THREAD_POINTER * 4,                             \
           - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)                      \
  REGISTER (64, 64, PT_THREAD_POINTER * 8,                                  \
           - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)

Definition at line 137 of file tls.h.

#define GET_DTV (   tcbp)    (((tcbhead_t *) (tcbp))[-1].dtv)

Definition at line 119 of file tls.h.

#define INSTALL_DTV (   tcbp,
  dtvp 
)    ((tcbhead_t *) (tcbp))[-1].dtv = dtvp + 1

Definition at line 112 of file tls.h.

#define INSTALL_NEW_DTV (   dtv)    (THREAD_DTV() = (dtv))

Definition at line 116 of file tls.h.

#define NO_TLS_OFFSET   -1

Definition at line 181 of file tls.h.

#define PT_THREAD_POINTER   PT_R2

Definition at line 95 of file tls.h.

#define THREAD_COPY_POINTER_GUARD (   descr)
Value:
(((tcbhead_t *) ((char *) (descr)                                    \
                   + TLS_PRE_TCB_SIZE))[-1].pointer_guard                   \
     = THREAD_GET_POINTER_GUARD())

Definition at line 174 of file tls.h.

#define THREAD_COPY_STACK_GUARD (   descr)
Value:
(((tcbhead_t *) ((char *) (descr)                                    \
                   + TLS_PRE_TCB_SIZE))[-1].stack_guard              \
     = ((tcbhead_t *) ((char *) __thread_register                           \
                     - TLS_TCB_OFFSET))[-1].stack_guard)

Definition at line 162 of file tls.h.

#define THREAD_DTV ( )    (((tcbhead_t *) (__thread_register - TLS_TCB_OFFSET))[-1].dtv)

Definition at line 128 of file tls.h.

Value:
(((tcbhead_t *) ((char *) __thread_register                                 \
                   - TLS_TCB_OFFSET))[-1].pointer_guard)

Definition at line 169 of file tls.h.

#define THREAD_GETMEM (   descr,
  member 
)    ((void)(descr), (THREAD_SELF)->member)

Definition at line 144 of file tls.h.

#define THREAD_GETMEM_NC (   descr,
  member,
  idx 
)    ((void)(descr), (THREAD_SELF)->member[idx])

Definition at line 147 of file tls.h.

#define THREAD_GSCOPE_FLAG_UNUSED   0

Definition at line 184 of file tls.h.

#define THREAD_GSCOPE_FLAG_USED   1

Definition at line 185 of file tls.h.

#define THREAD_GSCOPE_FLAG_WAIT   2

Definition at line 186 of file tls.h.

Value:
do                                                                  \
    { int __res                                                            \
       = atomic_exchange_rel (&THREAD_SELF->header.gscope_flag,            \
                            THREAD_GSCOPE_FLAG_UNUSED);             \
      if (__res == THREAD_GSCOPE_FLAG_WAIT)                                \
       lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1, LLL_PRIVATE);   \
    }                                                               \
  while (0)

Definition at line 187 of file tls.h.

Value:
do                                                                  \
    {                                                               \
      THREAD_SELF->header.gscope_flag = THREAD_GSCOPE_FLAG_USED;           \
      atomic_write_barrier ();                                             \
    }                                                               \
  while (0)

Definition at line 196 of file tls.h.

#define THREAD_GSCOPE_WAIT ( )    GL(dl_wait_lookup_done) ()

Definition at line 203 of file tls.h.

#define THREAD_SELF
Value:
((struct pthread *) (__thread_register \
                      - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE))

Definition at line 132 of file tls.h.

Definition at line 172 of file tls.h.

Value:
(((tcbhead_t *) ((char *) __thread_register                                 \
                   - TLS_TCB_OFFSET))[-1].stack_guard = (value))

Definition at line 159 of file tls.h.

#define THREAD_SETMEM (   descr,
  member,
  value 
)    ((void)(descr), (THREAD_SELF)->member = (value))

Definition at line 151 of file tls.h.

#define THREAD_SETMEM_NC (   descr,
  member,
  idx,
  value 
)    ((void)(descr), (THREAD_SELF)->member[idx] = (value))

Definition at line 155 of file tls.h.

#define TLS_DTV_AT_TP   1

Definition at line 57 of file tls.h.

#define TLS_INIT_TCB_ALIGN   __alignof__ (struct pthread)

Definition at line 79 of file tls.h.

#define TLS_INIT_TCB_SIZE   0

Definition at line 76 of file tls.h.

#define TLS_INIT_TP (   tcbp,
  secondcall 
)    (__thread_register = (void *) (tcbp) + TLS_TCB_OFFSET, NULL)

Definition at line 124 of file tls.h.

Definition at line 60 of file tls.h.

Value:
(sizeof (struct pthread)                                             \
   + ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1)))

Definition at line 88 of file tls.h.

#define TLS_TCB_ALIGN   __alignof__ (struct pthread)

Definition at line 85 of file tls.h.

#define TLS_TCB_OFFSET   0x7000

Definition at line 108 of file tls.h.

#define TLS_TCB_SIZE   0

Definition at line 82 of file tls.h.


Typedef Documentation

typedef union dtv dtv_t

Function Documentation

register void* __thread_register __asm__ ( "r2"  )