Make it possible to safely use TPIDRURW from userspace.
authored <ed@FreeBSD.org>
Thu, 22 Sep 2016 08:14:59 +0000 (08:14 +0000)
committered <ed@FreeBSD.org>
Thu, 22 Sep 2016 08:14:59 +0000 (08:14 +0000)
commitc862dd3ee017caabf5a4e17df951172959963974
tree86d2829c954ef1a2b28c38cabcee3443ab4a5f70
parentf53d89fe29c38a71ef2223cf53e8a6efd03ebf8c
Make it possible to safely use TPIDRURW from userspace.

On amd64, arm64 and i386, we have the possibility to switch between TLS
areas in userspace. The nice thing about this is that it makes it easier
to do light-weight threading, if we ever feel like doing that. On armv6,
let's go into the same direction by making it possible to safely use the
TPIDRURW register, which is intended for this purpose.

Clean up the ARMv6 code to remove md_tp entirely. Simply add a dedicated
field to the PCB to hold the value of TPIDRURW across context switches,
like we do for any other register. As userspace currently uses the
read-only TPIDRURO register, simply ensure that we keep both values in
sync where possible. The system calls for modifying the read-only
register will simply write the intended value into both registers, so
that it lazily ends up in the PCB during the next context switch.

Reviewed by: https://reviews.freebsd.org/D7951
Approved by: andrew
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D7951
sys/arm/arm/genassym.c
sys/arm/arm/swtch-v6.S
sys/arm/arm/sys_machdep.c
sys/arm/arm/vm_machdep.c
sys/arm/include/frame.h
sys/arm/include/pcpu.h
sys/arm/include/proc.h