Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Jun 2003 16:46:00 -0400 (EDT)
From:      Daniel Eischen <eischen@vigrid.com>
To:        Igor Sysoev <is@rambler-co.ru>
Cc:        Julian Elischer <julian@elischer.org>
Subject:   Re: Implementing TLS: step 1
Message-ID:  <Pine.GSO.4.10.10306201643120.20305-100000@pcnet5.pcnet.com>
In-Reply-To: <Pine.BSF.4.21.0306202226410.26177-100000@is>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 20 Jun 2003, Igor Sysoev wrote:
> 
> I'm wrong, this scheme does not allow to use the 1:1 model in libkse
> when kse_mailbox.km_curthread is always NULL.
> 
> We can implement such scheme on x86:
> 
> gs -> [ TP                 ] ---> [ TLS                    ]
>       [ struct kse_mailbox ]  +-> [ struct kse_thr_mailbox ]
>       [      .km_curthread ] -+
> 
> When UTS would switch to the next thread it should set thread's TLS:
> 
>      kse_mailbox.km_curthread = NULL;

FYI, The above has to be atomic.

>      gs:[0] = next_thr_tls;
>      kse_mailbox.km_curthread = next_kse_thr_mailbox;

FYI2, The above need not be atomic since upcalls are disabled
by the first line.

> kse_mailbox can be accessed via gs register. On amd64 scheme is the same
> except the use of fs register instead of gs.
> 
> However on sparc64, ia64 and alpha TP is in the register but not
> in the memory so we need introduce the new field tm_kse in kse_thr_mailbox
> to find kse_mailbox:
> 
> TP -> [ TLS                    ]
>       [ struct kse_thr_mailbox ]
>       [                .tm_kse ] ---> [ struct kse_mailbox ]
> 
> 
> By the way how was kse_mailbox being found before gs register was used ?

We've used %gs ever since we supported multiple KSEs.
Before, it was just a port of libc_r with everything
global and only 1 KSE.

-- 
Dan Eischen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10306201643120.20305-100000>