freebsd-skq/sys/dev/syscons
Konstantin Belousov d86c1f0dc1 i386 4/4G split.
The change makes the user and kernel address spaces on i386
independent, giving each almost the full 4G of usable virtual addresses
except for one PDE at top used for trampoline and per-CPU trampoline
stacks, and system structures that must be always mapped, namely IDT,
GDT, common TSS and LDT, and process-private TSS and LDT if allocated.

By using 1:1 mapping for the kernel text and data, it appeared
possible to eliminate assembler part of the locore.S which bootstraps
initial page table and KPTmap.  The code is rewritten in C and moved
into the pmap_cold(). The comment in vmparam.h explains the KVA
layout.

There is no PCID mechanism available in protected mode, so each
kernel/user switch forth and back completely flushes the TLB, except
for the trampoline PTD region. The TLB invalidations for userspace
becomes trivial, because IPI handlers switch page tables. On the other
hand, context switches no longer need to reload %cr3.

copyout(9) was rewritten to use vm_fault_quick_hold().  An issue for
new copyout(9) is compatibility with wiring user buffers around sysctl
handlers. This explains two kind of locks for copyout ptes and
accounting of the vslock() calls.  The vm_fault_quick_hold() AKA slow
path, is only tried after the 'fast path' failed, which temporary
changes mapping to the userspace and copies the data to/from small
per-cpu buffer in the trampoline.  If a page fault occurs during the
copy, it is short-circuit by exception.s to not even reach C code.

The change was motivated by the need to implement the Meltdown
mitigation, but instead of KPTI the full split is done.  The i386
architecture already shows the sizing problems, in particular, it is
impossible to link clang and lld with debugging.  I expect that the
issues due to the virtual address space limits would only exaggerate
and the split gives more liveness to the platform.

Tested by: pho
Discussed with:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D14633
2018-04-13 20:30:49 +00:00
..
apm sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
blank sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
daemon sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
dragon sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
fade sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
fire Revert r327828, r327949, r327953, r328016-r328026, r328041: 2018-01-21 15:42:36 +00:00
fonts Add files to help manage the (vga) syscons mouse cursor. 2017-07-08 15:01:55 +00:00
green sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
logo sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
plasma Remove pc98 support completely. 2017-01-28 02:22:15 +00:00
rain sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
snake sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
star sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
warp sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
scgfbrndr.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
schistory.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
scmouse.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
scterm-teken.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
scterm.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
scvesactl.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
scvgarndr.c kernel: Fix several typos and minor errors 2017-12-27 03:23:21 +00:00
scvidctl.c Move most of the contents of opt_compat.h to opt_global.h. 2018-04-06 17:35:35 +00:00
scvtb.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
syscons.c i386 4/4G split. 2018-04-13 20:30:49 +00:00
syscons.h sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
sysmouse.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00