freebsd-dev/sys/x86
Bruce Evans 2ba6fe0009 Remove the permanent double mapping of low physical memory and replace
it by a transient double mapping for the one instruction in ACPI wakeup
where it is needed (and for many surrounding instructions in ACPI resume).
Invalidate the TLB as soon as convenient after undoing the transient
mapping.  ACPI resume already has the strict ordering needed for this.

This fixes the non-trapping of null pointers and other garbage pointers
below NBPDR (except transiently).  NBPDR is quite large (4MB, or 2MB for
PAE).

This fixes spurious traps at the first instruction in VM86 bioscalls.
The traps are for transiently missing read permission in the first
VM86 page (physical page 0) which was just written to at KERNBASE in
the kernel.  The mechanism is unknown (it is not simply PG_G).

locore uses a similar but larger transient double mapping and needs
it for 2 instructions instead of 1.  Unmap the first PDE in it after
the 2 instructions to detect most garbage pointers while bootstrapping.
pmap_bootstrap() finishes the unmapping.

Remove the avoidance of the double mapping for a recently fixed special
case.  ACPI resume could use this avoidance (made non-special) to avoid
any problems with the transient double mapping, but no such problems
are known.

Update comments in locore.  Many were for old versions of FreeBSD which
tried to map low memory r/o except for special cases, or might have
allowed access to low memory via physical offsets.  Now all kernel
maps are r/w, and removal of of the double map disallows use of physical
offsets again.
2017-12-18 13:53:22 +00:00
..
acpica Remove the permanent double mapping of low physical memory and replace 2017-12-18 13:53:22 +00:00
bios sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
cpufreq Properly skip the first CPU. It only accidentally worked because the 2017-11-30 20:21:42 +00:00
include SPDX: use the Beerware identifier. 2017-11-30 20:33:45 +00:00
iommu sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
isa SPDX: Fix some cases wrongly attributed to MIT. 2017-11-30 15:10:11 +00:00
pci sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
x86 Remove the permanent double mapping of low physical memory and replace 2017-12-18 13:53:22 +00:00
xen sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00