+ i_bit_clear(MP_KDP, ¤t_cpu_datap()->cpu_signals);
+ if (pmap_tlb_flush_timeout ||
+ spinlock_timed_out ||
+ mp_cpus_call_wait_timeout ||
+ panic_active()) {
+ mp_kdp_wait(FALSE, TRUE);
+ } else if (!mp_kdp_trap &&
+ !mp_kdp_is_NMI &&
+ virtualized && (debug_boot_arg & DB_NMI)) {
+ /*
+ * Under a VMM with the debug boot-arg set, drop into kdp.
+ * Since an NMI is involved, there's a risk of contending with
+ * a panic. And side-effects of NMIs may result in entry into,
+ * and continuing from, the debugger being unreliable.
+ */
+ if (__sync_bool_compare_and_swap(&mp_kdp_is_NMI, FALSE, TRUE)) {
+ kprintf_break_lock();
+ kprintf("Debugger entry requested by NMI\n");
+ kdp_i386_trap(T_DEBUG, saved_state64(regs), 0, 0);
+ printf("Debugger entry requested by NMI\n");
+ mp_kdp_is_NMI = FALSE;
+ } else {
+ mp_kdp_wait(FALSE, FALSE);
+ }
+ } else {
+ mp_kdp_wait(FALSE, FALSE);
+ }