Implementing TLS: step 1

Igor Sysoev is at rambler-co.ru
Fri Jun 20 04:40:50 PDT 2003


If we could sacrifice our current thread compatibility in 5.0-5.1
then we could change kse_mailbox from

        struct kse_mailbox {
           int                     km_version;     /* Mailbox version */
           struct kse_thr_mailbox  *km_curthread;  /* Current thread */
           ...

to
     
        struct kse_mailbox { 
           struct kse_thr_mailbox  *km_curthread;  /* Current thread */
           int                     km_version;     /* Mailbox version */
           ...

then x86's gs would still point to kse_mailbox, and gs:[0] would be
and TP pointer.  Also we need to modify

     struct kse_thr_mailbox {
+          void              *tls;
           ucontext_t        tm_context;     /* User thread context */
           ...

And the static TLS must be allocated before kse_thr_mailbox.


Igor Sysoev
http://sysoev.ru/en/



More information about the freebsd-threads mailing list