9589 ldterm_dosig() can send empty mblks downstream
Reviewed by: Dominik Hassler <hadfl@omniosce.org>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Gordon Ross <gwr@nexenta.com>
9042 multiples of tty streams modules cause weirdness
Reviewed by: Randy Fishel <randyf@sibernet.com>
Reviewed by: Carlos Neira <cneirabustos@gmail.com>
Approved by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
NEX-16819 loader UEFI support
Includes work by Toomas Soome <tsoome@me.com>
Upstream commits:
loader: pxe receive cleanup
9475 libefi: Do not return only if ReceiveFilter
installboot: should support efi system partition
8931 boot1.efi: scan all display modes rather than
loader: spinconsole updates
loader: gfx experiment to try GOP Blt() function.
sha1 build test
loader: add sha1 hash calculation
common/sha1: update for loader build
loader: biosdisk rework
uts: 32-bit kernel FB needs mapping in low memory
uts: add diag-device
uts: boot console mirror with diag-device
uts: enable very early console on ttya
kmdb: add diag-device as input/output device
uts: test VGA memory exclusion from mapping
uts: clear boot mapping and protect boot pages test
uts: add dboot map debug printf
uts: need to release FB pages in release_bootstrap()
uts: add screenmap ioctl
uts: update sys/queue.h
loader: add illumos uts/common to include path
loader: tem/gfx font cleanup
loader: vbe checks
uts: gfx_private set KD_TEXT when KD_RESETTEXT is
uts: gfx 8-bit update
loader: gfx 8-bit fix
loader: always set media size from partition.
uts: MB2 support for 32-bit kernel
loader: x86 should have tem 80x25
uts: x86 should have tem 80x25
uts: font update
loader: font update
uts: tem attributes
loader: tem.c comment added
uts: use font module
loader: add font module
loader: build rules for new font setup
uts: gfx_private update for new font structure
uts: early boot update for new font structure
uts: font update
uts: font build rules update for new fonts
uts: tem update to new font structure
loader: module.c needs to include tem_impl.h
uts: gfx_private 8x16 font rework
uts: make font_lookup public
loader: font rework
uts: font rework
9259 libefi: efi_alloc_and_read should check for PMBR
uts: tem utf-8 support
loader: implement tem utf-8 support
loader: tem should be able to display UTF-8
7784 uts: console input should support utf-8
7796 uts: ldterm default to utf-8
uts: do not reset serial console
uts: set up colors even if tem is not console
uts: add type for early boot properties
uts: gfx_private experiment with drm and vga
uts: gfx_private should use setmode drm callback.
uts: identify FB types and set up gfx_private based
loader: replace gop and vesa with framebuffer
uts: boot needs simple tem to support mdb
uts: boot_keyboard should emit esc sequences for
uts: gfx_private FB showuld be written by line
kmdb: set terminal window size
uts: gfx_private needs to keep track of early boot FB
pnglite: move pnglite to usr/src/common
loader: gfx_fb
ficl-sys: add gfx primitives
loader: add illumos.png logo
ficl: add fb-putimage
loader: add png support
loader: add alpha blending for gfx_fb
loader: use term-drawrect for menu frame
ficl: add simple gfx words
uts: provide fb_info via fbgattr dev_specific array.
uts: gfx_private add alpha blending
uts: update sys/ascii.h
uts: tem OSC support (incomplete)
uts: implement env module support and use data from
uts: tem get colors from early boot data
loader: use crc32 from libstand (libz)
loader: optimize for size
loader: pass tem info to the environment
loader: import tem for loader console
loader: UEFI loader needs to set ISADIR based on
loader: need UEFI32 support
8918 loader.efi: add vesa edid support
uts: tem_safe_pix_clear_prom_output() should only
uts: tem_safe_pix_clear_entire_screen() should use
uts: tem_safe_check_first_time() should query cursor
uts: tem implement cls callback & visual_io v4
uts: gfx_vgatext use block cursor for vgatext
uts: gfx_private implement cls callback & visual_io
uts: gfx_private bitmap framebuffer implementation
uts: early start frame buffer console support
uts: font functions should check the input char
uts: font rendering should support 16/24/32bit depths
uts: use smallest font as fallback default.
uts: update terminal dimensions based on selected
7834 uts: vgatext should use gfx_private
uts: add spacing property to 8859-1.bdf
terminfo: add underline for sun-color
terminfo: sun-color has 16 colors
uts: add font load callback type
loader: do not repeat int13 calls with error 0x20 and
8905 loader: add skein/edonr support
8904 common/crypto: make skein and edonr loader
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Revert "NEX-16819 loader UEFI support"
This reverts commit ec06b9fc617b99234e538bf2e7e4d02a24993e0c.
Reverting due to failures in the zfs-tests and the sharefs-tests
NEX-16819 loader UEFI support
Includes work by Toomas Soome <tsoome@me.com>
Upstream commits:
loader: pxe receive cleanup
9475 libefi: Do not return only if ReceiveFilter
installboot: should support efi system partition
8931 boot1.efi: scan all display modes rather than
loader: spinconsole updates
loader: gfx experiment to try GOP Blt() function.
sha1 build test
loader: add sha1 hash calculation
common/sha1: update for loader build
loader: biosdisk rework
uts: 32-bit kernel FB needs mapping in low memory
uts: add diag-device
uts: boot console mirror with diag-device
uts: enable very early console on ttya
kmdb: add diag-device as input/output device
uts: test VGA memory exclusion from mapping
uts: clear boot mapping and protect boot pages test
uts: add dboot map debug printf
uts: need to release FB pages in release_bootstrap()
uts: add screenmap ioctl
uts: update sys/queue.h
loader: add illumos uts/common to include path
loader: tem/gfx font cleanup
loader: vbe checks
uts: gfx_private set KD_TEXT when KD_RESETTEXT is
uts: gfx 8-bit update
loader: gfx 8-bit fix
loader: always set media size from partition.
uts: MB2 support for 32-bit kernel
loader: x86 should have tem 80x25
uts: x86 should have tem 80x25
uts: font update
loader: font update
uts: tem attributes
loader: tem.c comment added
uts: use font module
loader: add font module
loader: build rules for new font setup
uts: gfx_private update for new font structure
uts: early boot update for new font structure
uts: font update
uts: font build rules update for new fonts
uts: tem update to new font structure
loader: module.c needs to include tem_impl.h
uts: gfx_private 8x16 font rework
uts: make font_lookup public
loader: font rework
uts: font rework
libefi: efi_alloc_and_read should check for PMBR
uts: tem utf-8 support
loader: implement tem utf-8 support
loader: tem should be able to display UTF-8
7784 uts: console input should support utf-8
7796 uts: ldterm default to utf-8
uts: do not reset serial console
uts: set up colors even if tem is not console
uts: add type for early boot properties
uts: gfx_private experiment with drm and vga
uts: gfx_private should use setmode drm callback.
uts: identify FB types and set up gfx_private based
loader: replace gop and vesa with framebuffer
uts: boot needs simple tem to support mdb
uts: boot_keyboard should emit esc sequences for
uts: gfx_private FB showuld be written by line
kmdb: set terminal window size
uts: gfx_private needs to keep track of early boot FB
pnglite: move pnglite to usr/src/common
loader: gfx_fb
ficl-sys: add gfx primitives
loader: add illumos.png logo
ficl: add fb-putimage
loader: add png support
loader: add alpha blending for gfx_fb
loader: use term-drawrect for menu frame
ficl: add simple gfx words
uts: provide fb_info via fbgattr dev_specific array.
uts: gfx_private add alpha blending
uts: update sys/ascii.h
uts: tem OSC support (incomplete)
uts: implement env module support and use data from
uts: tem get colors from early boot data
loader: use crc32 from libstand (libz)
loader: optimize for size
loader: pass tem info to the environment
loader: import tem for loader console
loader: UEFI loader needs to set ISADIR based on
loader: need UEFI32 support
8918 loader.efi: add vesa edid support
uts: tem_safe_pix_clear_prom_output() should only
uts: tem_safe_pix_clear_entire_screen() should use
uts: tem_safe_check_first_time() should query cursor
uts: tem implement cls callback & visual_io v4
uts: gfx_vgatext use block cursor for vgatext
uts: gfx_private implement cls callback & visual_io
uts: gfx_private bitmap framebuffer implementation
uts: early start frame buffer console support
uts: font functions should check the input char
uts: font rendering should support 16/24/32bit depths
uts: use smallest font as fallback default.
uts: update terminal dimensions based on selected
7834 uts: vgatext should use gfx_private
uts: add spacing property to 8859-1.bdf
terminfo: add underline for sun-color
terminfo: sun-color has 16 colors
uts: add font load callback type
loader: do not repeat int13 calls with error 0x20 and
8905 loader: add skein/edonr support
8904 common/crypto: make skein and edonr loader
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 * Copyright (c) 2014, Joyent, Inc. All rights reserved. 25 */ 26 27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 28 /* All Rights Reserved */ 29 30 /* 31 * University Copyright- Copyright (c) 1982, 1986, 1988 32 * The Regents of the University of California 33 * All Rights Reserved 34 * 35 * University Acknowledgment- Portions of this document are derived from 36 * software developed by the University of California, Berkeley, and its 37 * contributors. 38 */ 39 40 /* 41 * Standard Streams Terminal Line Discipline module. 42 */ 43 44 #include <sys/param.h>
364 /* 040 */ ' ', '!', '"', '#', '$', '%', '&', '\'',
365 /* 050 */ '(', ')', '*', '+', ',', '-', '.', '/',
366 /* 060 */ '0', '1', '2', '3', '4', '5', '6', '7',
367 /* 070 */ '8', '9', ':', ';', '<', '=', '>', '?',
368 /* 100 */ '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
369 /* 110 */ 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
370 /* 120 */ 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
371 /* 130 */ 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
372 /* 140 */ '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
373 /* 150 */ 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
374 /* 160 */ 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
375 /* 170 */ 'X', 'Y', 'Z', '{', '|', '}', '~', 0,
376 /* 200 - 377 aren't mapped (they're stoppers). */
377 };
378
379 static struct streamtab ldtrinfo;
380
381 static struct fmodsw fsw = {
382 "ldterm",
383 &ldtrinfo,
384 D_MTQPAIR | D_MP
385 };
386
387 static struct modlstrmod modlstrmod = {
388 &mod_strmodops, "terminal line discipline", &fsw
389 };
390
391
392 static struct modlinkage modlinkage = {
393 MODREV_1, &modlstrmod, NULL
394 };
395
396
397 int
398 _init(void)
399 {
400 return (mod_install(&modlinkage));
401 }
402
403 int
404 _fini(void)
710 tp->t_endmsg = NULL; 711 tp->t_msglen = 0; 712 tp->t_rd_request = 0; 713 714 tp->t_echomp = NULL; 715 tp->t_iocid = 0; 716 tp->t_wbufcid = 0; 717 tp->t_vtid = 0; 718 719 q->q_ptr = (caddr_t)tp; 720 WR(q)->q_ptr = (caddr_t)tp; 721 /* 722 * The following for EUC and also non-EUC codesets: 723 */ 724 tp->t_codeset = tp->t_eucleft = tp->t_eucign = tp->t_scratch_len = 0; 725 bzero(&tp->eucwioc, EUCSIZE); 726 tp->eucwioc.eucw[0] = 1; /* ASCII mem & screen width */ 727 tp->eucwioc.scrw[0] = 1; 728 tp->t_maxeuc = 1; /* the max len in bytes of an EUC char */ 729 tp->t_eucp = NULL; 730 tp->t_eucp_mp = NULL; 731 tp->t_eucwarn = 0; /* no bad chars seen yet */ 732 733 tp->t_csdata = default_cs_data; 734 tp->t_csmethods = cs_methods[LDTERM_CS_TYPE_EUC]; 735 736 qprocson(q); 737 738 /* 739 * Find out if the module below us does canonicalization; if 740 * so, we won't do it ourselves. 741 */ 742 743 if ((qryp = open_ioctl(q, MC_CANONQUERY)) == NULL) 744 goto open_abort; 745 746 /* 747 * Reformulate as an M_CTL message. The actual data will 748 * be in the b_cont field. 749 */ 750 qryp->b_datap->db_type = M_CTL; 751 wq = OTHERQ(q); 752 putnext(wq, qryp); 753 754 /* allocate a TCSBRK ioctl in case we'll need it on close */ 755 if ((qryp = open_ioctl(q, TCSBRK)) == NULL)
4051 * routine to prevent flushing our
4052 * own data. Note that downstream
4053 * modules on the write side will be
4054 * flushed by the M_FLUSH sent above.
4055 */
4056 tp->t_state |= TS_FLUSHWAIT;
4057 (void) putnextctl1(q, M_FLUSH, FLUSHW);
4058 if (tp->t_state & TS_TTSTOP) {
4059 (void) putnextctl(WR(q), M_START);
4060 tp->t_state &= ~(TS_TTSTOP|TS_OFBLOCK);
4061 }
4062 }
4063 }
4064 }
4065 tp->t_state &= ~TS_QUOT;
4066 if (sndsig == 0)
4067 (void) putnextctl1(q, mtype, sig);
4068
4069 if (c != '\0') {
4070 if ((tp->t_echomp = allocb(4, BPRI_HI)) != NULL) {
4071 (void) ldterm_echo(c, WR(q), 4, tp);
4072 putnext(WR(q), tp->t_echomp);
4073 tp->t_echomp = NULL;
4074 }
4075 }
4076 }
4077
4078
4079 /*
4080 * Called when an M_IOCTL message is seen on the write queue; does
4081 * whatever we're supposed to do with it, and either replies
4082 * immediately or passes it to the next module down.
4083 */
4084 static void
4085 ldterm_do_ioctl(queue_t *q, mblk_t *mp)
4086 {
4087 ldtermstd_state_t *tp;
4088 struct iocblk *iocp;
4089 struct eucioc *euciocp; /* needed for EUC ioctls */
4090 ldterm_cs_data_user_t *csdp;
4091 int i;
4092 int locale_name_sz;
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 * Copyright (c) 2014, Joyent, Inc. All rights reserved.
25 * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
26 */
27
28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
29 /* All Rights Reserved */
30
31 /*
32 * University Copyright- Copyright (c) 1982, 1986, 1988
33 * The Regents of the University of California
34 * All Rights Reserved
35 *
36 * University Acknowledgment- Portions of this document are derived from
37 * software developed by the University of California, Berkeley, and its
38 * contributors.
39 */
40
41 /*
42 * Standard Streams Terminal Line Discipline module.
43 */
44
45 #include <sys/param.h>
365 /* 040 */ ' ', '!', '"', '#', '$', '%', '&', '\'',
366 /* 050 */ '(', ')', '*', '+', ',', '-', '.', '/',
367 /* 060 */ '0', '1', '2', '3', '4', '5', '6', '7',
368 /* 070 */ '8', '9', ':', ';', '<', '=', '>', '?',
369 /* 100 */ '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
370 /* 110 */ 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
371 /* 120 */ 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
372 /* 130 */ 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
373 /* 140 */ '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
374 /* 150 */ 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
375 /* 160 */ 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
376 /* 170 */ 'X', 'Y', 'Z', '{', '|', '}', '~', 0,
377 /* 200 - 377 aren't mapped (they're stoppers). */
378 };
379
380 static struct streamtab ldtrinfo;
381
382 static struct fmodsw fsw = {
383 "ldterm",
384 &ldtrinfo,
385 D_MTQPAIR | D_MP | _D_SINGLE_INSTANCE
386 };
387
388 static struct modlstrmod modlstrmod = {
389 &mod_strmodops, "terminal line discipline", &fsw
390 };
391
392
393 static struct modlinkage modlinkage = {
394 MODREV_1, &modlstrmod, NULL
395 };
396
397
398 int
399 _init(void)
400 {
401 return (mod_install(&modlinkage));
402 }
403
404 int
405 _fini(void)
711 tp->t_endmsg = NULL; 712 tp->t_msglen = 0; 713 tp->t_rd_request = 0; 714 715 tp->t_echomp = NULL; 716 tp->t_iocid = 0; 717 tp->t_wbufcid = 0; 718 tp->t_vtid = 0; 719 720 q->q_ptr = (caddr_t)tp; 721 WR(q)->q_ptr = (caddr_t)tp; 722 /* 723 * The following for EUC and also non-EUC codesets: 724 */ 725 tp->t_codeset = tp->t_eucleft = tp->t_eucign = tp->t_scratch_len = 0; 726 bzero(&tp->eucwioc, EUCSIZE); 727 tp->eucwioc.eucw[0] = 1; /* ASCII mem & screen width */ 728 tp->eucwioc.scrw[0] = 1; 729 tp->t_maxeuc = 1; /* the max len in bytes of an EUC char */ 730 tp->t_eucp = NULL; 731 tp->t_csmethods = cs_methods[LDTERM_CS_TYPE_EUC]; 732 tp->t_csdata = default_cs_data; 733 734 /* 735 * Try to switch to UTF-8 mode by allocating buffer for multibyte 736 * chars, keep EUC if allocation fails. 737 */ 738 if ((tp->t_eucp_mp = allocb(_TTY_BUFSIZ, BPRI_HI)) != NULL) { 739 tp->t_eucp = tp->t_eucp_mp->b_rptr; 740 tp->t_state = TS_MEUC; /* Multibyte mode. */ 741 tp->t_maxeuc = 4; /* the max len in bytes of an UTF-8 char */ 742 tp->t_csdata.codeset_type = LDTERM_CS_TYPE_UTF8; 743 tp->t_csdata.csinfo_num = 4; 744 /* locale_name needs string length with terminating NUL */ 745 tp->t_csdata.locale_name = (char *)kmem_alloc(6, KM_SLEEP); 746 (void) strcpy(tp->t_csdata.locale_name, "UTF-8"); 747 tp->t_csmethods = cs_methods[LDTERM_CS_TYPE_UTF8]; 748 } 749 tp->t_eucwarn = 0; /* no bad chars seen yet */ 750 751 qprocson(q); 752 753 /* 754 * Find out if the module below us does canonicalization; if 755 * so, we won't do it ourselves. 756 */ 757 758 if ((qryp = open_ioctl(q, MC_CANONQUERY)) == NULL) 759 goto open_abort; 760 761 /* 762 * Reformulate as an M_CTL message. The actual data will 763 * be in the b_cont field. 764 */ 765 qryp->b_datap->db_type = M_CTL; 766 wq = OTHERQ(q); 767 putnext(wq, qryp); 768 769 /* allocate a TCSBRK ioctl in case we'll need it on close */ 770 if ((qryp = open_ioctl(q, TCSBRK)) == NULL)
4066 * routine to prevent flushing our
4067 * own data. Note that downstream
4068 * modules on the write side will be
4069 * flushed by the M_FLUSH sent above.
4070 */
4071 tp->t_state |= TS_FLUSHWAIT;
4072 (void) putnextctl1(q, M_FLUSH, FLUSHW);
4073 if (tp->t_state & TS_TTSTOP) {
4074 (void) putnextctl(WR(q), M_START);
4075 tp->t_state &= ~(TS_TTSTOP|TS_OFBLOCK);
4076 }
4077 }
4078 }
4079 }
4080 tp->t_state &= ~TS_QUOT;
4081 if (sndsig == 0)
4082 (void) putnextctl1(q, mtype, sig);
4083
4084 if (c != '\0') {
4085 if ((tp->t_echomp = allocb(4, BPRI_HI)) != NULL) {
4086 if (ldterm_echo(c, WR(q), 4, tp) > 0)
4087 putnext(WR(q), tp->t_echomp);
4088 else
4089 freemsg(tp->t_echomp);
4090 tp->t_echomp = NULL;
4091 }
4092 }
4093 }
4094
4095
4096 /*
4097 * Called when an M_IOCTL message is seen on the write queue; does
4098 * whatever we're supposed to do with it, and either replies
4099 * immediately or passes it to the next module down.
4100 */
4101 static void
4102 ldterm_do_ioctl(queue_t *q, mblk_t *mp)
4103 {
4104 ldtermstd_state_t *tp;
4105 struct iocblk *iocp;
4106 struct eucioc *euciocp; /* needed for EUC ioctls */
4107 ldterm_cs_data_user_t *csdp;
4108 int i;
4109 int locale_name_sz;
|