123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #include "thread_dbP.h"
- td_err_e
- td_thr_tlsbase (const td_thrhandle_t *th,
- unsigned long int modid,
- psaddr_t *base)
- {
- td_err_e err;
- psaddr_t dtv, dtvslot, dtvptr;
- if (modid < 1)
- return TD_NOTLS;
- psaddr_t pd = th->th_unique;
- if (pd == 0)
- {
-
- td_thrhandle_t main_th;
- err = __td_ta_lookup_th_unique (th->th_ta_p, ps_getpid (th->th_ta_p->ph),
- &main_th);
- if (err == 0)
- pd = main_th.th_unique;
- if (pd == 0)
- return TD_TLSDEFER;
- }
-
- err = DB_GET_FIELD (dtv, th->th_ta_p, pd, pthread, dtvp, 0);
- if (err != TD_OK)
- return err;
-
- err = DB_GET_FIELD_ADDRESS (dtvslot, th->th_ta_p, dtv, dtv, dtv, modid);
- if (err != TD_OK)
- return err;
-
- err = DB_GET_FIELD (dtvptr, th->th_ta_p, dtvslot, dtv_t, pointer_val, 0);
- if (err != TD_OK)
- return err;
-
- if ((uintptr_t) dtvptr & 1)
- return TD_TLSDEFER;
- *base = dtvptr;
- return TD_OK;
- }
|