kernel - (mainly x86_64) - Fix a number of rare races
* Move the MP lock from outside to inside exit1(), also fixing an issue
where sigexit() was calling exit1() without it.
* Move calls to dsched_exit_thread() and biosched_done() out of the
platform code and into the mainline code. This also fixes an
issue where the code was improperly blocking way too late in the
thread termination code, after the point where it had been descheduled
permanently and tsleep decomissioned for the thread.
* Cleanup and document related code areas.
* Fix a missing proc_token release in the SIGKILL exit path.
* Fix FAKE_MCOUNT()s in the x86-64 code. These are NOPs anyway
(since kernel profiling doesn't work), but fix them anyway.
* Use APIC_PUSH_FRAME() in the Xcpustop assembly code for x86-64
in order to properly acquire a working %gs. This may improve the
handling of panic()s on x86_64.
* Also fix some cases if #if JG'd (ifdef'd out) code in case the
code is ever used later on.
* Protect set_user_TLS() with a critical section to be safe.
* Add debug code to help track down further x86-64 seg-fault issues,
and provide better kprintf()s for the debug path in question.
19 files changed: