[PATCH] Retrieval of TLS pointer via RDHWR

Warner Losh imp at bsdimp.com
Tue Dec 28 17:22:32 UTC 2010


On 12/28/2010 04:36, Robert Millan wrote:
> Not interested?
>
> Note this might become mandatory if you ever want to compile
> code that uses TLS with recent GCC.
>
> In any case, when executed natively, rdhwr is a speed-up
> compared to a sysarch() call.
Actually, am interested in this, but have been swamped with other 
things...  The code looks good, and we should definitely move in this 
direction.

Warner
> 2010/12/9 Robert Millan<rmh at debian.org>:
>> 2010/12/9 Jayachandran C.<jchandra at freebsd.org>:
>>> I'm not sure that the freebsd mips toolchain supports the __thread
>>> directive yet.  Were you able to test this from C?
>> Yes, but not via __thread.  I wrote a small program that sets
>> the TLS pointer to an arbitrary value (via MIPS_SET_TLS),
>> then issued rdhwr instruction using C inline assembly, and
>> finally verified that both values are the same.
>>
>> (the toolchain I'm using doesn't support __thread either,
>> but I submit this patch with the expectation that it can be
>> useful later on)
>>
>> --
>> Robert Millan
>>
>
>



More information about the freebsd-mips mailing list