summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1996-08-10 22:14:36 +0000
committerjoerg <joerg@FreeBSD.org>1996-08-10 22:14:36 +0000
commitb0b6f5d7b9be67f05cb8414a19ad952f7ff1b4e5 (patch)
treef5a4d22a74413612b69d8f8087ed8b58b142eef9 /sys
parentc1fd4cb7887898290a1d9bb895648f3889097aac (diff)
downloadFreeBSD-src-b0b6f5d7b9be67f05cb8414a19ad952f7ff1b4e5.zip
FreeBSD-src-b0b6f5d7b9be67f05cb8414a19ad952f7ff1b4e5.tar.gz
Fix many long-standing bugs and problems with pcvt, namely:
. make pccncheck() work even when interrupts are disabled, so the ``Press a key on the console...'' procedure will work, . make kernel colors #ifndef, so they can be overridden from the config file, . use shutdown_nice() instead of cpu_reset() if Ctrl-Alt-Del is enabled, . allow pccngetc() to return more than a single character, so the arrow keys will work (and thus visual UserConfig!), . fix a warning. This closes all know PRs related to pcvt, in particular #845, #1236, and #1265. PR #991 is a duplicate for 845, and PR #1283 has already been fixed earlier in rev 1.11 of pcvt_conf.h. Submitted by: Ulf Kieber (kieber@sax.de), for the kernel color fix
Diffstat (limited to 'sys')
-rw-r--r--sys/i386/isa/pcvt/pcvt_conf.h10
-rw-r--r--sys/i386/isa/pcvt/pcvt_drv.c23
-rw-r--r--sys/i386/isa/pcvt/pcvt_hdr.h12
-rw-r--r--sys/i386/isa/pcvt/pcvt_kbd.c14
4 files changed, 40 insertions, 19 deletions
diff --git a/sys/i386/isa/pcvt/pcvt_conf.h b/sys/i386/isa/pcvt/pcvt_conf.h
index c5739c5..3cf1bd9 100644
--- a/sys/i386/isa/pcvt/pcvt_conf.h
+++ b/sys/i386/isa/pcvt/pcvt_conf.h
@@ -460,12 +460,18 @@
* emphasize messages from the kernel on color and mono displays.
*---------------------------------------------------------------------------*/
- /* color displays */
+#if !defined COLOR_KERNEL_FG /* color displays */
#define COLOR_KERNEL_FG FG_LIGHTGREY /* kernel messages, foreground */
+#endif
+#if !defined COLOR_KERNEL_BG
#define COLOR_KERNEL_BG BG_RED /* kernel messages, background */
+#endif
- /* monochrome displays */
+#if !defined MONO_KERNEL_FG /* monochrome displays */
#define MONO_KERNEL_FG FG_UNDERLINE /* kernel messages, foreground */
+#endif
+#if !defined MONO_KERNEL_BG
#define MONO_KERNEL_BG BG_BLACK /* kernel messages, background */
+#endif
/*---------------------------------- E O F ----------------------------------*/
diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c
index d883c36..977d86e 100644
--- a/sys/i386/isa/pcvt/pcvt_drv.c
+++ b/sys/i386/isa/pcvt/pcvt_drv.c
@@ -1207,7 +1207,7 @@ int
pccngetc(Dev_t dev)
{
register int s;
- register u_char *cp;
+ static u_char *cp;
#ifdef XSERVER
@@ -1221,24 +1221,39 @@ pccngetc(Dev_t dev)
#endif /* XSERVER */
+ if (cp && *cp)
+ /*
+ * We still have a pending key sequence, e.g.
+ * from an arrow key. Deliver this one first.
+ */
+ return (*cp++);
+
s = spltty(); /* block pcrint while we poll */
+ kbd_polling = 1;
cp = sgetc(0);
+ kbd_polling = 0;
splx(s);
#if ! (PCVT_FREEBSD >= 201)
/* this belongs to cons.c */
if (*cp == '\r')
- return('\n');
+ *cp = '\n';
#endif /* ! (PCVT_FREEBSD >= 201) */
- return (*cp);
+ return (*cp++);
}
#if PCVT_FREEBSD >= 200
int
pccncheckc(Dev_t dev)
{
- return (sgetc(1) != 0); /* did someone press the "Any" key? */
+ char *cp;
+ int x = spltty();
+ kbd_polling = 1;
+ cp = sgetc(1);
+ kbd_polling = 0;
+ splx(x);
+ return (cp != 0); /* did someone press the "Any" key? */
}
#endif /* PCVT_FREEBSD >= 200 */
diff --git a/sys/i386/isa/pcvt/pcvt_hdr.h b/sys/i386/isa/pcvt/pcvt_hdr.h
index 8d9e6c7..2822b05 100644
--- a/sys/i386/isa/pcvt/pcvt_hdr.h
+++ b/sys/i386/isa/pcvt/pcvt_hdr.h
@@ -1396,12 +1396,12 @@ static __inline void vt_selattr(struct video_state *svsp)
/* 0x84 to produce keyboard controller */
/* access delays */
#define PCVT_KBD_DELAY() \
- { u_char x = inb(0x84); } \
- { u_char x = inb(0x84); } \
- { u_char x = inb(0x84); } \
- { u_char x = inb(0x84); } \
- { u_char x = inb(0x84); } \
- { u_char x = inb(0x84); }
+ { (void)inb(0x84); } \
+ { (void)inb(0x84); } \
+ { (void)inb(0x84); } \
+ { (void)inb(0x84); } \
+ { (void)inb(0x84); } \
+ { (void)inb(0x84); }
#else /* PCVT_PORTIO_DELAY */
/* use system supplied delay function for */
diff --git a/sys/i386/isa/pcvt/pcvt_kbd.c b/sys/i386/isa/pcvt/pcvt_kbd.c
index ae70327..e39b04e 100644
--- a/sys/i386/isa/pcvt/pcvt_kbd.c
+++ b/sys/i386/isa/pcvt/pcvt_kbd.c
@@ -935,10 +935,10 @@ loop:
/* see if there is data from the keyboard available either from */
/* the keyboard fifo or from the 8042 keyboard controller */
- if ((( noblock) && (pcvt_kbd_count)) ||
- ((!noblock) && (inb(CONTROLLER_CTRL) & STATUS_OUTPBF)))
+ if ((noblock && pcvt_kbd_count) ||
+ ((!noblock || kbd_polling) && (inb(CONTROLLER_CTRL) & STATUS_OUTPBF)))
{
- if (!noblock) /* source = 8042 */
+ if (!noblock || kbd_polling) /* source = 8042 */
{
PCVT_KBD_DELAY(); /* 7 us delay */
dt = inb(CONTROLLER_DATA); /* get from obuf */
@@ -1245,10 +1245,10 @@ no_mouse_event:
/* see if there is data from the keyboard available either from */
/* the keyboard fifo or from the 8042 keyboard controller */
- if ((( noblock) && (pcvt_kbd_count)) ||
- ((!noblock) && (inb(CONTROLLER_CTRL) & STATUS_OUTPBF)))
+ if ((noblock && pcvt_kbd_count) ||
+ ((!noblock || kbd_polling) && (inb(CONTROLLER_CTRL) & STATUS_OUTPBF)))
{
- if (!noblock) /* source = 8042 */
+ if (!noblock || kbd_polling) /* source = 8042 */
{
PCVT_KBD_DELAY(); /* 7 us delay */
dt = inb(CONTROLLER_DATA);
@@ -1355,7 +1355,7 @@ regular:
#if PCVT_CTRL_ALT_DEL /* Check for cntl-alt-del */
if((key == 76) && ctrl_down && (meta_down||altgr_down))
- cpu_reset();
+ shutdown_nice();
#endif /* PCVT_CTRL_ALT_DEL */
#if !(PCVT_NETBSD || PCVT_FREEBSD >= 200)
OpenPOWER on IntegriCloud