sched: move panic handling code out of choosethread
This avoids jumps in the common case of the kernel not being panicked.