Make it possible to override PAE mode on boot.

Initialize the static kenv in pmap_cold() and fetch user opinion on
vm.pmap.pae_mode tunable if hardware is capable.  Note that the static
environment is reinitilized in init386() later when paging is enabled.

Reviewed by:	bde
Discussed with:	kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	2 months
This commit is contained in:
kib 2019-02-05 20:09:31 +00:00
parent 920678e9dc
commit 5b8ac2d701

View File

@ -96,6 +96,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/vmmeter.h>
#include <sys/sysctl.h>
#include <machine/bootinfo.h>
#include <machine/cpu.h>
#include <machine/cputypes.h>
#include <machine/md_var.h>
@ -935,16 +936,19 @@ pmap_kremove(vm_offset_t va)
extern struct pmap_methods pmap_pae_methods, pmap_nopae_methods;
int pae_mode;
SYSCTL_INT(_vm_pmap, OID_AUTO, pae_mode, CTLFLAG_RD,
&pae_mode, 1,
SYSCTL_INT(_vm_pmap, OID_AUTO, pae_mode, CTLFLAG_RDTUN | CTLFLAG_NOFETCH,
&pae_mode, 0,
"PAE");
void
pmap_cold(void)
{
if ((cpu_feature & CPUID_PAE) != 0) {
pae_mode = 1;
init_static_kenv((char *)bootinfo.bi_envp, 0);
pae_mode = (cpu_feature & CPUID_PAE) != 0;
if (pae_mode)
TUNABLE_INT_FETCH("vm.pmap.pae_mode", &pae_mode);
if (pae_mode) {
pmap_methods_ptr = &pmap_pae_methods;
pmap_pae_cold();
} else {