Adjust branch target in NMI handler for the !PTI case.

In the !PTI case the NMI handler jumped past the instructions that set
%rdi to point to the current PCB, but the target instructions assumed %rdi
were set.

Reviewed by:	kib
Tested by:	pho
This commit is contained in:
John Baldwin 2018-01-18 20:12:12 +00:00
parent 9a7a98a0dc
commit 7f513d17b2

View File

@ -571,11 +571,11 @@ nmi_fromuserspace:
cmpq $~0,%rax
je 1f
movq %rax,%cr3
movq PCPU(CURPCB),%rdi
1: movq PCPU(CURPCB),%rdi
testq %rdi,%rdi
jz 3f
orl $PCB_FULL_IRET,PCB_FLAGS(%rdi)
1: testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip)
testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip)
jz 3f
cmpw $KUF32SEL,TF_FS(%rsp)
jne 2f