From 5a3c5f632b4461dbf60ab538e16453104b937231 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 4 May 2008 23:29:38 +0000 Subject: Expand kdb_alt_break a little, most commonly used with the option ALT_BREAK_TO_DEBUGGER. In addition to "Enter ~ ctrl-B" (to enter the debugger), there is now "Enter ~ ctrl-P" (force panic) and "Enter ~ ctrl-R" (request clean reboot, ala ctrl-alt-del on syscons). We've used variations of this at work. The force panic sequence is best used with KDB_UNATTENDED for when you just want it to dump and get on with it. The reboot request is a safer way of getting into single user than a power cycle. eg: you've hosed the ability to log in (pam, rtld, etc). It gives init the reboot signal, which causes an orderly reboot. I've taken my best guess at what the !x86 and non-sio code changes should be. This also makes sio release its spinlock before calling KDB/DDB. --- sys/dev/sio/sio.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'sys/dev/sio') diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index a62b411..a4cca4d 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -1469,6 +1469,11 @@ siointr1(com) u_char modem_status; u_char *ioptr; u_char recv_data; +#if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER) + int kdb_brk; + +again: +#endif if (COM_IIR_TXRDYBUG(com->flags)) { int_ctl = inb(com->int_ctl_port); @@ -1501,9 +1506,24 @@ siointr1(com) #ifdef KDB #ifdef ALT_BREAK_TO_DEBUGGER if (com->unit == comconsole && - kdb_alt_break(recv_data, &com->alt_brk_state) != 0) - kdb_enter(KDB_WHY_BREAK, - "Break sequence on console"); + (kdb_brk = kdb_alt_break(recv_data, + &com->alt_brk_state)) != 0) { + mtx_unlock_spin(&sio_lock); + switch (kdb_brk) { + case KDB_REQ_DEBUGGER: + kdb_enter(KDB_WHY_BREAK, + "Break sequence on console"); + break; + case KDB_REQ_PANIC: + kdb_panic("panic on console"); + break; + case KDB_REQ_REBOOT: + kdb_reboot(); + break; + } + mtx_lock_spin(&sio_lock); + goto again; + } #endif /* ALT_BREAK_TO_DEBUGGER */ #endif /* KDB */ if (line_status & (LSR_BI | LSR_FE | LSR_PE)) { -- cgit v1.1