summaryrefslogtreecommitdiffstats
path: root/sys/dev/syscons/syscons.c
diff options
context:
space:
mode:
authoryokota <yokota@FreeBSD.org>2000-01-11 14:54:01 +0000
committeryokota <yokota@FreeBSD.org>2000-01-11 14:54:01 +0000
commit715966bf8adb1f06117b0690700bed09936230f4 (patch)
tree43bfbc350096f38a69febf5012643dcc32e4077e /sys/dev/syscons/syscons.c
parentddf2890cdfae4bd1cd3a719341689d029d64b580 (diff)
downloadFreeBSD-src-715966bf8adb1f06117b0690700bed09936230f4.zip
FreeBSD-src-715966bf8adb1f06117b0690700bed09936230f4.tar.gz
Add a new mechanism, cndbctl(), to tell the console driver that
ddb is entered. Don't refer to `in_Debugger' to see if we are in the debugger. (The variable used to be static in Debugger() and wasn't updated if ddb is entered via traps and panic anyway.) - Don't refer to `in_Debugger'. - Add `db_active' to i386/i386/db_interface.d (as in alpha/alpha/db_interface.c). - Remove cnpollc() stub from ddb/db_input.c. - Add the dbctl function to syscons, pcvt, and sio. (The function for pcvt and sio is noop at the moment.) Jointly developed by: bde and me (The final version was tweaked by me and not reviewed by bde. Thus, if there is any error in this commit, that is entirely of mine, not his.) Some changes were obtained from: NetBSD
Diffstat (limited to 'sys/dev/syscons/syscons.c')
-rw-r--r--sys/dev/syscons/syscons.c55
1 files changed, 28 insertions, 27 deletions
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 822d42b..64ecd73 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -124,15 +124,7 @@ SYSCTL_INT(_machdep, OID_AUTO, enable_panic_key, CTLFLAG_RW, &enable_panic_key,
#define VIRTUAL_TTY(sc, x) (SC_DEV((sc), (x))->si_tty)
-#define debugger FALSE
-
-#ifdef __i386__
-#ifdef DDB
-extern int in_Debugger;
-#undef debugger
-#define debugger in_Debugger
-#endif /* DDB */
-#endif /* __i386__ */
+static int debugger;
/* prototypes */
static int scvidprobe(int unit, int flags, int cons);
@@ -199,13 +191,15 @@ static cn_init_t sccninit;
static cn_getc_t sccngetc;
static cn_checkc_t sccncheckc;
static cn_putc_t sccnputc;
+static cn_dbctl_t sccndbctl;
static cn_term_t sccnterm;
#if __alpha__
void sccnattach(void);
#endif
-CONS_DRIVER(sc, sccnprobe, sccninit, sccnterm, sccngetc, sccncheckc, sccnputc);
+CONS_DRIVER(sc, sccnprobe, sccninit, sccnterm, sccngetc, sccncheckc, sccnputc,
+ sccndbctl);
static d_open_t scopen;
static d_close_t scclose;
@@ -1474,6 +1468,28 @@ sccncheckc(dev_t dev)
return sccngetch(SCGETC_NONBLOCK);
}
+static void
+sccndbctl(dev_t dev, int on)
+{
+ /* try to switch to the kernel console screen */
+ if (on && debugger == 0) {
+ /*
+ * TRY to make sure the screen saver is stopped,
+ * and the screen is updated before switching to
+ * the vty0.
+ */
+ scrn_timer(NULL);
+ if (!cold
+ && sc_console->sc->cur_scp->smode.mode == VT_AUTO
+ && sc_console->smode.mode == VT_AUTO)
+ switch_scr(sc_console->sc, sc_console->index);
+ }
+ if (on)
+ ++debugger;
+ else
+ --debugger;
+}
+
static int
sccngetch(int flags)
{
@@ -1553,7 +1569,7 @@ sccnupdate(scr_stat *scp)
if (scp->sc->font_loading_in_progress || scp->sc->videoio_in_progress)
return;
- if (debugger || panicstr || shutdown_in_progress) {
+ if (debugger > 0 || panicstr || shutdown_in_progress) {
sc_touch_scrn_saver();
} else if (scp != scp->sc->cur_scp) {
return;
@@ -1626,7 +1642,7 @@ scrn_timer(void *arg)
/* should we stop the screen saver? */
getmicrouptime(&tv);
- if (debugger || panicstr || shutdown_in_progress)
+ if (debugger > 0 || panicstr || shutdown_in_progress)
sc_touch_scrn_saver();
if (run_scrn_saver) {
if (tv.tv_sec > sc->scrn_time_stamp + scrn_blank_time)
@@ -3720,21 +3736,6 @@ next_code:
case DBG:
#ifndef SC_DISABLE_DDBKEY
#ifdef DDB
- if (debugger)
- break;
- /* try to switch to the kernel console screen */
- if (sc_console) {
- /*
- * TRY to make sure the screen saver is stopped,
- * and the screen is updated before switching to
- * the vty0.
- */
- scrn_timer(NULL);
- if (!cold
- && sc_console->sc->cur_scp->smode.mode == VT_AUTO
- && sc_console->smode.mode == VT_AUTO)
- switch_scr(sc_console->sc, sc_console->index);
- }
Debugger("manual escape to debugger");
#else
printf("No debugger in kernel\n");
OpenPOWER on IntegriCloud