--- Net2/arch/i386/isa/pccons.c 2018/04/24 18:07:08 1.1.1.3 +++ Net2/arch/i386/isa/pccons.c 2018/04/24 18:20:06 1.1.1.5 @@ -33,9 +33,9 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)pccons.c 5.11 (Berkeley) 5/21/91 + * from: @(#)pccons.c 5.11 (Berkeley) 5/21/91 + * pccons.c,v 1.28 1993/07/12 11:37:17 mycroft Exp */ -static char rcsid[] = "$Header: /var/lib/cvsd/net2/Net2/arch/i386/isa/pccons.c,v 1.1.1.3 2018/04/24 18:07:08 root Exp $"; /* * code to work keyboard & display for PC-style console @@ -45,6 +45,7 @@ static char rcsid[] = "$Header: /var/lib #include "ioctl.h" #include "proc.h" #include "user.h" +#include "select.h" #include "tty.h" #include "uio.h" #include "i386/isa/isa_device.h" @@ -59,7 +60,25 @@ static char rcsid[] = "$Header: /var/lib #include "i386/isa/kbd.h" #include "machine/pc/display.h" -struct tty pccons; +#include "pc.h" +#if NPC > 0 + +#ifndef BEEP_FREQ +#define BEEP_FREQ 1500 +#endif +#ifndef BEEP_TIME +#define BEEP_TIME (hz/4) +#endif + +#define PCBURST 128 + +extern u_short *Crtat; + +#ifdef XSERVER /* 15 Aug 92*/ +int pc_xmode; +#endif /* XSERVER */ + +struct tty *pc_tty[1]; struct pcconsoftc { char cs_flags; @@ -106,17 +125,13 @@ struct isa_driver pcdriver = { #define COL 80 #define ROW 25 #define CHR 2 -#define MONO_BASE 0x3B4 -#define MONO_BUF 0xfe0B0000 -#define CGA_BASE 0x3D4 -#define CGA_BUF 0xfe0B8000 -#define IOPHYSMEM 0xA0000 static unsigned int addr_6845 = MONO_BASE; -u_short *Crtat = (u_short *)MONO_BUF; static openf; -char *sgetc(int); +char *sgetc __P((int)); +static sputc __P((u_char, u_char)); + static char *more_chars; static int char_count; @@ -134,6 +149,7 @@ int pcparam(); int ttrstrt(); char partab[]; + extern pcopen(dev_t, int, int, struct proc *); /* * Wait for CP to accept last CP command sent @@ -149,14 +165,49 @@ extern pcopen(dev_t, int, int, struct pr } /* + * Pass command to keyboard controller (8042) + */ +static int kbc_8042cmd(val) +int val; +{ + unsigned timeo; + + timeo = 100000; /* > 100 msec */ + while (inb(KBSTATP) & KBS_IBF) + if (--timeo == 0) + return (-1); + outb(KBCMDP, val); + return (0); +} + +/* * Pass command to keyboard itself */ -unsigned kbd_cmd(val) { - - while (inb(KBSTATP)&KBS_IBF); - if (val) outb(KBOUTP, val); - while (inb(KBSTATP)&KBS_IBF); - return (inb(KBDATAP)); +int kbd_cmd(val) +int val; +{ + unsigned timeo; + + timeo = 100000; /* > 100 msec */ + while (inb(KBSTATP) & KBS_IBF) + if (--timeo == 0) + return (-1); + outb(KBOUTP, val); + return (0); +} + +/* + * Read response from keyboard + */ +int kbd_response() +{ + unsigned timeo; + + timeo = 500000; /* > 500 msec (KBR_RSTDONE requires 87) */ + while (!(inb(KBSTATP) & KBS_DIB)) + if (--timeo == 0) + return (-1); + return ((u_char) inb(KBDATAP)); } /* @@ -165,26 +216,59 @@ unsigned kbd_cmd(val) { pcprobe(dev) struct isa_device *dev; { - u_char c; int again = 0; + int response; + + /* Enable interrupts and keyboard, etc. */ + if (kbc_8042cmd(K_LDCMDBYTE) != 0) + printf("Timeout specifying load of keyboard command byte\n"); + if (kbd_cmd(CMDBYTE) != 0) + printf("Timeout writing keyboard command byte\n"); + /* + * Discard any stale keyboard activity. The 0.1 boot code isn't + * very careful and sometimes leaves a KBR_RESEND. + */ + while (inb(KBSTATP) & KBS_DIB) + kbd_response(); + + /* Start keyboard reset */ + if (kbd_cmd(KBC_RESET) != 0) + printf("Timeout for keyboard reset command\n"); + + /* Wait for the first response to reset and handle retries */ + while ((response = kbd_response()) != KBR_ACK) { + if (response < 0) { + printf("Timeout for keyboard reset ack byte #1\n"); + response = KBR_RESEND; + } + if (response == KBR_RESEND) { + if (!again) { + printf("KEYBOARD disconnected: RECONNECT\n"); + again = 1; + } + if (kbd_cmd(KBC_RESET) != 0) + printf("Timeout for keyboard reset command\n"); + } + /* + * Other responses are harmless. They may occur for new + * keystrokes. + */ + } - /* Enable interrupts and keyboard controller */ - kbc_8042cmd(K_LDCMDBYTE); - outb(KBOUTP, CMDBYTE); - - /* Start keyboard stuff RESET */ - kbd_cmd(KBC_RESET); - while((c = inb(KBDATAP)) != KBR_ACK) { - if ((c == KBR_RESEND) || (c == KBR_OVERRUN)) { - if(!again)printf("KEYBOARD disconnected: RECONNECT \n"); - kbd_cmd(KBC_RESET); - again = 1; + /* Wait for the second response to reset */ + while ((response = kbd_response()) != KBR_RSTDONE) { + if (response < 0) { + printf("Timeout for keyboard reset ack byte #2\n"); + /* + * If KBR_RSTDONE never arrives, the loop will + * finish here unless the keyboard babbles or + * KBS_DIB gets stuck. + */ + break; } } - /* pick up keyboard reset return code */ - while((c = inb(KBDATAP)) != KBR_RSTDONE); - return 1; + return (16); } pcattach(dev) @@ -193,9 +277,12 @@ struct isa_device *dev; u_short *cp = Crtat + (CGA_BUF-MONO_BUF)/CHR; u_short was; + printf("pc%d: ", dev->id_unit); if (vs.color == 0) - printf(""); - else printf(""); + printf("mono"); + else + printf("color"); + printf("\n"); cursor(0); } @@ -211,7 +298,13 @@ pcopen(dev, flag, mode, p) { register struct tty *tp; - tp = &pccons; + if (minor(dev) != 0) + return (ENXIO); + if(!pc_tty[0]) { + tp = pc_tty[0] = ttymalloc(); + } else { + tp = pc_tty[0]; + } tp->t_oproc = pcstart; tp->t_param = pcparam; tp->t_dev = dev; @@ -237,8 +330,10 @@ pcclose(dev, flag, mode, p) int flag, mode; struct proc *p; { - (*linesw[pccons.t_line].l_close)(&pccons, flag); - ttyclose(&pccons); + register struct tty *tp = pc_tty[0]; + + (*linesw[tp->t_line].l_close)(tp, flag); + ttyclose(tp); return(0); } @@ -247,7 +342,9 @@ pcread(dev, uio, flag) dev_t dev; struct uio *uio; { - return ((*linesw[pccons.t_line].l_read)(&pccons, uio, flag)); + register struct tty *tp = pc_tty[0]; + + return ((*linesw[tp->t_line].l_read)(tp, uio, flag)); } /*ARGSUSED*/ @@ -255,7 +352,9 @@ pcwrite(dev, uio, flag) dev_t dev; struct uio *uio; { - return ((*linesw[pccons.t_line].l_write)(&pccons, uio, flag)); + register struct tty *tp = pc_tty[0]; + + return ((*linesw[tp->t_line].l_write)(tp, uio, flag)); } /* @@ -266,6 +365,8 @@ pcwrite(dev, uio, flag) pcrint(dev, irq, cpl) dev_t dev; { + register struct tty *tp = pc_tty[0]; + int c; char *cp; @@ -275,21 +376,54 @@ pcrint(dev, irq, cpl) if (pcconsoftc.cs_flags & CSF_POLLING) return; #ifdef KDB - if (kdbrintr(c, &pccons)) + if (kdbrintr(c, tp)) return; #endif if (!openf) return; + +#ifdef XSERVER /* 15 Aug 92*/ + /* send at least one character, because cntl-space is a null */ + (*linesw[tp->t_line].l_rint)(*cp++ & 0xff, tp); +#endif /* XSERVER */ + while (*cp) - (*linesw[pccons.t_line].l_rint)(*cp++ & 0xff, &pccons); + (*linesw[tp->t_line].l_rint)(*cp++ & 0xff, tp); } +#ifdef XSERVER /* 15 Aug 92*/ +#define CONSOLE_X_MODE_ON _IO('t',121) +#define CONSOLE_X_MODE_OFF _IO('t',122) +#define CONSOLE_X_BELL _IOW('t',123,int[2]) +#endif /* XSERVER */ + pcioctl(dev, cmd, data, flag) dev_t dev; caddr_t data; { - register struct tty *tp = &pccons; + register struct tty *tp = pc_tty[0]; register error; + +#ifdef XSERVER /* 15 Aug 92*/ + if (cmd == CONSOLE_X_MODE_ON) { + pc_xmode_on (); + return (0); + } else if (cmd == CONSOLE_X_MODE_OFF) { + pc_xmode_off (); + return (0); + } else if (cmd == CONSOLE_X_BELL) { + /* if set, data is a pointer to a length 2 array of + integers. data[0] is the pitch in Hz and data[1] + is the duration in msec. */ + if (data) { + sysbeep(((int*)data)[0], + (((int*)data)[1] * hz)/ 3000); + } else { + sysbeep(BEEP_FREQ, BEEP_TIME); + } + return (0); + } +#endif /* XSERVER */ error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag); if (error >= 0) @@ -308,47 +442,52 @@ int pcconsintr = 1; pcxint(dev) dev_t dev; { - register struct tty *tp; + register struct tty *tp = pc_tty[0]; register int unit; if (!pcconsintr) return; - pccons.t_state &= ~TS_BUSY; + tp->t_state &= ~TS_BUSY; pcconsoftc.cs_timo = 0; - if (pccons.t_line) - (*linesw[pccons.t_line].l_start)(&pccons); + if (tp->t_line) + (*linesw[tp->t_line].l_start)(tp); else - pcstart(&pccons); + pcstart(tp); } pcstart(tp) - register struct tty *tp; +register struct tty *tp; { - int c, s; + register struct clist *rbp; + int s, len, n; + u_char buf[PCBURST]; s = spltty(); if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) goto out; - do { - if (RB_LEN(&tp->t_out) <= tp->t_lowat) { + tp->t_state |= TS_BUSY; + splx(s); + /* + * We need to do this outside spl since it could be fairly + * expensive and we don't want our serial ports to overflow. + */ + rbp = &tp->t_outq; + len = q_to_b(rbp, buf, PCBURST); + for (n = 0; n < len; n++) + if (buf[n]) sputc(buf[n], 0); + s = spltty(); + tp->t_state &= ~TS_BUSY; + if (rbp->c_cc) { + tp->t_state |= TS_TIMEOUT; + timeout((timeout_t)ttrstrt, (caddr_t)tp, 1); + } + if (rbp->c_cc <= tp->t_lowat) { if (tp->t_state&TS_ASLEEP) { tp->t_state &= ~TS_ASLEEP; - wakeup((caddr_t)&tp->t_out); - } - if (tp->t_wsel) { - selwakeup(tp->t_wsel, tp->t_state & TS_WCOLL); - tp->t_wsel = 0; - tp->t_state &= ~TS_WCOLL; + wakeup((caddr_t)rbp); } + selwakeup(&tp->t_wsel); } - if (RB_LEN(&tp->t_out) == 0) - goto out; - c = getc(&tp->t_out); - /*tp->t_state |= TS_BUSY;*/ - splx(s); - sput(c, 0); - (void)spltty(); - } while(1); out: splx(s); } @@ -365,7 +504,6 @@ pccnprobe(cp) /* initialize required fields */ cp->cn_dev = makedev(maj, 0); - cp->cn_tp = &pccons; cp->cn_pri = CN_INTERNAL; } @@ -387,8 +525,8 @@ pccnputc(dev, c) char c; { if (c == '\n') - sput('\r', 1); - sput(c, 1); + sputc('\r', 1); + sputc(c, 1); } /* @@ -398,7 +536,7 @@ pcputchar(c, tp) char c; register struct tty *tp; { - sput(c, 1); + sputc(c, 1); /*if (c=='\n') getchar();*/ } @@ -410,6 +548,11 @@ pccngetc(dev) register int s; register char *cp; +#ifdef XSERVER /* 15 Aug 92*/ + if (pc_xmode) + return (0); +#endif /* XSERVER */ + s = spltty(); /* block pcrint while we poll */ cp = sgetc(0); splx(s); @@ -422,6 +565,11 @@ pcgetchar(tp) { char *cp; +#ifdef XSERVER /* 15 Aug 92*/ + if (pc_xmode) + return (0); +#endif /* XSERVER */ + cp = sgetc(0); return (*cp&0xff); } @@ -466,6 +614,9 @@ static u_short *crtat = 0; cursor(int a) { int pos = crtat - Crtat; +#ifdef XSERVER /* 15 Aug 92*/ + if (!pc_xmode) { +#endif /* XSERVER */ outb(addr_6845, 14); outb(addr_6845+1, pos>> 8); outb(addr_6845, 15); @@ -477,7 +628,10 @@ cursor(int a) outb(addr_6845+1, 18); #endif FAT_CURSOR if (a == 0) - timeout(cursor, 0, hz/10); + timeout((timeout_t)cursor, (caddr_t)0, hz/10); +#ifdef XSERVER /* 15 Aug 92*/ + } +#endif /* XSERVER */ } static u_char shift_down, ctrl_down, alt_down, caps, num, scroll; @@ -496,20 +650,29 @@ static char bgansitopc[] = BG_MAGENTA, BG_CYAN, BG_LIGHTGREY}; /* - * sput has support for emulation of the 'pc3' termcap entry. + * sputc has support for emulation of the 'pc3' termcap entry. * if ka, use kernel attributes. */ -sput(c, ka) -u_char c; -u_char ka; +#ifdef __STDC__ +static sputc(u_char c, u_char ka) +#else +static sputc(c, ka) + u_char c, ka; +#endif { int sc = 1; /* do scroll check */ char fg_at, bg_at, at; +#ifdef XSERVER /* 15 Aug 92*/ + if (pc_xmode) + return; +#endif /* XSERVER */ + if (crtat == 0) { - u_short *cp = Crtat + (CGA_BUF-MONO_BUF)/CHR, was; + u_short volatile *cp = Crtat + (CGA_BUF-MONO_BUF)/CHR; + u_short was; unsigned cursorat; /* @@ -542,7 +705,7 @@ u_char ka; vs.bg_at = BG_BLACK; if (vs.color == 0) { - vs.kern_fg_at = FG_INTENSE; + vs.kern_fg_at = FG_UNDERLINE; vs.so_at = FG_BLACK | BG_LIGHTGREY; } else { vs.kern_fg_at = FG_LIGHTGREY; @@ -778,7 +941,7 @@ u_char ka; } } else { if (c == 7) - sysbeep(0x31b, hz/4); + sysbeep(BEEP_FREQ, BEEP_TIME); else { if (vs.so) { wrtchar(c, vs.so_at); @@ -790,8 +953,12 @@ u_char ka; } } if (sc && crtat >= Crtat+vs.ncol*vs.nrow) { /* scroll check */ - if (openf) do (void)sgetc(1); while (scroll); - bcopyb(Crtat+vs.ncol, Crtat, vs.ncol*(vs.nrow-1)*CHR); + if (openf) { + (void)sgetc(1); + if (scroll) + sleep((caddr_t)&scroll, PUSER); + } + bcopy(Crtat+vs.ncol, Crtat, vs.ncol*(vs.nrow-1)*CHR); fillw ((at << 8) + ' ', Crtat + vs.ncol*(vs.nrow-1), vs.ncol); crtat -= vs.ncol; @@ -801,8 +968,8 @@ u_char ka; } -unsigned __debug = 0; /*0xffe */; -static char scantokey[] { +unsigned __debug = 0; /*0xffe */ +static char scantokey[] = { 0, 120, /* F9 */ 0, @@ -900,7 +1067,7 @@ static char scantokey[] { 0, 0, 0, -45, ?* na*/ +45, /* na*/ 0, 0, 0, @@ -936,7 +1103,7 @@ static char scantokey[] { 0, 118, /* F7 */ }; -static char extscantokey[] { +static char extscantokey[] = { 0, 120, /* F9 */ 0, @@ -1034,7 +1201,7 @@ static char extscantokey[] { 0, 0, 0, -45, ?* na*/ +45, /* na*/ 0, 0, 0, @@ -1226,9 +1393,25 @@ static Scan_def scan_codes[] = update_led() { - kbd_cmd(KBC_STSIND); /* LED Command */ - outb(KBOUTP,scroll | 2*num | 4*caps); - /*kbd_cmd(scroll | 2*num | 4*caps);*/ + int response; + + if (kbd_cmd(KBC_STSIND) != 0) + printf("Timeout for keyboard LED command\n"); + else if (kbd_cmd(scroll | (num << 1) | (caps << 2)) != 0) + printf("Timeout for keyboard LED data\n"); +#if 0 + else if ((response = kbd_response()) < 0) + printf("Timeout for keyboard LED ack\n"); + else if (response != KBR_ACK) + printf("Unexpected keyboard LED ack %d\n", response); +#else + /* + * Skip waiting for and checking the response. The waiting + * would be too long (about 3 msec) and the checking might eat + * fresh keystrokes. The waiting should be done using timeout() + * and the checking should be done in the interrupt handler. + */ +#endif } /* @@ -1240,15 +1423,66 @@ char *sgetc(noblock) { u_char dt; unsigned key; - static u_char extended = 0; + static u_char extended = 0, lock_down = 0; static char capchar[2]; /* * First see if there is something in the keyboard port */ loop: +#ifdef XSERVER /* 15 Aug 92*/ + if (inb(KBSTATP) & KBS_DIB) { + dt = inb(KBDATAP); + if (pc_xmode) { + capchar[0] = dt; + /* + * Check for locking keys + */ + switch (scan_codes[dt & 0x7f].type) + { + case NUM: + if (dt & 0x80) { + lock_down &= ~NUM; + break; + } + if (lock_down & NUM) + goto loop; + lock_down |= NUM; + num ^= 1; + update_led(); + break; + case CAPS: + if (dt & 0x80) { + lock_down &= ~CAPS; + break; + } + if (lock_down & CAPS) + goto loop; + lock_down |= CAPS; + caps ^= 1; + update_led(); + break; + case SCROLL: + if (dt & 0x80) { + lock_down &= ~SCROLL; + break; + } + if (lock_down & SCROLL) + goto loop; + lock_down |= SCROLL; + scroll ^= 1; + if (!scroll) + wakeup((caddr_t)&scroll); + update_led(); + break; + } + return (&capchar[0]); + } + } +#else /* !XSERVER*/ if (inb(KBSTATP) & KBS_DIB) dt = inb(KBDATAP); +#endif /* !XSERVER*/ else { if (noblock) @@ -1260,25 +1494,24 @@ loop: if (dt == 0xe0) { extended = 1; +#ifdef XSERVER /* 15 Aug 92*/ + goto loop; +#else /* !XSERVER*/ if (noblock) return 0; else goto loop; +#endif /* !XSERVER*/ } - /* - * Check for cntl-alt-del - */ - if ((dt == 83) && ctrl_down && alt_down) - cpu_reset(); - -#include "ddb.h" -#if NDDB > 0 +#ifdef DDB /* * Check for cntl-alt-esc */ - if ((dt == 1) && ctrl_down && alt_down) + if ((dt == 1) && ctrl_down && alt_down) { Debugger(); + dt |= 0x80; /* discard esc (ddb discarded ctrl-alt) */ + } #endif /* @@ -1292,6 +1525,15 @@ loop: dt = dt & 0x7f; switch (scan_codes[dt].type) { + case NUM: + lock_down &= ~NUM; + break; + case CAPS: + lock_down &= ~CAPS; + break; + case SCROLL: + lock_down &= ~SCROLL; + break; case SHIFT: shift_down = 0; break; @@ -1315,15 +1557,26 @@ loop: * Locking keys */ case NUM: + if (lock_down & NUM) + break; + lock_down |= NUM; num ^= 1; update_led(); break; case CAPS: + if (lock_down & CAPS) + break; + lock_down |= CAPS; caps ^= 1; update_led(); break; case SCROLL: + if (lock_down & SCROLL) + break; + lock_down |= SCROLL; scroll ^= 1; + if (!scroll) + wakeup((caddr_t)&scroll); update_led(); break; @@ -1340,7 +1593,36 @@ loop: ctrl_down = 1; break; case ASCII: +#ifdef XSERVER /* 15 Aug 92*/ +/* + * 18 Sep 92 Terry Lambert I find that this behaviour is questionable -- + * I believe that this should be conditional on + * the value of pc_xmode rather than always + * done. In particular, "case NONE" seems to + * not cause a scancode return. This may + * invalidate alt-"=" and alt-"-" as well as the + * F11 and F12 keys, and some keys on lap-tops, + * Especially Toshibal T1100 and Epson Equity 1 + * and Equity 1+ when not in pc_xmode. + */ + /* control has highest priority */ + if (ctrl_down) + capchar[0] = scan_codes[dt].ctrl[0]; + else if (shift_down) + capchar[0] = scan_codes[dt].shift[0]; + else + capchar[0] = scan_codes[dt].unshift[0]; + + if (caps && (capchar[0] >= 'a' + && capchar[0] <= 'z')) { + capchar[0] = capchar[0] - ('a' - 'A'); + } + capchar[0] |= alt_down; + extended = 0; + return(&capchar[0]); +#else /* !XSERVER*/ case NONE: +#endif /* !XSERVER*/ case FUNC: if (shift_down) more_chars = scan_codes[dt].shift; @@ -1348,6 +1630,7 @@ loop: more_chars = scan_codes[dt].ctrl; else more_chars = scan_codes[dt].unshift; +#ifndef XSERVER /* 15 Aug 92*/ /* XXX */ if (caps && more_chars[1] == 0 && (more_chars[0] >= 'a' @@ -1355,6 +1638,7 @@ loop: capchar[0] = *more_chars - ('a' - 'A'); more_chars = capchar; } +#endif /* !XSERVER*/ extended = 0; return(more_chars); case KP: @@ -1364,19 +1648,21 @@ loop: more_chars = scan_codes[dt].unshift; extended = 0; return(more_chars); +#ifdef XSERVER /* 15 Aug 92*/ + case NONE: + break; +#endif /* XSERVER*/ } } extended = 0; +#ifdef XSERVER /* 15 Aug 92*/ + goto loop; +#else /* !XSERVER*/ if (noblock) return 0; else goto loop; -} - -pg(p,q,r,s,t,u,v,w,x,y,z) char *p; { - printf(p,q,r,s,t,u,v,w,x,y,z); - printf("\n"); - return(getchar()); +#endif /* !XSERVER*/ } /* special characters */ @@ -1395,30 +1681,30 @@ getchar() pcconsoftc.cs_flags |= CSF_POLLING; x = splhigh(); - sput('>', 1); + sputc('>', 1); /*while (1) {*/ thechar = *(sgetc(0)); pcconsoftc.cs_flags &= ~CSF_POLLING; splx(x); switch (thechar) { default: if (thechar >= ' ') - sput(thechar, 1); + sputc(thechar, 1); return(thechar); case cr: - case lf: sput('\r', 1); - sput('\n', 1); + case lf: sputc('\r', 1); + sputc('\n', 1); return(lf); case bs: case del: - sput('\b', 1); - sput(' ', 1); - sput('\b', 1); + sputc('\b', 1); + sputc(' ', 1); + sputc('\b', 1); return(thechar); case cntlc: - sput('^', 1) ; sput('C', 1) ; sput('\r', 1) ; sput('\n', 1) ; + sputc('^', 1) ; sputc('C', 1) ; sputc('\r', 1) ; sputc('\n', 1) ; cpu_reset(); case cntld: - sput('^', 1) ; sput('D', 1) ; sput('\r', 1) ; sput('\n', 1) ; + sputc('^', 1) ; sputc('D', 1) ; sputc('\r', 1) ; sputc('\n', 1) ; return(0); } /*}*/ @@ -1455,11 +1741,42 @@ dprintf(flgs, fmt /*, va_alist */) __color = 0; } -consinit() {} - int pcmmap(dev_t dev, int offset, int nprot) { if (offset > 0x20000) return -1; return i386_btop((0xa0000 + offset)); } + +#ifdef XSERVER /* 15 Aug 92*/ +#include "machine/psl.h" +#include "machine/frame.h" + +pc_xmode_on () +{ + struct syscframe *fp; + + if (pc_xmode) + return; + pc_xmode = 1; + + fp = (struct syscframe *)curproc->p_regs; + fp->sf_eflags |= PSL_IOPL; +} + +pc_xmode_off () +{ + struct syscframe *fp; + + if (pc_xmode == 0) + return; + pc_xmode = 0; + + cursor(0); + + fp = (struct syscframe *)curproc->p_regs; + fp->sf_eflags &= ~PSL_IOPL; +} +#endif /* XSERVER*/ + +#endif /* NPC > 0 */