Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Dec 2010 16:46:08 +0530
From:      "Jayachandran C." <jchandra@freebsd.org>
To:        Robert Millan <rmh@debian.org>
Cc:        freebsd-mips@freebsd.org
Subject:   Re: [PATCH] Retrieval of TLS pointer via RDHWR
Message-ID:  <AANLkTikxHUj%2BGe3YyJOWMQne31D=uY_712Qveq=Dmh2A@mail.gmail.com>
In-Reply-To: <AANLkTimg3CUk0p8YPyepiumEHvKo2F6jdVA0=1CefYrQ@mail.gmail.com>
References:  <AANLkTimg3CUk0p8YPyepiumEHvKo2F6jdVA0=1CefYrQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Dec 8, 2010 at 10:04 PM, Robert Millan <rmh@debian.org> wrote:
> This patch implements support for retrieving the TLS pointer via RDHWR
> instruction.
>
> It is implemented through emulation for platforms that don't provide
> this instruction natively (such as gxemul/malta). =A0Platforms that do
> provide it would need a separate patch.
>
> Reading register $29 with RDHWR is becoming the de-facto standard to
> implement TLS. =A0According to linux-mips wiki, MIPS Technologies has
> reserved hardware register $29 for ABI use. =A0Furthermore current GCC [1=
]
> makes the following assumptions:
> - RDHWR is natively available or otherwise emulated by the kernel
> - Register $29 holds the TLS pointer
>
> [1] gcc-4.4.4/gcc/config/mips/mips.md reads:
>
> ;; The TLS base pointer is accessed via "rdhwr $3, $29". =A0No current
> ;; MIPS architecture defines this register, and no current
> ;; implementation provides it; instead, any OS which supports TLS is
> ;; expected to trap and emulate this instruction. =A0rdhwr is part of the
> ;; MIPS 32r2 specification, but we use it on any architecture because
> ;; we expect it to be emulated.


I'm not sure that the freebsd mips toolchain supports the __thread
directive yet.  Were you able to test this from C?

Regards,
JC



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikxHUj%2BGe3YyJOWMQne31D=uY_712Qveq=Dmh2A>