Mercurial > illumos > git > illumos-omnios
changeset 21429:01a16a874588
11085 loader: block all output via tem while tem is reconfigured
Reviewed by: Gergő Doma <domag02@gmail.com>
Approved by: Dan McDonald <danmcd@joyent.com>
author | Toomas Soome <tsoome@me.com> |
---|---|
date | Thu, 30 May 2019 22:06:01 +0300 |
parents | bbdf6d2b20bb |
children | a983baf303af |
files | usr/src/boot/sys/boot/common/tem.c |
diffstat | 1 files changed, 17 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/boot/sys/boot/common/tem.c Wed Jun 05 14:43:28 2019 +0000 +++ b/usr/src/boot/sys/boot/common/tem.c Thu May 30 22:06:01 2019 +0300 @@ -196,7 +196,7 @@ { struct tem_vt_state *tem = (struct tem_vt_state *)tem_arg; - if (!tem->tvs_initialized) { + if (tems.ts_initialized == 0 || tem->tvs_initialized == 0) { return; } @@ -252,10 +252,9 @@ { struct tem_vt_state *ptem; - ptem = malloc(sizeof (struct tem_vt_state)); + ptem = calloc(1, sizeof (struct tem_vt_state)); if (ptem == NULL) return ((tem_vt_state_t)ptem); - bzero(ptem, sizeof (*ptem)); ptem->tvs_isactive = false; ptem->tvs_fbmode = KD_TEXT; @@ -591,6 +590,7 @@ tem_modechg_cb_arg_t cb_arg; size_t height = 0; size_t width = 0; + int state; diff = tems_check_videomode(devinit); if (diff == 0) { @@ -625,10 +625,13 @@ plat_tem_get_prom_size(&height, &width); + state = tems.ts_initialized; + tems.ts_initialized = 0; /* stop all output */ tems_setup_terminal(devinit, height, width); tems_reset_colormap(); tems_get_initial_color(&tems.ts_init_color); + tems.ts_initialized = state; /* restore state */ for (p = list_head(&tems.ts_list); p != NULL; p = list_next(&tems.ts_list, p)) { @@ -790,7 +793,7 @@ /* clear */ width = tems.ts_font.vf_width; - ncols = (tems.ts_p_dimension.width + (width - 1))/ width; + ncols = (tems.ts_p_dimension.width + (width - 1)) / width; tem_pix_cls_range(tem, 0, nrows, tems.ts_p_offset.y, 0, ncols, 0, B_TRUE); @@ -1147,16 +1150,13 @@ break; case A_CSI: - { - int i; - tem->tvs_curparam = 0; - tem->tvs_paramval = 0; - tem->tvs_gotparam = B_FALSE; - /* clear the parameters */ - for (i = 0; i < TEM_MAXPARAMS; i++) - tem->tvs_params[i] = -1; - tem->tvs_state = A_STATE_CSI; - } + tem->tvs_curparam = 0; + tem->tvs_paramval = 0; + tem->tvs_gotparam = B_FALSE; + /* clear the parameters */ + for (int i = 0; i < TEM_MAXPARAMS; i++) + tem->tvs_params[i] = -1; + tem->tvs_state = A_STATE_CSI; break; case A_GS: @@ -1628,7 +1628,7 @@ static void tem_getparams(struct tem_vt_state *tem, uint8_t ch) { - if (ch >= '0' && ch <= '9') { + if (isdigit(ch)) { tem->tvs_paramval = ((tem->tvs_paramval * 10) + (ch - '0')); tem->tvs_gotparam = B_TRUE; /* Remember got parameter */ return; /* Return immediately */ @@ -2359,7 +2359,7 @@ offset = tems.ts_p_offset.y % height; nrows = tems.ts_p_offset.y / height; - ncols = (tems.ts_p_dimension.width + (width - 1))/ width; + ncols = (tems.ts_p_dimension.width + (width - 1)) / width; if (nrows > 0) tem_pix_cls_range(tem, 0, nrows, offset, 0, ncols, 0, @@ -2894,7 +2894,7 @@ return; width = tems.ts_c_dimension.width; - addr = tem->tvs_screen_buf + (row * width + col); + addr = tem->tvs_screen_buf + (row * width + col); for (i = 0; i < count; i++) { *addr++ = string[i]; }