diff options
author | Toomas Soome <tsoome@me.com> | 2022-05-09 13:15:56 +0300 |
---|---|---|
committer | Garrett D'Amore <garrett@damore.org> | 2022-06-14 20:41:13 -0700 |
commit | 5c22bad5dcbd030d95aca36e1c2fb0f77b505e17 (patch) | |
tree | a707cd5dc5621da262c2650543052ff4701e3094 | |
parent | e760f15095bdc9fa107e7c20ed2a5e4fb5865c1d (diff) | |
download | illumos-joyent-5c22bad5dcbd030d95aca36e1c2fb0f77b505e17.tar.gz |
14680 tem: add support for window manipulation functions
Reviewed by: Yuri Pankov <ypankov@tintri.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Garrett D'Amore <garrett@damore.org>
Change-Id: I6268ce2e74bc2686ddc70792cdf699bbabc479d5
-rw-r--r-- | usr/src/uts/common/io/conskbd.c | 11 | ||||
-rw-r--r-- | usr/src/uts/common/io/tem.c | 3 | ||||
-rw-r--r-- | usr/src/uts/common/io/tem_safe.c | 56 | ||||
-rw-r--r-- | usr/src/uts/common/io/vcons.c | 2 | ||||
-rw-r--r-- | usr/src/uts/common/sys/tem.h | 3 | ||||
-rw-r--r-- | usr/src/uts/common/sys/tem_impl.h | 1 |
6 files changed, 72 insertions, 4 deletions
diff --git a/usr/src/uts/common/io/conskbd.c b/usr/src/uts/common/io/conskbd.c index feaf659d33..03188b3a6c 100644 --- a/usr/src/uts/common/io/conskbd.c +++ b/usr/src/uts/common/io/conskbd.c @@ -149,7 +149,7 @@ static struct qinit conskbdlrinit = { /* lower write processing procedures structures */ static struct qinit conskbdlwinit = { putq, /* qi_putp */ - conskbdlwserv, /* qi_srvp */ + conskbdlwserv, /* qi_srvp */ (int (*)())NULL, /* qi_qopen */ (int (*)())NULL, /* qi_qclose */ (int (*)())NULL, /* qi_qadmin */ @@ -1131,6 +1131,15 @@ conskbdlrput(queue_t *q, mblk_t *mp) DPRINTF(PRINT_L1, PRINT_MASK_ALL, ("conskbdlrput\n")); switch (mp->b_datap->db_type) { + case M_CTL: + mp->b_datap->db_type = M_DATA; + if (conskbd.conskbd_directio) + putnext(conskbd_regqueue, mp); + else if (conskbd_consqueue != NULL) + putnext(conskbd_consqueue, mp); + else + freemsg(mp); + break; case M_FLUSH: if (*mp->b_rptr == FLUSHR) { diff --git a/usr/src/uts/common/io/tem.c b/usr/src/uts/common/io/tem.c index 42b34ab37c..7c34655bd6 100644 --- a/usr/src/uts/common/io/tem.c +++ b/usr/src/uts/common/io/tem.c @@ -276,7 +276,7 @@ tem_initialized(tem_vt_state_t tem_arg) } tem_vt_state_t -tem_init(cred_t *credp) +tem_init(cred_t *credp, queue_t *rq) { struct tem_vt_state *ptem; @@ -288,6 +288,7 @@ tem_init(cred_t *credp) ptem->tvs_isactive = B_FALSE; ptem->tvs_fbmode = KD_TEXT; + ptem->tvs_queue = rq; /* * A tem is regarded as initialized only after tem_internal_init(), diff --git a/usr/src/uts/common/io/tem_safe.c b/usr/src/uts/common/io/tem_safe.c index 41f93c42be..04e598f994 100644 --- a/usr/src/uts/common/io/tem_safe.c +++ b/usr/src/uts/common/io/tem_safe.c @@ -845,6 +845,57 @@ tem_safe_selgraph(struct tem_vt_state *tem) } /* + * Handle window manipulation. + */ +static void +tem_safe_window(struct tem_vt_state *tem, enum called_from called_from) +{ + int curparam; + int param; + int index = 0; + mblk_t *bp; + size_t len; + char buf[27]; + + tem->tvs_state = A_STATE_START; + curparam = tem->tvs_curparam; + do { + param = tem->tvs_params[index]; + + switch (param) { + case 8: /* Resize window to Ps2 lines and Ps3 columns. */ + /* We ignore this */ + index += 2; + curparam -= 2; + break; + + case 18: /* Reports terminal size in characters. */ + if (called_from == CALLED_FROM_STANDALONE) + break; + if (!canputnext(tem->tvs_queue)) + break; + + /* Response: CSI 8 ; lines ; columns t */ + len = snprintf(buf, sizeof (buf), "%c[8;%u;%ut", + 0x1b, tems.ts_c_dimension.height, + tems.ts_c_dimension.width); + + bp = allocb(len, BPRI_HI); + if (bp != NULL) { + bp->b_datap->db_type = M_CTL; + bcopy(buf, bp->b_wptr, len); + bp->b_wptr += len; + (void) putnext(tem->tvs_queue, bp); + } + break; + } + + index++; + curparam--; + } while (curparam > 0); +} + +/* * perform the appropriate action for the escape sequence * * General rule: This code does not validate the arguments passed. @@ -1080,6 +1131,11 @@ tem_safe_chkparam(struct tem_vt_state *tem, tem_char_t ch, cred_t *credp, credp, called_from); break; + case 't': + tem_safe_send_data(tem, credp, called_from); + tem_safe_window(tem, called_from); + break; + case 'X': /* erase char */ tem_safe_setparam(tem, 1, 1); tem_safe_clear_chars(tem, diff --git a/usr/src/uts/common/io/vcons.c b/usr/src/uts/common/io/vcons.c index 5d7a1c67d0..54d0b76b1c 100644 --- a/usr/src/uts/common/io/vcons.c +++ b/usr/src/uts/common/io/vcons.c @@ -351,7 +351,7 @@ vt_open(minor_t minor, queue_t *rq, cred_t *crp) * vc_tem might not be intialized if !tems.ts_initialized, * and this only happens during console configuration. */ - pvc->vc_tem = tem_init(crp); + pvc->vc_tem = tem_init(crp, rq); } if (!(pvc->vc_flags & WCS_INIT)) diff --git a/usr/src/uts/common/sys/tem.h b/usr/src/uts/common/sys/tem.h index 6fa3ca01a3..549c2c4deb 100644 --- a/usr/src/uts/common/sys/tem.h +++ b/usr/src/uts/common/sys/tem.h @@ -33,6 +33,7 @@ extern "C" { #ifdef _KERNEL +#include <sys/stream.h> #include <sys/visual_io.h> #include <sys/cred.h> #include <sys/beep.h> @@ -44,7 +45,7 @@ typedef struct __tem_vt_state *tem_vt_state_t; boolean_t tem_initialized(tem_vt_state_t); -tem_vt_state_t tem_init(cred_t *); +tem_vt_state_t tem_init(cred_t *, queue_t *); void tem_destroy(tem_vt_state_t, cred_t *); diff --git a/usr/src/uts/common/sys/tem_impl.h b/usr/src/uts/common/sys/tem_impl.h index 8af55ab75f..202eebb45b 100644 --- a/usr/src/uts/common/sys/tem_impl.h +++ b/usr/src/uts/common/sys/tem_impl.h @@ -187,6 +187,7 @@ typedef struct term_char { * State structure for each virtual terminal emulator */ struct tem_vt_state { + queue_t *tvs_queue; /* read queue for console */ kmutex_t tvs_lock; uchar_t tvs_fbmode; /* framebuffer mode */ uchar_t tvs_alpha; /* rgb alpha channel */ |