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