[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How TLS is used in Kernel thread
- To: threads_(_at_)_freebsd_(_dot_)_org
- Subject: How TLS is used in Kernel thread
- From: Jin Guojun <jin_(_at_)_george_(_dot_)_lbl_(_dot_)_gov>
- Date: Thu, 30 Aug 2007 14:20:33 -0700
- Cc: hackers_(_at_)_freebsd_(_dot_)_org
By looking through _pthread_create() code and find it uses a magic
cookie -- TLS -- created
by rtld_allocate_tls(), and passed into kernel by sysarch() via
_tcb_set() / _kcb_set().
The information seems to be set by rtld (ld-elf.so.1) in digest_phdr()
under tag PT_TLS.
But it is very magic for where the TLS object is created and how it is
passed to digest_phdr().
The whole object passed into kernel (as sd.gsbase) looks like this:
TCB: ______________________________
| TLS | TCB |
|______________|_______________|
Can someone give some basic exaplain on following questions?
1) What TLS stand for?
2) Where TLS object is created? (below is the tls assigned, but I couls
not find where ph is from)
case PT_TLS:
obj->tlsindex = 1;
obj->tlssize = ph->p_memsz;
obj->tlsalign = ph->p_align;
obj->tlsinitsize = ph->p_filesz;
obj->tlsinit = (void*) ph->p_vaddr;
3) Where in kernel the TLS is used for thread operation?
Thanks in advance,
-Jin
_______________________________________________
freebsd-threads_(_at_)_freebsd_(_dot_)_org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-threads
To unsubscribe, send any mail to "freebsd-threads-unsubscribe_(_at_)_freebsd_(_dot_)_org"
Visit your host, monkey.org