Date: Thu, 24 May 2018 11:59:34 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r334150 - stable/11/sys/amd64/amd64 Message-ID: <201805241159.w4OBxY7U027825@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Thu May 24 11:59:33 2018 New Revision: 334150 URL: https://svnweb.freebsd.org/changeset/base/334150 Log: MFC r334003: Preserve other bits in IA32_SPEC_CTL MSR when changing the IBRS and STIBP states. Approved by: re (gjb) Modified: stable/11/sys/amd64/amd64/support.S Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/support.S ============================================================================== --- stable/11/sys/amd64/amd64/support.S Thu May 24 11:02:21 2018 (r334149) +++ stable/11/sys/amd64/amd64/support.S Thu May 24 11:59:33 2018 (r334150) @@ -849,8 +849,9 @@ ENTRY(handle_ibrs_entry) cmpb $0,hw_ibrs_active(%rip) je 1f movl $MSR_IA32_SPEC_CTRL,%ecx - movl $(IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP),%eax - movl $(IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP)>>32,%edx + rdmsr + orl $(IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP),%eax + orl $(IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP)>>32,%edx wrmsr movb $1,PCPU(IBPB_SET) testl $CPUID_STDEXT_SMEP,cpu_stdext_feature(%rip) @@ -863,8 +864,9 @@ ENTRY(handle_ibrs_exit) cmpb $0,PCPU(IBPB_SET) je 1f movl $MSR_IA32_SPEC_CTRL,%ecx - xorl %eax,%eax - xorl %edx,%edx + rdmsr + andl $~(IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP),%eax + andl $~((IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP)>>32),%edx wrmsr movb $0,PCPU(IBPB_SET) 1: ret @@ -878,8 +880,9 @@ ENTRY(handle_ibrs_exit_rs) pushq %rdx pushq %rcx movl $MSR_IA32_SPEC_CTRL,%ecx - xorl %eax,%eax - xorl %edx,%edx + rdmsr + andl $~(IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP),%eax + andl $~((IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP)>>32),%edx wrmsr popq %rcx popq %rdx
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805241159.w4OBxY7U027825>