arm64: write PID in CONTEXTIDR_EL1 on ctx switch
Debug and trace features such as Statistical Profiling Extension (SPE)
use the CONTEXTIDR_EL1 register to get the PID of the current process.
Add a sysctl switch to toggle writing the current PID into this register
in the thread switcher.
To make use of the feature, the following sysctl switch must be set:
sysctl machdep.pid_in_contextidr=1
Kernel code can also toggle the sysctl by writing directly to the global
var behind the sysctl arm64_pid_in_contextidr:
extern bool arm64_pid_in_contextidr;
Reviewed by: andrew
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D46192