diff options
-rw-r--r-- | sys/dev/syscons/scterm-teken.c | 15 | ||||
-rw-r--r-- | sys/dev/syscons/syscons.c | 39 | ||||
-rw-r--r-- | sys/dev/syscons/syscons.h | 4 | ||||
-rw-r--r-- | sys/dev/syscons/teken/teken.c | 7 | ||||
-rw-r--r-- | sys/dev/syscons/teken/teken.h | 1 | ||||
-rw-r--r-- | sys/pc98/cbus/scterm-sck.c | 10 |
6 files changed, 39 insertions, 37 deletions
diff --git a/sys/dev/syscons/scterm-teken.c b/sys/dev/syscons/scterm-teken.c index da344da..491f82a 100644 --- a/sys/dev/syscons/scterm-teken.c +++ b/sys/dev/syscons/scterm-teken.c @@ -153,12 +153,23 @@ scteken_term(scr_stat *scp, void **softc) } static void -scteken_puts(scr_stat *scp, u_char *buf, int len) +scteken_puts(scr_stat *scp, u_char *buf, int len, int kernel) { teken_stat *ts = scp->ts; + teken_attr_t backup, kattr; scp->sc->write_in_progress++; - teken_input(&ts->ts_teken, buf, len); + if (kernel) { + /* Use special colors for kernel messages. */ + backup = *teken_get_curattr(&ts->ts_teken); + scteken_revattr(SC_KERNEL_CONS_ATTR, &kattr); + teken_set_curattr(&ts->ts_teken, &kattr); + teken_input(&ts->ts_teken, buf, len); + teken_set_curattr(&ts->ts_teken, &backup); + } else { + /* Print user messages with regular colors. */ + teken_input(&ts->ts_teken, buf, len); + } scp->sc->write_in_progress--; } diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 711272e..6791d64 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -95,16 +95,10 @@ static default_attr user_default = { SC_NORM_REV_ATTR, }; -static default_attr kernel_default = { - SC_KERNEL_CONS_ATTR, - SC_KERNEL_CONS_REV_ATTR, -}; - static int sc_console_unit = -1; static int sc_saver_keyb_only = 1; static scr_stat *sc_console; static struct consdev *sc_consptr; -static void *kernel_console_ts; static scr_stat main_console; static struct tty *main_devs[MAXCONS]; @@ -323,7 +317,7 @@ sctty_outwakeup(struct tty *tp) len = ttydisc_getc(tp, buf, sizeof buf); if (len == 0) break; - sc_puts(scp, buf, len); + sc_puts(scp, buf, len, 0); } } @@ -373,22 +367,8 @@ sc_attach_unit(int unit, int flags) /* assert(sc_console != NULL) */ flags |= SC_KERNEL_CONSOLE; scmeminit(NULL); - - scinit(unit, flags); - - if (sc_console->tsw->te_size > 0) { - /* assert(sc_console->ts != NULL); */ - kernel_console_ts = sc_console->ts; - sc_console->ts = malloc(sc_console->tsw->te_size, - M_DEVBUF, M_WAITOK); - bcopy(kernel_console_ts, sc_console->ts, sc_console->tsw->te_size); - (*sc_console->tsw->te_default_attr)(sc_console, - user_default.std_color, - user_default.rev_color); - } - } else { - scinit(unit, flags); } + scinit(unit, flags); sc = sc_get_softc(unit, flags & SC_KERNEL_CONSOLE); sc->config = flags; @@ -1507,7 +1487,6 @@ sc_cnputc(struct consdev *cd, int c) { u_char buf[1]; scr_stat *scp = sc_console; - void *save; #ifndef SC_NO_HISTORY #if 0 struct tty *tp; @@ -1543,12 +1522,8 @@ sc_cnputc(struct consdev *cd, int c) } #endif /* !SC_NO_HISTORY */ - save = scp->ts; - if (kernel_console_ts != NULL) - scp->ts = kernel_console_ts; buf[0] = c; - sc_puts(scp, buf, 1); - scp->ts = save; + sc_puts(scp, buf, 1, 1); s = spltty(); /* block sckbdevent and scrn_timer */ sccnupdate(scp); @@ -2492,7 +2467,7 @@ exchange_scr(sc_softc_t *sc) } void -sc_puts(scr_stat *scp, u_char *buf, int len) +sc_puts(scr_stat *scp, u_char *buf, int len, int kernel) { int need_unlock = 0; @@ -2507,7 +2482,7 @@ sc_puts(scr_stat *scp, u_char *buf, int len) need_unlock = 1; mtx_lock_spin(&scp->scr_lock); } - (*scp->tsw->te_puts)(scp, buf, len); + (*scp->tsw->te_puts)(scp, buf, len, kernel); if (need_unlock) mtx_unlock_spin(&scp->scr_lock); } @@ -2754,8 +2729,8 @@ scinit(int unit, int flags) if (sc_init_emulator(scp, SC_DFLT_TERM)) sc_init_emulator(scp, "*"); (*scp->tsw->te_default_attr)(scp, - kernel_default.std_color, - kernel_default.rev_color); + user_default.std_color, + user_default.rev_color); } else { /* assert(sc_malloc) */ sc->dev = malloc(sizeof(struct tty *)*sc->vtys, M_DEVBUF, diff --git a/sys/dev/syscons/syscons.h b/sys/dev/syscons/syscons.h index 56b30d3..c0ed6c1 100644 --- a/sys/dev/syscons/syscons.h +++ b/sys/dev/syscons/syscons.h @@ -368,7 +368,7 @@ typedef int sc_term_init_t(scr_stat *scp, void **tcp, int code); #define SC_TE_COLD_INIT 0 #define SC_TE_WARM_INIT 1 typedef int sc_term_term_t(scr_stat *scp, void **tcp); -typedef void sc_term_puts_t(scr_stat *scp, u_char *buf, int len); +typedef void sc_term_puts_t(scr_stat *scp, u_char *buf, int len, int kernel); typedef int sc_term_ioctl_t(scr_stat *scp, struct tty *tp, u_long cmd, caddr_t data, struct thread *td); typedef int sc_term_reset_t(scr_stat *scp, int code); @@ -553,7 +553,7 @@ void sc_save_font(scr_stat *scp, int page, int size, int width, void sc_show_font(scr_stat *scp, int page); void sc_touch_scrn_saver(void); -void sc_puts(scr_stat *scp, u_char *buf, int len); +void sc_puts(scr_stat *scp, u_char *buf, int len, int kernel); void sc_draw_cursor_image(scr_stat *scp); void sc_remove_cursor_image(scr_stat *scp); void sc_set_cursor_image(scr_stat *scp); diff --git a/sys/dev/syscons/teken/teken.c b/sys/dev/syscons/teken/teken.c index 5720859..f5555b0 100644 --- a/sys/dev/syscons/teken/teken.c +++ b/sys/dev/syscons/teken/teken.c @@ -336,6 +336,13 @@ teken_get_curattr(teken_t *t) return (&t->t_curattr); } +void +teken_set_curattr(teken_t *t, const teken_attr_t *a) +{ + + t->t_curattr = *a; +} + const teken_attr_t * teken_get_defattr(teken_t *t) { diff --git a/sys/dev/syscons/teken/teken.h b/sys/dev/syscons/teken/teken.h index dcd43d7..620dfd5 100644 --- a/sys/dev/syscons/teken/teken.h +++ b/sys/dev/syscons/teken/teken.h @@ -174,6 +174,7 @@ void teken_input(teken_t *, const void *, size_t); const teken_attr_t *teken_get_curattr(teken_t *); const teken_attr_t *teken_get_defattr(teken_t *); void teken_set_cursor(teken_t *, const teken_pos_t *); +void teken_set_curattr(teken_t *, const teken_attr_t *); void teken_set_defattr(teken_t *, const teken_attr_t *); void teken_set_winsize(teken_t *, const teken_pos_t *); diff --git a/sys/pc98/cbus/scterm-sck.c b/sys/pc98/cbus/scterm-sck.c index 2577f66..ce2324f 100644 --- a/sys/pc98/cbus/scterm-sck.c +++ b/sys/pc98/cbus/scterm-sck.c @@ -907,18 +907,24 @@ scterm_scan_esc(scr_stat *scp, term_stat *tcp, u_char c) } static void -scterm_puts(scr_stat *scp, u_char *buf, int len) +scterm_puts(scr_stat *scp, u_char *buf, int len, int kernel) { term_stat *tcp; u_char *ptr; #ifdef KANJI u_short kanji_code; #endif + color_t backup; tcp = scp->ts; ptr = buf; outloop: scp->sc->write_in_progress++; + backup = tcp->cur_color; + if (kernel) { + tcp->cur_color.fg = SC_KERNEL_CONS_ATTR & 0x0f; + tcp->cur_color.bg = (SC_KERNEL_CONS_ATTR >> 4) & 0x0f; + } if (tcp->esc) { scterm_scan_esc(scp, tcp, *ptr++); @@ -1101,6 +1107,8 @@ ascii_end: sc_term_gen_scroll(scp, scp->sc->scr_map[0x20], tcp->cur_attr); + if (kernel) + tcp->cur_color = backup; scp->sc->write_in_progress--; if (len) goto outloop; |