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 USE_TLS   1
#define TLS_DTV_AT_TP   1
#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__ (struct pthread)
#define TLS_PRE_TCB_SIZE   sizeof (struct pthread)
#define INSTALL_DTV(tcbp, dtvp)   ((tcbhead_t *) (tcbp))->dtv = (dtvp) + 1
#define INSTALL_NEW_DTV(dtv)
#define GET_DTV(tcbp)   (((tcbhead_t *) (tcbp))->dtv)
#define TLS_INIT_TP(tcbp, secondcall)   ({ __set_cr27(tcbp); NULL; })
#define THREAD_DTV()
#define THREAD_SELF
#define DB_THREAD_SELF   REGISTER (32, 32, 53 * 4, -sizeof (struct pthread))
#define THREAD_GETMEM(descr, member)   descr->member
#define THREAD_GETMEM_NC(descr, member, idx)   descr->member[idx]
#define THREAD_SETMEM(descr, member, value)   descr->member = (value)
#define THREAD_SETMEM_NC(descr, member, idx, value)   descr->member[idx] = (value)
#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

static struct pthread__get_cr27 (void)
static void __set_cr27 (struct pthread *cr27)

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   REGISTER (32, 32, 53 * 4, -sizeof (struct pthread))

Definition at line 123 of file tls.h.

#define GET_DTV (   tcbp)    (((tcbhead_t *) (tcbp))->dtv)

Definition at line 98 of file tls.h.

#define INSTALL_DTV (   tcbp,
  dtvp 
)    ((tcbhead_t *) (tcbp))->dtv = (dtvp) + 1

Definition at line 88 of file tls.h.

#define INSTALL_NEW_DTV (   dtv)
Value:
({ tcbhead_t *__tcbp = (tcbhead_t *)__get_cr27();       \
       __tcbp->dtv = dtv;                        \
   })

Definition at line 92 of file tls.h.

#define THREAD_DTV ( )
Value:
({ tcbhead_t *__tcbp = (tcbhead_t *)__get_cr27();       \
       __tcbp->dtv;                              \
   })

Definition at line 108 of file tls.h.

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

Definition at line 127 of file tls.h.

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

Definition at line 129 of file tls.h.

#define THREAD_GSCOPE_FLAG_UNUSED   0

Definition at line 151 of file tls.h.

#define THREAD_GSCOPE_FLAG_USED   1

Definition at line 152 of file tls.h.

#define THREAD_GSCOPE_FLAG_WAIT   2

Definition at line 153 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_private_futex_wake (&THREAD_SELF->header.gscope_flag, 1);       \
    }                                                               \
  while (0)

Definition at line 154 of file tls.h.

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

Definition at line 163 of file tls.h.

#define THREAD_GSCOPE_WAIT ( )    GL(dl_wait_lookup_done) ()

Definition at line 170 of file tls.h.

#define THREAD_SELF
Value:
({ struct pthread *__self;                \
       __self = __get_cr27();                    \
       __self - 1;                        \
   })

Definition at line 114 of file tls.h.

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

Definition at line 131 of file tls.h.

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

Definition at line 133 of file tls.h.

#define TLS_DTV_AT_TP   1

Definition at line 60 of file tls.h.

#define TLS_INIT_TCB_ALIGN   __alignof__ (tcbhead_t)

Definition at line 75 of file tls.h.

#define TLS_INIT_TCB_SIZE   sizeof (tcbhead_t)

Definition at line 72 of file tls.h.

#define TLS_INIT_TP (   tcbp,
  secondcall 
)    ({ __set_cr27(tcbp); NULL; })

Definition at line 104 of file tls.h.

#define TLS_PRE_TCB_SIZE   sizeof (struct pthread)

Definition at line 84 of file tls.h.

#define TLS_TCB_ALIGN   __alignof__ (struct pthread)

Definition at line 81 of file tls.h.

#define TLS_TCB_SIZE   sizeof (tcbhead_t)

Definition at line 78 of file tls.h.

#define USE_TLS   1

Definition at line 52 of file tls.h.


Typedef Documentation

typedef union dtv dtv_t

Function Documentation

static struct pthread* __get_cr27 ( void  ) [static, read]

Definition at line 136 of file tls.h.

{
  long cr27;
  asm ("mfctl %%cr27, %0" : "=r" (cr27) : );
  return (struct pthread *) cr27;
}
static void __set_cr27 ( struct pthread cr27) [inline, static]

Definition at line 143 of file tls.h.

{
  asm ( "ble  0xe0(%%sr2, %%r0)\n\t"
       "copy  %0, %%r26"
       : : "r" (cr27) : "r26" );
}