| 1 |
/* Thread Local Storage |
| 2 |
* Copyright (C) 2020 Red Hat Inc. |
| 3 |
* |
| 4 |
* This file is part of systemtap, and is free software. You can |
| 5 |
* redistribute it and/or modify it under the terms of the GNU General |
| 6 |
* Public License (GPL); either version 2, or (at your option) any |
| 7 |
* later version. |
| 8 |
*/ |
| 9 |
|
| 10 |
#ifndef _LINUX_STP_TLS_H_ |
| 11 |
#define _STAPLINUX_TLS_H_ |
| 12 |
|
| 13 |
// Redacted sysdeps/x86_64/nptl/tls.h See also descr.h |
| 14 |
|
| 15 |
// Thread context pointer, e.g. fs on x8664, points to this |
| 16 |
typedef union dtv dtv_t; |
| 17 |
struct tcbhead |
| 18 |
{ |
| 19 |
void *tcb; /* Pointer to the TCB. */ |
| 20 |
dtv_t *dtv; |
| 21 |
}; |
| 22 |
|
| 23 |
// sysdeps/generic/dl-dtv.h |
| 24 |
|
| 25 |
// Dynamic thread vector pointer is the pointer to the tls variable block for a particular executable or module |
| 26 |
struct dtv_pointer |
| 27 |
{ |
| 28 |
void *val; /* Pointer to data, or TLS_DTV_UNALLOCATED. */ |
| 29 |
void *to_free; /* Unaligned pointer, for deallocation. */ |
| 30 |
}; |
| 31 |
|
| 32 |
// Dynamic thread vector, tcbhead_t.dtv points to the first dtv which is a generation counter. |
| 33 |
// dtv[1..n] is the tls space for the executable and each loaded shared object |
| 34 |
typedef union dtv |
| 35 |
{ |
| 36 |
unsigned long counter; |
| 37 |
struct dtv_pointer pointer; |
| 38 |
} dtv_t; |
| 39 |
|
| 40 |
#endif /* _STAPLINUX_TLS_H_ */ |