MIPS Thread Local Storage Help Request

Gedare Bloom gedare at rtems.org
Mon Apr 28 18:56:48 UTC 2014


On Mon, Apr 28, 2014 at 2:47 PM, Joel Sherrill
<joel.sherrill at oarcorp.com> wrote:
> Hi
>
> This is going to be interesting. MIPS TLS is broken because
> we don't have a trap handler for this. From GCC:
>
> ;; Thread-Local Storage
>
> ;; 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.  Use .set to force the assembler to
> ;; accept it.
> ;;
> ;; We do not use a constraint to force the destination to be $3
> ;; because $3 can appear explicitly as a function return value.
> ;; If we leave the use of $3 implicit in the constraints until
> ;; reload, we may end up making a $3 return value live across
> ;; the instruction, leading to a spill failure when reloading it.
>
> This code from NetBSD appears to be the core part of the
> handler.
>
> http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/mips/mips/locore_mips3.S?only_with_tag=MAIN
>

Do you mean
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/mips/mips/mips_emul.c?rev=1.26&content-type=text/x-cvsweb-markup&only_with_tag=MAIN
near case OP_RDHWR


> If someone can adapt this, then the MIPS will have working
> TLS.
>
> Thanks.
>
> --
> Joel Sherrill, Ph.D.             Director of Research & Development
> joel.sherrill at OARcorp.com        On-Line Applications Research
> Ask me about RTEMS: a free RTOS  Huntsville AL 35805
> Support Available                (256) 722-9985
>
> _______________________________________________
> rtems-devel mailing list
> rtems-devel at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-devel



More information about the devel mailing list