freebsd-nq/sys
Bruce Evans d91400bf98 Restore switching to a separate kernel terminal "input" state and extend
it to a separate state for each CPU.

Terminal "input" is user or kernel output.  Its state includes the current
parser state for escape sequences and multi-byte characters, and some
results of previous parsing (mainly attributes), and in teken the cursor
position, but not completed output.  This state must be switched for kernel
output since the kernel can preempt anything, including itself, and this
must not affect the preempted state more than necessary.  Since vty0 is
shared, it is necessary to affect the frame buffer and cursor position and
history, but escape sequences must not be affected and attributes for
further output must not be affected.

This used to work.  The syscons terminal state contained mainly the parser
state for escape sequences and attributes, but not the cursor position,
and was switched.  This was first broken by SMP and/or preemptive kernels.
Then there should really be a separate state for each thread, and one more
for ddb, or locking to prevent preemption.  Serialization of printf() helps.
But it is arcane that full syscons escape sequences mostly work in kernel
printf(), and I have never seen them used except by me to test this fix.
They worked perfectly except for the races, since "input" from the kernel
was not special in any way.

This was broken to use teken.  The general switch was removed, and the
kernel normal attribute was switched specially.  The kernel reverse
attribute (config option SC_CONS_REVERSE_ATTR) became unused, and is
still unusable because teken doesn't support default reverse attributes
(it used to only be used via the ANSI escape sequence to set reverse
video).

The only new difficulty for using teken seems to be that the cursor
position is in the "input" state, so it must be updated in the active
input state for each half of the switch.  Do this to complete the
restoration.

The per-CPU state is mainly to make per-CPU coloring work cleanly, at
a cost of some space.  Each CPU gets its own full set of attribute
(not just the current attribute) maintained in the usual way.  This
also reduces races from unserialized printf()s.  However, this gives
races for serialized printf()s that otherwise have none.  Nothing
prevents the CPU doing the a printf() changing in the middle of an
escape sequence.
2017-03-26 13:03:16 +00:00
..
amd64 specific end of interrupt implementation for AMD Local APIC 2017-03-25 18:45:09 +00:00
arm Preserve VFP state across signal delivery. 2017-03-26 08:36:56 +00:00
arm64 Add 'device iic' to bring in userland I2C driver. 2017-03-24 22:33:03 +00:00
boot The original author abused Nd (one-line description, used by makewhatis) 2017-03-23 08:34:30 +00:00
bsm
cam Remove "UNMAPPED" messages printed on da periph attach. 2017-03-23 10:50:45 +00:00
cddl MFV r315290, r315291: 7303 dynamic metaslab selection 2017-03-24 09:37:00 +00:00
compat Implement Linux mincore() system call. 2017-03-25 15:47:29 +00:00
conf Use inline asm instead of unportable intrinsics for the SSE4 crc32 2017-03-26 10:31:48 +00:00
contrib Copy needed include files from EDK2. This is a minimal set gleened 2017-03-08 02:47:59 +00:00
crypto
ddb Fix right shifts on arches with db_expr_t larger than u_int (LP64 arches 2017-03-18 07:01:18 +00:00
dev Restore switching to a separate kernel terminal "input" state and extend 2017-03-26 13:03:16 +00:00
fs remove procfs ctl interface 2017-03-05 03:05:24 +00:00
gdb
geom After r315112 I broke the tests with eli, instead to pass 0, I should pass 2017-03-13 13:56:01 +00:00
gnu Update our device tree files to a Linux 4.10 2017-03-07 13:56:49 +00:00
i386 specific end of interrupt implementation for AMD Local APIC 2017-03-25 18:45:09 +00:00
isa Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
kern dtrace sched:::preempt should fire only when there is preemption 2017-03-25 19:08:51 +00:00
kgssapi
libkern Use inline asm instead of unportable intrinsics for the SSE4 crc32 2017-03-26 10:31:48 +00:00
mips [mips/broadcom]: Early boot NVRAM support 2017-03-23 19:29:12 +00:00
modules Add a module to build imx5 dtb files. 2017-03-19 19:10:23 +00:00
net Correct handling of ALTQ with epair(4) interfaces but presenting that ALTQ(9) is supported. 2017-03-24 00:55:16 +00:00
net80211 net80211: fix possible panic when wlan(4) interface is destroyed. 2017-03-24 22:29:51 +00:00
netgraph
netinet Fix reference count leak with L2 caching. 2017-03-25 15:06:28 +00:00
netinet6 Fix reference count leak with L2 caching. 2017-03-25 15:06:28 +00:00
netipsec Introduce the concept of IPsec security policies scope. 2017-03-07 00:13:53 +00:00
netnatm
netpfil pf: Fix possible shutdown race 2017-03-22 21:18:18 +00:00
netsmb
nfs Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
nfsclient Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
nfsserver Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
nlm
ofed Add full VNET support to the inet_get_local_port_range() function in 2017-03-22 15:46:31 +00:00
opencrypto
powerpc Don't bother checking core version 2017-03-24 01:52:10 +00:00
riscv Implement atomic_fcmpset_*() for RISC-V. 2017-02-05 00:32:12 +00:00
rpc Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
security
sparc64 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
sys move thread switch tracing from mi_switch to sched_switch 2017-03-23 08:57:04 +00:00
teken Fix bright colors for syscons, and make them work for the first time 2017-03-18 11:13:54 +00:00
tests
tools [fdt] Make DTBs generated by make_dtb.sh overlay-ready 2017-03-10 22:45:07 +00:00
ufs Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
vm Two changes to vm_fault_populate(): 2017-03-19 19:52:47 +00:00
x86 Provide less laborius way to enable busdma DMAR to only short list of devices. 2017-03-26 00:40:35 +00:00
xdr
xen xenstore: fix suspension when using the xenstore device 2017-03-07 09:17:48 +00:00
Makefile