Home | History | Annotate | Download | only in ld.elf_so

Lines Matching defs:dtv

65  * DTV offset
68 * the DTV offsets passed to __tls_get_addr have a bias relative
69 * to the start of the DTV, in order to maximize the range of TLS
80 size_t _rtld_tls_max_index = 1; /* Max index into up-to-date DTV */
83 * DTV -- Dynamic Thread Vector
85 * The DTV is a per-thread array that maps each module with
90 * The TCB itself, struct tls_tcb, has a pointer to the DTV at
96 * | max index | -1 max index i for which dtv[i] is alloced
98 * | generation | 0 void **dtv points here
109 * dtv[obj->tlsindex] works, when dtv[0] is the generation. The
119 * module lies outside the bounds of the current DTV.
127 * struct dtv {
132 #define DTV_GENERATION(dtv) ((size_t)((dtv)[0]))
133 #define DTV_MAX_INDEX(dtv) ((size_t)((dtv)[-1]))
134 #define SET_DTV_GENERATION(dtv, val) (dtv)[0] = (void *)(size_t)(val)
135 #define SET_DTV_MAX_INDEX(dtv, val) (dtv)[-1] = (void *)(size_t)(val)
144 * This may allocate a DTV if the current one is too old, and it
155 void **dtv, **new_dtv;
160 dtv = tcb->tcb_dtv;
164 * new DTV.
167 * DTV_MAX_INDEX(dtv)?
169 if (__predict_false(DTV_GENERATION(dtv) != _rtld_tls_dtv_generation)) {
170 size_t to_copy = DTV_MAX_INDEX(dtv);
176 new_dtv = xcalloc((2 + _rtld_tls_max_index) * sizeof(*dtv));
180 memcpy(new_dtv + 1, dtv + 1, to_copy * sizeof(*dtv));
181 xfree(dtv - 1); /* retreat back to DTV_MAX_INDEX */
182 dtv = tcb->tcb_dtv = new_dtv;
183 SET_DTV_MAX_INDEX(dtv, _rtld_tls_max_index);
184 SET_DTV_GENERATION(dtv, _rtld_tls_dtv_generation);
187 if (__predict_false(dtv[idx] == NULL))
188 dtv[idx] = _rtld_tls_module_allocate(tcb, idx);
192 return (uint8_t *)dtv[idx] + offset;
235 * This allocates a DTV and a TCB that points to it, including
276 dbg(("%s: [lwp %d] tls dtv %p-%p index %zu "
319 * DTV points to, and frees tcb's DTV, and frees tcb.
520 void **dtv;
528 dtv = tcb->tcb_dtv;
531 * Fast path: access to an already allocated DTV entry. This
537 if (__predict_true(idx <= DTV_MAX_INDEX(dtv) && dtv[idx] != NULL))
538 return (uint8_t *)dtv[idx] + offset;