Re: how to implement Thread Local Storage (TLS) in kernel



you can't. there is no concept of TLS in kernel. you can create your own
table on the side using the current thread ID + current IRQL as the lookup,
but b/c you can run in any arbitrary thread context for DPCs and potentialy
incoming I/O, TLS doesn't make much sense. what problem are u trying to
solve?

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Ben Kial" <benkial@xxxxxxxxxxx> wrote in message
news:1118726709.017387.283480@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>I need to implement a Thread Local Storage (TLS) scheme in Windows
> kernel
> (XP SP2). I plan to create a global hash table and use
> PsGetCurrentThreadId() as the index.
>
> My question is how can I trap the thread exit event inside kernel so
> that I can "de-register" the TLS entry when a thread exits.
>
> Thanks in advance,
>
>
> Ben
>


.



Relevant Pages

  • Re: Assignment of GDT entries
    ... aware of segments, for a rather perverse reason: the TLS stuff. ... Or is it only used in kernel code? ... and obviously we'd like to keep them in the same cacheline too. ...
    (Linux-Kernel)
  • Re: TLS - implementing linux one in fbsd
    ... implement TLS, M:N implements it in userland, while 1:1 implements it in kernel. ... not have to set TLS via syscall later. ... those syscalls to not to setup TLS because linux wants to set it ...
    (freebsd-hackers)
  • Re: How TLS is used in Kernel thread
    ... The whole object passed into kernel looks like this: ... What TLS stand for? ... Static programs have a slightly simpler mechanism (simpler because there ... support for the thread libraries needs. ...
    (freebsd-hackers)
  • Re: Assignment of GDT entries
    ... user code segment number is the same as the kernel code segment +2 (ie ... Or is it only used in kernel code? ... and obviously we'd like to keep them in the same cacheline too. ... - TLS #1 ...
    (Linux-Kernel)
  • freeswan kernel module - syslog a disaster
    ... Aug 20 03:53:28 noc kernel: JEDEC: Found no ICH2 rom device at location zero ... # alias net-pf-4 off # IPX ... alias cipher-2 des ...
    (Debian-User)