12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #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 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
- }
|