Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 09 Feb 2012 14:41:08 -0800
From:      Oleksandr Tymoshenko <gonzo@freebsd.org>
To:        Robert Millan <rmh@debian.org>
Cc:        freebsd-mips@freebsd.org
Subject:   Re: [PATCH] Retrieval of TLS pointer via RDHWR
Message-ID:  <4F344B84.4040107@freebsd.org>
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 08/12/2010 8:34 AM, Robert Millan 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).  Platforms that do
> provide it would need a separate patch.
>
> Reading register $29 with RDHWR is becoming the de-facto standard to
> implement TLS.  According to linux-mips wiki, MIPS Technologies has
> reserved hardware register $29 for ABI use.  Furthermore 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".  No 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.  rdhwr is part of the
> ;; MIPS 32r2 specification, but we use it on any architecture because
> ;; we expect it to be emulated.

Hi Robert,

It's a shame that it took a year to commit this patch :( but finally it
made it to SVN. I modified it a little bit to be more universal and
MIPS64-compatible.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F344B84.4040107>