]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Remove the permanent double mapping of low physical memory and replace
authorBruce Evans <bde@FreeBSD.org>
Mon, 18 Dec 2017 13:53:22 +0000 (13:53 +0000)
committerBruce Evans <bde@FreeBSD.org>
Mon, 18 Dec 2017 13:53:22 +0000 (13:53 +0000)
commit2ba6fe0009f083e66353364b4ae1d4f8e251267d
tree1dfbcf6f623f600b57cd89fcb1b262d862e01b93
parent4a5eb9ac9910535ef99143912135ee3f327325fc
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.
sys/i386/i386/locore.s
sys/x86/acpica/acpi_wakeup.c
sys/x86/x86/mp_x86.c