Fix the problem described in PR port-i386/4177: scroll lock could cause

tsleep() to be called from an interrupt handler.
The semantics of the scroll-lock key is changed now: it issues a ^S or
^Q, depending on the current state. (It should probably issue
tp->t_cc[VSTOP] or tp->t_cc[VSTART] instead, but this would require more
serious structural changes because there is not always a tty context
present.)
The "scroll lock" LED is now controlled by pcstart()/pcstop(), so it
will show the real state even if the start/stop characters are remapped
or the normal ^S/^Q are used.
This commit is contained in:
drochner 1997-10-01 20:48:59 +00:00
parent feaaceb801
commit f596be4ec4
1 changed files with 11 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pccons.c,v 1.111 1997/09/30 16:23:21 christos Exp $ */ /* $NetBSD: pccons.c,v 1.112 1997/10/01 20:48:59 drochner Exp $ */
/*- /*-
* Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved. * Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved.
@ -749,6 +749,9 @@ pcstart(tp)
goto out; goto out;
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
splx(s); splx(s);
lock_state &= ~SCROLL;
/* /*
* We need to do this outside spl since it could be fairly * We need to do this outside spl since it could be fairly
* expensive and we don't want our serial ports to overflow. * expensive and we don't want our serial ports to overflow.
@ -778,7 +781,8 @@ pcstop(tp, flag)
struct tty *tp; struct tty *tp;
int flag; int flag;
{ {
lock_state |= SCROLL;
async_update();
} }
int int
@ -1339,13 +1343,6 @@ sput(cp, n)
scroll = 0; scroll = 0;
/* scroll check */ /* scroll check */
if (crtat >= Crtat + vs.nchr) { if (crtat >= Crtat + vs.nchr) {
if (!kernel) {
int s = spltty();
if (lock_state & SCROLL)
tsleep(&lock_state,
PUSER, "pcputc", 0);
splx(s);
}
bcopy(Crtat + vs.ncol, Crtat, bcopy(Crtat + vs.ncol, Crtat,
(vs.nchr - vs.ncol) * CHR); (vs.nchr - vs.ncol) * CHR);
fillw((vs.at << 8) | ' ', fillw((vs.at << 8) | ' ',
@ -1999,8 +1996,6 @@ top:
break; break;
shift_state |= SCROLL; shift_state |= SCROLL;
lock_state ^= SCROLL; lock_state ^= SCROLL;
if ((lock_state & SCROLL) == 0)
wakeup(&lock_state);
async_update(); async_update();
break; break;
} }
@ -2092,11 +2087,12 @@ top:
if (shift_state & SCROLL) if (shift_state & SCROLL)
break; break;
shift_state |= SCROLL; shift_state |= SCROLL;
lock_state ^= SCROLL;
if ((lock_state & SCROLL) == 0) if ((lock_state & SCROLL) == 0)
wakeup(&lock_state); capchar[0] = 'S' - '@';
async_update(); else
break; capchar[0] = 'Q' - '@';
extended = 0;
return capchar;
/* /*
* non-locking keys * non-locking keys
*/ */