summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1995-04-08 21:32:11 +0000
committerjoerg <joerg@FreeBSD.org>1995-04-08 21:32:11 +0000
commit2feff74c285a9678d5c38db2c45437df72a5bfdb (patch)
tree39d4529134d7e712accc4219cbd917de8336bcb9
parentc4c9cf1214969920aa1211a6e037a49c7cd0ff34 (diff)
downloadFreeBSD-src-2feff74c285a9678d5c38db2c45437df72a5bfdb.zip
FreeBSD-src-2feff74c285a9678d5c38db2c45437df72a5bfdb.tar.gz
Implement a simple hook (or hack?) to allow graphics device console
drivers to protect DDB from being invoked while the console is in process-controlled (i.e., graphics) mode. Implement the logic to use this hook from within pcvt. (I'm sure Søren will do the syscons part RSN). I've still got one occasion where the system stalled, but my attempts to trigger the situation artificially resulted int the expected behaviour. It's hard to track bugs without the console and DDB available. :-/
-rw-r--r--sys/amd64/amd64/db_interface.c14
-rw-r--r--sys/i386/i386/cons.c6
-rw-r--r--sys/i386/i386/cons.h3
-rw-r--r--sys/i386/i386/db_interface.c14
-rw-r--r--sys/i386/isa/pcvt/pcvt_ext.c34
-rw-r--r--sys/kern/subr_prf.c7
-rw-r--r--sys/kern/tty_cons.c6
-rw-r--r--sys/sys/cons.h3
8 files changed, 75 insertions, 12 deletions
diff --git a/sys/amd64/amd64/db_interface.c b/sys/amd64/amd64/db_interface.c
index 4fe5033..29007d2 100644
--- a/sys/amd64/amd64/db_interface.c
+++ b/sys/amd64/amd64/db_interface.c
@@ -23,7 +23,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
- * $Id: db_interface.c,v 1.11 1995/01/14 10:24:48 bde Exp $
+ * $Id: db_interface.c,v 1.12 1995/03/16 18:11:25 bde Exp $
*/
/*
@@ -38,6 +38,8 @@
#include <machine/md_var.h>
#include <machine/segments.h>
+#include <machine/cons.h> /* XXX: import cons_unavail */
+
#include <ddb/ddb.h>
#include <vm/pmap.h>
@@ -79,6 +81,10 @@ kdb_trap(type, code, regs)
return(0);
#endif
+ /* XXX: do not block forever while the console is in graphics mode */
+ if(cons_unavail)
+ return 0;
+
switch (type) {
case T_BPTFLT: /* breakpoint */
case T_TRCTRAP: /* debug exception */
@@ -239,7 +245,11 @@ Debugger(msg)
const char *msg;
{
static volatile u_char in_Debugger;
-
+
+ /* XXX: do not block forever while the console is in graphics mode */
+ if(cons_unavail)
+ return;
+
if (!in_Debugger) {
in_Debugger = 1;
db_printf("Debugger(\"%s\")\n", msg);
diff --git a/sys/i386/i386/cons.c b/sys/i386/i386/cons.c
index 36b8792..13cf848 100644
--- a/sys/i386/i386/cons.c
+++ b/sys/i386/i386/cons.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
- * $Id: cons.c,v 1.23 1995/02/26 03:15:36 bde Exp $
+ * $Id: cons.c,v 1.24 1995/04/02 16:14:51 joerg Exp $
*/
#include <sys/param.h>
@@ -73,6 +73,10 @@ static struct consdev constab[] = {
struct tty *constty = 0; /* virtual console output device */
struct tty *cn_tty; /* XXX: console tty struct for tprintf */
+int cons_unavail = 0; /* XXX:
+ * physical console not available for
+ * input (i.e., it is in graphics mode)
+ */
static u_char cn_is_open; /* nonzero if logical console is open */
static u_char cn_phys_is_open; /* nonzero if physical console is open */
diff --git a/sys/i386/i386/cons.h b/sys/i386/i386/cons.h
index 1e1b2f2..ded55d8 100644
--- a/sys/i386/i386/cons.h
+++ b/sys/i386/i386/cons.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.h 7.2 (Berkeley) 5/9/91
- * $Id: cons.h,v 1.5 1994/05/25 08:53:05 rgrimes Exp $
+ * $Id: cons.h,v 1.6 1994/10/20 00:07:46 phk Exp $
*/
#ifndef _MACHINE_CONS_H_
@@ -66,6 +66,7 @@ struct consdev {
extern struct consdev constab[];
extern struct consdev *cn_tab;
extern struct tty *cn_tty;
+extern int cons_unavail;
struct proc; struct uio;
diff --git a/sys/i386/i386/db_interface.c b/sys/i386/i386/db_interface.c
index 4fe5033..29007d2 100644
--- a/sys/i386/i386/db_interface.c
+++ b/sys/i386/i386/db_interface.c
@@ -23,7 +23,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
- * $Id: db_interface.c,v 1.11 1995/01/14 10:24:48 bde Exp $
+ * $Id: db_interface.c,v 1.12 1995/03/16 18:11:25 bde Exp $
*/
/*
@@ -38,6 +38,8 @@
#include <machine/md_var.h>
#include <machine/segments.h>
+#include <machine/cons.h> /* XXX: import cons_unavail */
+
#include <ddb/ddb.h>
#include <vm/pmap.h>
@@ -79,6 +81,10 @@ kdb_trap(type, code, regs)
return(0);
#endif
+ /* XXX: do not block forever while the console is in graphics mode */
+ if(cons_unavail)
+ return 0;
+
switch (type) {
case T_BPTFLT: /* breakpoint */
case T_TRCTRAP: /* debug exception */
@@ -239,7 +245,11 @@ Debugger(msg)
const char *msg;
{
static volatile u_char in_Debugger;
-
+
+ /* XXX: do not block forever while the console is in graphics mode */
+ if(cons_unavail)
+ return;
+
if (!in_Debugger) {
in_Debugger = 1;
db_printf("Debugger(\"%s\")\n", msg);
diff --git a/sys/i386/isa/pcvt/pcvt_ext.c b/sys/i386/isa/pcvt/pcvt_ext.c
index 32a89a0..7088caf 100644
--- a/sys/i386/isa/pcvt/pcvt_ext.c
+++ b/sys/i386/isa/pcvt/pcvt_ext.c
@@ -2427,8 +2427,19 @@ vgapage(int new_screen)
psignal(vsp->proc, vsp->smode.acqsig);
}
else
+ {
/* we are committed */
vt_switch_pending = 0;
+#if PCVT_FREEBSD > 206
+ /*
+ * XXX: If pcvt is acting as the systems console,
+ * avoid panics going to the debugger while we are in
+ * process mode.
+ */
+ if(pcvt_is_console)
+ cons_unavail = 0;
+#endif
+ }
}
return 0;
}
@@ -2498,6 +2509,15 @@ usl_vt_ioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
vsp->proc = p;
vsp->pid = p->p_pid;
+#if PCVT_FREEBSD > 206
+ /*
+ * XXX: If pcvt is acting as the systems console,
+ * avoid panics going to the debugger while we are in
+ * process mode.
+ */
+ if(pcvt_is_console)
+ cons_unavail = (newmode.mode == VT_PROCESS);
+#endif
splx(opri);
return 0;
@@ -2564,9 +2584,16 @@ usl_vt_ioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
vsp->smode.acqsig);
}
else
+ {
/* we are committed */
vt_switch_pending = 0;
- return 0;
+#if PCVT_FREEBSD > 206
+ /* XXX */
+ if(pcvt_is_console)
+ cons_unavail = 0;
+#endif
+ return 0;
+ }
}
break;
@@ -2575,6 +2602,11 @@ usl_vt_ioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
if(vsp->vt_status & VT_WAIT_ACK) {
vt_switch_pending = 0;
vsp->vt_status &= ~VT_WAIT_ACK;
+#if PCVT_FREEBSD > 206
+ /* XXX */
+ if(pcvt_is_console)
+ cons_unavail = 1;
+#endif
return 0;
}
break;
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index 8e57985..cc52cbb 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)subr_prf.c 8.3 (Berkeley) 1/21/94
- * $Id: subr_prf.c,v 1.11 1995/03/16 18:12:40 bde Exp $
+ * $Id: subr_prf.c,v 1.12 1995/04/01 20:18:43 joerg Exp $
*/
#include <sys/param.h>
@@ -53,6 +53,7 @@
#include <sys/tprintf.h>
#include <sys/syslog.h>
#include <sys/malloc.h>
+#include <machine/cons.h>
/*
* Note that stdarg.h and the ANSI style va_start macro is used for both
@@ -64,14 +65,14 @@
#include <machine/kdbparam.h>
#endif
+
#define TOCONS 0x01
#define TOTTY 0x02
#define TOLOG 0x04
struct tty *constty; /* pointer to console "window" tty */
-extern cnputc(); /* standard console putc */
-int (*v_putc)() = cnputc; /* routine to putc on virtual console */
+void (*v_putc)(int) = cnputc; /* routine to putc on virtual console */
void logpri __P((int level));
static void putchar __P((int ch, int flags, struct tty *tp));
diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c
index 36b8792..13cf848 100644
--- a/sys/kern/tty_cons.c
+++ b/sys/kern/tty_cons.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
- * $Id: cons.c,v 1.23 1995/02/26 03:15:36 bde Exp $
+ * $Id: cons.c,v 1.24 1995/04/02 16:14:51 joerg Exp $
*/
#include <sys/param.h>
@@ -73,6 +73,10 @@ static struct consdev constab[] = {
struct tty *constty = 0; /* virtual console output device */
struct tty *cn_tty; /* XXX: console tty struct for tprintf */
+int cons_unavail = 0; /* XXX:
+ * physical console not available for
+ * input (i.e., it is in graphics mode)
+ */
static u_char cn_is_open; /* nonzero if logical console is open */
static u_char cn_phys_is_open; /* nonzero if physical console is open */
diff --git a/sys/sys/cons.h b/sys/sys/cons.h
index 1e1b2f2..ded55d8 100644
--- a/sys/sys/cons.h
+++ b/sys/sys/cons.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.h 7.2 (Berkeley) 5/9/91
- * $Id: cons.h,v 1.5 1994/05/25 08:53:05 rgrimes Exp $
+ * $Id: cons.h,v 1.6 1994/10/20 00:07:46 phk Exp $
*/
#ifndef _MACHINE_CONS_H_
@@ -66,6 +66,7 @@ struct consdev {
extern struct consdev constab[];
extern struct consdev *cn_tab;
extern struct tty *cn_tty;
+extern int cons_unavail;
struct proc; struct uio;
OpenPOWER on IntegriCloud