diff options
author | peter <peter@FreeBSD.org> | 2008-05-04 23:29:38 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2008-05-04 23:29:38 +0000 |
commit | 5a3c5f632b4461dbf60ab538e16453104b937231 (patch) | |
tree | dec162871c2e0c2defef809d28858069fac12065 /sys/pc98/cbus/sio.c | |
parent | 40ba3f0b054237aea1c061c7ae1d4a9b1b5dd800 (diff) | |
download | FreeBSD-src-5a3c5f632b4461dbf60ab538e16453104b937231.zip FreeBSD-src-5a3c5f632b4461dbf60ab538e16453104b937231.tar.gz |
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.
Diffstat (limited to 'sys/pc98/cbus/sio.c')
-rw-r--r-- | sys/pc98/cbus/sio.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index d0173af..7089578 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -2268,12 +2268,16 @@ siointr1(com) u_char modem_status; u_char *ioptr; u_char recv_data; - #ifdef PC98 u_char tmp = 0; u_char rsa_buf_status = 0; int rsa_tx_fifo_size = 0; #endif /* PC98 */ +#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); @@ -2368,9 +2372,24 @@ more_intr: #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)) { |