diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -598,6 +598,7 @@ * FALLTHROUGH (TRCTRAP kernel mode, kernel address) */ case T_BPTFLT: + printf("#BP pflags %#x pcb_onfault %p\n", td->td_pflags, curpcb->pcb_onfault); /* * If KDB is enabled, let it handle the debugger trap. * Otherwise, debugger traps "can't happen". @@ -606,6 +607,15 @@ if (kdb_trap(type, dr6, frame)) return; #endif + /* + * Most likely, EFI RT hitting INT3. + */ + if ((td->td_pflags & (TDP_NOFAULTING | + TDP_RESETSPUR)) == (TDP_NOFAULTING | + TDP_RESETSPUR) && curpcb->pcb_onfault != NULL) { + frame->tf_rip = (long)curpcb->pcb_onfault; + return; + } break; case T_NMI: