DMTCP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Classes | Macros | Typedefs
tls-i386.h File Reference
#include <dl-sysdep.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <list.h>
#include <sysdep.h>
#include <nptl/descr.h>

Go to the source code of this file.

Classes

union  dtv
 
struct  tcbhead_t
 
struct  user_desc
 
union  user_desc_init
 

Macros

#define TLS_MULTIPLE_THREADS_IN_TCB   1
 
#define USE_TLS   1
 
#define STACK_ALIGN   16
 
#define TLS_INIT_TCB_SIZE   sizeof (struct pthread)
 
#define TLS_INIT_TCB_ALIGN   __alignof__ (struct pthread)
 
#define TLS_TCB_SIZE   sizeof (struct pthread)
 
#define TLS_TCB_ALIGN   __alignof__ (struct pthread)
 
#define TLS_TCB_AT_TP   1
 
#define INSTALL_DTV(descr, dtvp)   ((tcbhead_t *) (descr))->dtv = (dtvp) + 1
 
#define INSTALL_NEW_DTV(dtvp)
 
#define GET_DTV(descr)   (((tcbhead_t *) (descr))->dtv)
 
#define THREAD_SELF_SYSINFO   THREAD_GETMEM (THREAD_SELF, header.sysinfo)
 
#define THREAD_SYSINFO(pd)   ((pd)->header.sysinfo)
 
#define TLS_GET_GS()   ({ int __seg; __asm ("movw %%gs, %w0" : "=q" (__seg)); __seg & 0xffff; })
 
#define TLS_SET_GS(val)   __asm ("movw %w0, %%gs" :: "q" (val))
 
#define __NR_set_thread_area   243
 
#define TLS_FLAG_WRITABLE   0x00000001
 
#define TLS_EBX_ARG   "b"
 
#define TLS_LOAD_EBX
 
#define INIT_SYSINFO
 
#define LOCK_PREFIX   "lock;"
 
#define TLS_INIT_TP(thrdescr, secondcall)
 
#define THREAD_DTV()
 
#define THREAD_SELF
 
#define DB_THREAD_SELF
 
#define THREAD_GETMEM(descr, member)
 
#define THREAD_GETMEM_NC(descr, member, idx)
 
#define THREAD_SETMEM(descr, member, value)
 
#define THREAD_SETMEM_NC(descr, member, idx, value)
 
#define THREAD_ATOMIC_CMPXCHG_VAL(descr, member, newval, oldval)
 
#define THREAD_ATOMIC_BIT_SET(descr, member, bit)
 
#define CALL_THREAD_FCT(descr)
 
#define THREAD_SET_STACK_GUARD(value)   THREAD_SETMEM (THREAD_SELF, header.stack_guard, value)
 
#define THREAD_COPY_STACK_GUARD(descr)
 
#define THREAD_SET_POINTER_GUARD(value)   THREAD_SETMEM (THREAD_SELF, header.pointer_guard, value)
 
#define THREAD_COPY_POINTER_GUARD(descr)
 

Typedefs

typedef union dtv dtv_t
 

Macro Definition Documentation

#define __NR_set_thread_area   243

Definition at line 155 of file tls-i386.h.

#define CALL_THREAD_FCT (   descr)
Value:
({ void *__res; \
int __ignore1, __ignore2; \
asm volatile ("pushl %%eax\n\t" \
"pushl %%eax\n\t" \
"pushl %%eax\n\t" \
"pushl %%gs:%P4\n\t" \
"call *%%gs:%P3\n\t" \
"addl $16, %%esp" \
: "=a" (__res), "=c" (__ignore1), "=d" (__ignore2) \
: "i" (offsetof (struct pthread, start_routine)), \
"i" (offsetof (struct pthread, arg))); \
__res; })

Definition at line 406 of file tls-i386.h.

#define DB_THREAD_SELF
Value:
REGISTER_THREAD_AREA (32, offsetof (struct user_regs_struct, xgs), 3) \
REGISTER_THREAD_AREA (64, 26 * 8, 3) /* x86-64's user_regs_struct->gs */

Definition at line 266 of file tls-i386.h.

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

Definition at line 137 of file tls-i386.h.

#define INIT_SYSINFO

Definition at line 180 of file tls-i386.h.

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

Definition at line 128 of file tls-i386.h.

