svn commit: r341746 - head/sys/i386/i386
Konstantin Belousov
kib at FreeBSD.org
Sat Dec 8 22:12:59 UTC 2018
Author: kib
Date: Sat Dec 8 22:12:57 2018
New Revision: 341746
URL: https://svnweb.freebsd.org/changeset/base/341746
Log:
Fix PAE boot.
With the introduction of M_EXEC support for kmem_malloc(), some kernel
mappings start having NX bit set in the paging structures early, for
PAE kernels on machines with NX support, i.e. practically on all
machines. In particular, AP trampoline and initialization needs to
access pages which translations has NX bit set, before initializecpu()
is called.
Check for CPUID NX feature and enable EFER.NXE before we enable paging
in mp boot trampoline. This allows the CPU to use the kernel page
table instead of generating page fault due to reserved bit set.
PR: 233819
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Modified:
head/sys/i386/i386/mpboot.s
Modified: head/sys/i386/i386/mpboot.s
==============================================================================
--- head/sys/i386/i386/mpboot.s Sat Dec 8 19:45:05 2018 (r341745)
+++ head/sys/i386/i386/mpboot.s Sat Dec 8 22:12:57 2018 (r341746)
@@ -99,6 +99,20 @@ NON_GPROF_ENTRY(MPentry)
movl %cr4, %eax
orl $CR4_PAE, %eax
movl %eax, %cr4
+ movl $0x80000000, %eax
+ cpuid
+ movl $0x80000001, %ebx
+ cmpl %ebx, %eax
+ jb 1f
+ movl %ebx, %eax
+ cpuid
+ testl $AMDID_NX, %edx
+ je 1f
+ movl $MSR_EFER, %ecx
+ rdmsr
+ orl $EFER_NXE,%eax
+ wrmsr
+1:
#else
movl IdlePTD, %eax
movl %eax,%cr3
More information about the svn-src-all
mailing list