提交 f4c63e5d 编写于 作者: A Avi Kivity

KVM: VMX: Optimize vmx_get_cpl()

In long mode, vm86 mode is disallowed, so we need not check for
it.  Reading rflags.vm may require a VMREAD, so it is expensive.
Signed-off-by: NAvi Kivity <avi@redhat.com>
上级 6de12732
......@@ -2120,7 +2120,8 @@ static int vmx_get_cpl(struct kvm_vcpu *vcpu)
if (!is_protmode(vcpu))
return 0;
if (kvm_get_rflags(vcpu) & X86_EFLAGS_VM) /* if virtual 8086 */
if (!is_long_mode(vcpu)
&& (kvm_get_rflags(vcpu) & X86_EFLAGS_VM)) /* if virtual 8086 */
return 3;
return vmcs_read16(GUEST_CS_SELECTOR) & 3;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册