diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c index dcadcdbfeede..d7d56d04390e 100644 --- a/sys/i386/isa/pcvt/pcvt_drv.c +++ b/sys/i386/isa/pcvt/pcvt_drv.c @@ -257,8 +257,8 @@ pcvt_attach(device_t dev) for(i = 0; i < totalscreens; i++) { - ttyregister(&pcvt_tty[i]); - vs[i].vs_tty = &pcvt_tty[i]; + pcvt_tty[i] = ttymalloc(pcvt_tty[i]); + vs[i].vs_tty = pcvt_tty[i]; make_dev(&vt_cdevsw, i, UID_ROOT, GID_WHEEL, 0600, "ttyv%r", i); } @@ -284,7 +284,7 @@ pcvt_open(dev_t dev, int flag, int mode, struct thread *td) if(i >= PCVT_NSCREENS) return ENXIO; - tp = &pcvt_tty[i]; + tp = pcvt_tty[i]; dev->si_tty = tp; @@ -350,7 +350,7 @@ pcvt_close(dev_t dev, int flag, int mode, struct thread *td) if(i >= PCVT_NSCREENS) return ENXIO; - tp = &pcvt_tty[i]; + tp = pcvt_tty[i]; (*linesw[tp->t_line].l_close)(tp, flag); @@ -378,7 +378,7 @@ pcvt_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) if(i >= PCVT_NSCREENS) return ENXIO; - tp = &pcvt_tty[i]; + tp = pcvt_tty[i]; /* note that some ioctl's are global, e.g. KBSTPMAT: There is * only one keyboard and different repeat rates for instance between @@ -419,6 +419,7 @@ static void pcvt_timeout(void *arg) { u_char *cp; + struct tty *tp; #if PCVT_SLOW_INTERRUPT int s; @@ -430,6 +431,7 @@ pcvt_timeout(void *arg) pcvt_scrnsv_reset(); #endif /* PCVT_SCREENSAVER */ + tp = pcvt_tty[current_video_screen]; while (pcvt_kbd_count) { if (((cp = sgetc(1)) != 0) && @@ -440,13 +442,13 @@ pcvt_timeout(void *arg) if(*cp == '\0') { /* pass a NULL character */ - (*linesw[pcvt_ttyp->t_line].l_rint)('\0', pcvt_ttyp); + (*linesw[tp->t_line].l_rint)('\0', tp); } /* XXX */ else #endif /* PCVT_NULLCHARS */ while (*cp) - (*linesw[pcvt_ttyp->t_line].l_rint)(*cp++ & 0xff, pcvt_ttyp); + (*linesw[tp->t_line].l_rint)(*cp++ & 0xff, tp); } PCVT_DISABLE_INTR (); @@ -647,7 +649,8 @@ pcvt_cn_probe(struct consdev *cp) sprintf(cp->cn_name, "ttyv%r", 0); cp->cn_pri = CN_INTERNAL; - cp->cn_tp = &pcvt_tty[0]; + pcvt_tty[0] = ttymalloc(pcvt_tty[0]); + cp->cn_tp = pcvt_tty[0]; } /*---------------------------------------------------------------------------* diff --git a/sys/i386/isa/pcvt/pcvt_ext.c b/sys/i386/isa/pcvt/pcvt_ext.c index 7081949c8c2c..639c50cdf9bb 100644 --- a/sys/i386/isa/pcvt/pcvt_ext.c +++ b/sys/i386/isa/pcvt/pcvt_ext.c @@ -2098,8 +2098,6 @@ switch_screen(int n, int oldgrafx, int newgrafx) /* update global screen pointers/variables */ current_video_screen = n; /* current screen no */ - pcvt_ttyp = &pcvt_tty[n]; /* current tty */ - vsp = &vs[n]; /* current video state ptr */ if(oldgrafx && !newgrafx) diff --git a/sys/i386/isa/pcvt/pcvt_hdr.h b/sys/i386/isa/pcvt/pcvt_hdr.h index 1a6f566a69f8..44b65a4f0eec 100644 --- a/sys/i386/isa/pcvt/pcvt_hdr.h +++ b/sys/i386/isa/pcvt/pcvt_hdr.h @@ -571,7 +571,7 @@ EXTERN u_char color; /* color or mono display */ EXTERN u_short kern_attr; /* kernel messages char attributes */ EXTERN u_short user_attr; /* character attributes */ -EXTERN struct tty pcvt_tty[PCVT_NSCREENS]; +EXTERN struct tty *pcvt_tty[PCVT_NSCREENS]; struct sixels { u_char lower[MAXSIXEL]; /* lower half of char */ @@ -735,7 +735,6 @@ u_char bgansitopc[] = { /* background ANSI color -> pc */ BG_MAGENTA, BG_CYAN, BG_LIGHTGREY }; -struct tty *pcvt_ttyp = &pcvt_tty[0]; /* ptr to current device */ video_state *vsp = &vs[0]; /* ptr to current screen parms */ #ifdef XSERVER @@ -872,7 +871,6 @@ extern int pcvt_kbd_rptr; extern int pcvt_kbd_count; extern u_char vga_type; -extern struct tty *pcvt_ttyp; extern video_state *vsp; #ifdef XSERVER diff --git a/sys/i386/isa/pcvt/pcvt_sup.c b/sys/i386/isa/pcvt/pcvt_sup.c index 4df2971b69bd..49fe2892adf3 100644 --- a/sys/i386/isa/pcvt/pcvt_sup.c +++ b/sys/i386/isa/pcvt/pcvt_sup.c @@ -1491,8 +1491,6 @@ vgapage(int n) current_video_screen = n; /* current screen no */ - pcvt_ttyp = &pcvt_tty[n]; /* current tty */ - vsp = &vs[n]; /* current video state ptr */ /* kernel memory -> video board memory */