tslog: Handle curthread equal to NULL
Early in the kernel boot, curthread goes through three stages:
- Kernel crash when you try to access it, because PCPU doesn't exist.
- NULL, because PCU exists but isn't initialized.
- &thread0, which is where most of the kernel boot process runs.
This broke TSLOG from inside hammer_time since the scripts which parse
logged records didn't understand that NULL meant &thread0.
Tell tslog to record &thread0 as the active thread if passed NULL.
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D40324