changeset 19240:5cc8d6ae0443

11973 tem: we only can translate colors 0-7 Reviewed by: Robert Mustacchi <rm@fingolfin.org> Reviewed by: Garrett D'Amore <garrett@damore.org> Approved by: Dan McDonald <danmcd@joyent.com>
author Toomas Soome <tsoome@me.com>
date Thu, 14 Nov 2019 14:35:34 +0200
parents 6ede5d6cae83
children 79022555a4a9
files usr/src/boot/Makefile.version usr/src/boot/sys/boot/common/tem.c usr/src/common/font/font.c usr/src/uts/common/io/tem_safe.c usr/src/uts/common/sys/rgb.h
diffstat 5 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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;
 	}
 }
 
--- 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	*/
--- 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
--- 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);