diff options
| author | Ed Schouten <ed@FreeBSD.org> | 2009-03-10 11:28:54 +0000 |
|---|---|---|
| committer | Ed Schouten <ed@FreeBSD.org> | 2009-03-10 11:28:54 +0000 |
| commit | 630b9bf23fa7e7e4e8248031eb637900e91275d0 (patch) | |
| tree | 81b513a4d1a972e44f59deb62bedb21c604e26ae /sys/dev/syscons | |
| parent | 9541ada9a0c4eb92928b27bc7153bf582c433948 (diff) | |
Notes
Diffstat (limited to 'sys/dev/syscons')
| -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 |
5 files changed, 30 insertions, 36 deletions
diff --git a/sys/dev/syscons/scterm-teken.c b/sys/dev/syscons/scterm-teken.c index da344da6b955..491f82ab3c2b 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 711272eb8b72..6791d64cb1bc 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 56b30d324392..c0ed6c1fd642 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 5720859b89a6..f5555b0ada99 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 dcd43d72b7f5..620dfd57e670 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 *); |
