1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #include <link.h>
- #include "thread_dbP.h"
- # define TLS_DTV_UNALLOCATED ((void *) -1l)
- td_err_e
- td_thr_tls_get_addr (const td_thrhandle_t *th __attribute__ ((unused)),
- void *map_address __attribute__ ((unused)),
- size_t offset __attribute__ ((unused)),
- void **address __attribute__ ((unused)))
- {
- #if defined(USE_TLS) && USE_TLS
- size_t modid;
- union dtv pdtv, *dtvp;
- LOG ("td_thr_tls_get_addr");
-
- if (ps_pdread (th->th_ta_p->ph,
- &((struct _pthread_descr_struct *) th->th_unique)->p_header.data.dtvp,
- &dtvp, sizeof dtvp) != PS_OK)
- return TD_ERR;
-
- if (ps_pdread (th->th_ta_p->ph,
- &((struct link_map *) map_address)->l_tls_modid,
- &modid, sizeof modid) != PS_OK)
- return TD_ERR;
-
- if (ps_pdread (th->th_ta_p->ph, dtvp + modid,
- &pdtv, sizeof (union dtv)) != PS_OK)
- return TD_ERR;
-
- if (pdtv.pointer == TLS_DTV_UNALLOCATED)
-
- return TD_NOTALLOC;
- *address = (char *) pdtv.pointer + offset;
- return TD_OK;
- #else
- return TD_ERR;
- #endif
- }
|