AMD64: Clean up interrupt handling, handle user-mode exceptions
Add EXCEPTION_STACK_OVERFLOW for when a thread hits its stack guard page
Add an exit reason to threads as well as processes

This allows a process to determine whether one of its threads was killed
instead of exiting normally. We use the same EXIT_REASON_* definitions
as for processes, which are moved out into kernel/exit.h. Also add a
privilege check for getting process/thread exit status.