#define INSTALL_NEW_DTV (   dtvp)
Value:
({ struct pthread *__pd; \
THREAD_SETMEM (__pd, header.dtv, (dtvp)); })

Definition at line 132 of file tls-i386.h.

#define LOCK_PREFIX   "lock;"

Definition at line 187 of file tls-i386.h.

#define STACK_ALIGN   16

Definition at line 73 of file tls-i386.h.

#define THREAD_ATOMIC_BIT_SET (   descr,
  member,
  bit 
)
Value:
(void) ({ if (sizeof ((descr)->member) == 4) \
asm volatile (LOCK_PREFIX "orl %1, %%gs:%P0" \
:: "i" (offsetof (struct pthread, member)), \
"ir" (1 << (bit))); \
else \
/* Not necessary for other sizes in the moment. */ \
abort (); })

Definition at line 395 of file tls-i386.h.

#define THREAD_ATOMIC_CMPXCHG_VAL (   descr,
  member,
  newval,
  oldval 
)
Value:
({ __typeof (descr->member) __ret; \
__typeof (oldval) __old = (oldval); \
if (sizeof (descr->member) == 4) \
asm volatile (LOCK_PREFIX "cmpxchgl %2, %%gs:%P3" \
: "=a" (__ret) \
: "0" (__old), "r" (newval), \
"i" (offsetof (struct pthread, member))); \
else \
/* Not necessary for other sizes in the moment. */ \
abort (); \
__ret; })

Definition at line 380 of file tls-i386.h.

#define THREAD_COPY_POINTER_GUARD (   descr)
Value:
((descr)->header.pointer_guard \
= THREAD_GETMEM (THREAD_SELF, header.pointer_guard))

Definition at line 432 of file tls-i386.h.

#define THREAD_COPY_STACK_GUARD (   descr)
Value:
((descr)->header.stack_guard \
= THREAD_GETMEM (THREAD_SELF, header.stack_guard))

Definition at line 424 of file tls-i386.h.

#define THREAD_DTV ( )
Value:
({ struct pthread *__pd; \
THREAD_GETMEM (__pd, header.dtv); })

Definition at line 248 of file tls-i386.h.

#define THREAD_GETMEM (   descr,
  member 
)
Value:
({ __typeof (descr->member) __value; \
if (sizeof (__value) == 1) \
asm volatile ("movb %%gs:%P2,%b0" \
: "=q" (__value) \
: "0" (0), "i" (offsetof (struct pthread, member))); \
else if (sizeof (__value) == 4) \
asm volatile ("movl %%gs:%P1,%0" \
: "=r" (__value) \
: "i" (offsetof (struct pthread, member))); \
else \
{ \
if (sizeof (__value) != 8) \
/* There should not be any value with a size other than 1, \
4 or 8. */ \
abort (); \
\
asm volatile ("movl %%gs:%P1,%%eax\n\t" \
"movl %%gs:%P2,%%edx" \
: "=A" (__value) \
: "i" (offsetof (struct pthread, member)), \
"i" (offsetof (struct pthread, member) + 4)); \
} \
__value; })

Definition at line 272 of file tls-i386.h.

#define THREAD_GETMEM_NC (   descr,
  member,
  idx 
)
Value:
({ __typeof (descr->member[0]) __value; \
if (sizeof (__value) == 1) \
asm volatile ("movb %%gs:%P2(%3),%b0" \
: "=q" (__value) \
: "0" (0), "i" (offsetof (struct pthread, member[0])), \
"r" (idx)); \
else if (sizeof (__value) == 4) \
asm volatile ("movl %%gs:%P1(,%2,4),%0" \
: "=r" (__value) \
: "i" (offsetof (struct pthread, member[0])), \
"r" (idx)); \
else \
{ \
if (sizeof (__value) != 8) \
/* There should not be any value with a size other than 1, \
4 or 8. */ \
abort (); \
\
asm volatile ("movl %%gs:%P1(,%2,8),%%eax\n\t" \
"movl %%gs:4+%P1(,%2,8),%%edx" \
: "=&A" (__value) \
: "i" (offsetof (struct pthread, member[0])), \
"r" (idx)); \
} \
__value; })

Definition at line 299 of file tls-i386.h.

#define THREAD_SELF
Value:
({ struct pthread *__self; \
asm ("movl %%gs:%c1,%0" : "=r" (__self) \
: "i" (offsetof (struct pthread, header.self))); \
__self;})

