# HG changeset patch # User Toomas Soome # Date 1573734934 -7200 # Node ID 5cc8d6ae04439db1a82b3f09f917a48824746ca7 # Parent 6ede5d6cae835a3f17b2c28404be3dae9294bc4b 11973 tem: we only can translate colors 0-7 Reviewed by: Robert Mustacchi Reviewed by: Garrett D'Amore Approved by: Dan McDonald diff -r 6ede5d6cae83 -r 5cc8d6ae0443 usr/src/boot/Makefile.version --- a/usr/src/boot/Makefile.version Wed Nov 20 11:17:48 2019 +0200 +++ b/usr/src/boot/Makefile.version Thu Nov 14 14:35:34 2019 +0200 @@ -33,4 +33,4 @@ # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes. # The version is processed from left to right, the version number can only # be increased. -BOOT_VERSION = $(LOADER_VERSION)-2019.11.06.1 +BOOT_VERSION = $(LOADER_VERSION)-2019.11.15.1 diff -r 6ede5d6cae83 -r 5cc8d6ae0443 usr/src/boot/sys/boot/common/tem.c --- a/usr/src/boot/sys/boot/common/tem.c Wed Nov 20 11:17:48 2019 +0200 +++ b/usr/src/boot/sys/boot/common/tem.c Thu Nov 14 14:35:34 2019 +0200 @@ -2815,23 +2815,22 @@ static void tem_get_color(text_color_t *fg, text_color_t *bg, term_char_t c) { - if (c.tc_fg_color < 16) { + *fg = c.tc_fg_color; + *bg = c.tc_bg_color; + + if (c.tc_fg_color < XLATE_NCOLORS) { if (TEM_CHAR_ATTR(c.tc_char) & (TEM_ATTR_BRIGHT_FG | TEM_ATTR_BOLD)) *fg = brt_xlate[c.tc_fg_color]; else *fg = dim_xlate[c.tc_fg_color]; - } else { - *fg = c.tc_fg_color; } - if (c.tc_bg_color < 16) { + if (c.tc_bg_color < XLATE_NCOLORS) { if (TEM_CHAR_ATTR(c.tc_char) & TEM_ATTR_BRIGHT_BG) *bg = brt_xlate[c.tc_bg_color]; else *bg = dim_xlate[c.tc_bg_color]; - } else { - *bg = c.tc_bg_color; } } diff -r 6ede5d6cae83 -r 5cc8d6ae0443 usr/src/common/font/font.c --- a/usr/src/common/font/font.c Wed Nov 20 11:17:48 2019 +0200 +++ b/usr/src/common/font/font.c Thu Nov 14 14:35:34 2019 +0200 @@ -48,9 +48,9 @@ /* ANSI color to sun color translation. */ /* BEGIN CSTYLED */ -/* Bk Rd Gr Br Bl Mg Cy Wh */ -const uint8_t dim_xlate[] = { 1, 5, 3, 7, 2, 6, 4, 8 }; -const uint8_t brt_xlate[] = { 9, 13, 11, 15, 10, 14, 12, 0 }; +/* Bk Rd Gr Br Bl Mg Cy Wh */ +const uint8_t dim_xlate[XLATE_NCOLORS] = { 1, 5, 3, 7, 2, 6, 4, 8 }; +const uint8_t brt_xlate[XLATE_NCOLORS] = { 9, 13, 11, 15, 10, 14, 12, 0 }; const uint8_t solaris_color_to_pc_color[16] = { pc_brt_white, /* 0 - brt_white */ diff -r 6ede5d6cae83 -r 5cc8d6ae0443 usr/src/uts/common/io/tem_safe.c --- a/usr/src/uts/common/io/tem_safe.c Wed Nov 20 11:17:48 2019 +0200 +++ b/usr/src/uts/common/io/tem_safe.c Thu Nov 14 14:35:34 2019 +0200 @@ -2375,7 +2375,7 @@ *fg = c.tc_fg_color; *bg = c.tc_bg_color; - if (c.tc_fg_color < 16) { + if (c.tc_fg_color < XLATE_NCOLORS) { if (TEM_ATTR_ISSET(c.tc_char, TEM_ATTR_BRIGHT_FG | TEM_ATTR_BOLD)) *fg = brt_xlate[c.tc_fg_color]; @@ -2383,7 +2383,7 @@ *fg = dim_xlate[c.tc_fg_color]; } - if (c.tc_bg_color < 16) { + if (c.tc_bg_color < XLATE_NCOLORS) { if (TEM_ATTR_ISSET(c.tc_char, TEM_ATTR_BRIGHT_BG)) *bg = brt_xlate[c.tc_bg_color]; else diff -r 6ede5d6cae83 -r 5cc8d6ae0443 usr/src/uts/common/sys/rgb.h --- a/usr/src/uts/common/sys/rgb.h Wed Nov 20 11:17:48 2019 +0200 +++ b/usr/src/uts/common/sys/rgb.h Thu Nov 14 14:35:34 2019 +0200 @@ -67,8 +67,9 @@ pc_brt_white = 15 } pc_colors_t; -extern const uint8_t dim_xlate[]; -extern const uint8_t brt_xlate[]; +#define XLATE_NCOLORS 8 +extern const uint8_t dim_xlate[XLATE_NCOLORS]; +extern const uint8_t brt_xlate[XLATE_NCOLORS]; extern const uint8_t solaris_color_to_pc_color[16]; extern uint32_t rgb_color_map(const rgb_t *, uint8_t);