Attempt to fix an interrupt recursion which can occur in specific
situations. The 'slow' interrupt code schedules an interrupt thread
without holding a critical section in an attempt to allow the thread to
preempt the current thread. If the thread preempts it can re-arm the
interrupt prior to returning and cause an interrupt recursion to occur
before the interrupt code is able to finish doreti, leading to a stack
overflow.
Since we want to preempt we cannot use a critical section to prevent
the recursion. Instead, use curthread->td_nest_count to prevent
recursive interrupts while the thread is unprotected by a critical
section. The same condition will now cause successive interrupts to
be queued and then dispatched synchronously by doreti.
Reported-by: "Simon 'corecode' Schubert" <corecode@fs.ei.tum.de>