Definition at line 259 of file tls-i386.h.

#define THREAD_SELF_SYSINFO   THREAD_GETMEM (THREAD_SELF, header.sysinfo)

Definition at line 140 of file tls-i386.h.

#define THREAD_SET_POINTER_GUARD (   value)    THREAD_SETMEM (THREAD_SELF, header.pointer_guard, value)

Definition at line 430 of file tls-i386.h.

#define THREAD_SET_STACK_GUARD (   value)    THREAD_SETMEM (THREAD_SELF, header.stack_guard, value)

Definition at line 422 of file tls-i386.h.

#define THREAD_SETMEM (   descr,
  member,
  value 
)
Value:
({ if (sizeof (descr->member) == 1) \
asm volatile ("movb %b0,%%gs:%P1" : \
: "iq" (value), \
"i" (offsetof (struct pthread, member))); \
else if (sizeof (descr->member) == 4) \
asm volatile ("movl %0,%%gs:%P1" : \
: "ir" (value), \
"i" (offsetof (struct pthread, member))); \
else \
{ \
if (sizeof (descr->member) != 8) \
/* There should not be any value with a size other than 1, \
4 or 8. */ \
abort (); \
\
asm volatile ("movl %%eax,%%gs:%P1\n\t" \
"movl %%edx,%%gs:%P2" : \
: "A" (value), \
"i" (offsetof (struct pthread, member)), \
"i" (offsetof (struct pthread, member) + 4)); \
}})

Definition at line 328 of file tls-i386.h.

#define THREAD_SETMEM_NC (   descr,
  member,
  idx,
  value 
)
Value:
({ if (sizeof (descr->member[0]) == 1) \
asm volatile ("movb %b0,%%gs:%P1(%2)" : \
: "iq" (value), \
"i" (offsetof (struct pthread, member)), \
"r" (idx)); \
else if (sizeof (descr->member[0]) == 4) \
asm volatile ("movl %0,%%gs:%P1(,%2,4)" : \
: "ir" (value), \
"i" (offsetof (struct pthread, member)), \
"r" (idx)); \
else \
{ \
if (sizeof (descr->member[0]) != 8) \
/* There should not be any value with a size other than 1, \
4 or 8. */ \
abort (); \
\
asm volatile ("movl %%eax,%%gs:%P1(,%2,8)\n\t" \
"movl %%edx,%%gs:4+%P1(,%2,8)" : \
: "A" (value), \
"i" (offsetof (struct pthread, member)), \
"r" (idx)); \
}})

Definition at line 353 of file tls-i386.h.

#define THREAD_SYSINFO (   pd)    ((pd)->header.sysinfo)

Definition at line 141 of file tls-i386.h.

#define TLS_EBX_ARG   "b"

Definition at line 172 of file tls-i386.h.

#define TLS_FLAG_WRITABLE   0x00000001

Definition at line 158 of file tls-i386.h.

#define TLS_GET_GS ( )    ({ int __seg; __asm ("movw %%gs, %w0" : "=q" (__seg)); __seg & 0xffff; })

Definition at line 145 of file tls-i386.h.

#define TLS_INIT_TCB_ALIGN   __alignof__ (struct pthread)

Definition at line 113 of file tls-i386.h.

#define TLS_INIT_TCB_SIZE   sizeof (struct pthread)

Definition at line 110 of file tls-i386.h.

#define TLS_INIT_TP (   thrdescr,
  secondcall 
)

Definition at line 194 of file tls-i386.h.

#define TLS_LOAD_EBX

Definition at line 173 of file tls-i386.h.

#define TLS_MULTIPLE_THREADS_IN_TCB   1

Definition at line 56 of file tls-i386.h.

#define TLS_SET_GS (   val)    __asm ("movw %w0, %%gs" :: "q" (val))

Definition at line 149 of file tls-i386.h.

#define TLS_TCB_ALIGN   __alignof__ (struct pthread)

Definition at line 119 of file tls-i386.h.

#define TLS_TCB_AT_TP   1

Definition at line 123 of file tls-i386.h.

#define TLS_TCB_SIZE   sizeof (struct pthread)

Definition at line 116 of file tls-i386.h.

#define USE_TLS   1

Definition at line 69 of file tls-i386.h.

Typedef Documentation

typedef union dtv dtv_t