KVM: VMX: Force vm86 mode if setting flags during real mode
authorAvi Kivity <avi@qumranet.com>
Tue, 16 Oct 2007 17:06:15 +0000 (19:06 +0200)
committerAvi Kivity <avi@qumranet.com>
Mon, 22 Oct 2007 10:03:29 +0000 (12:03 +0200)
When resetting from userspace, we need to handle the flags being cleared
even after we are in real mode.

Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/vmx.c

index f130c01422cf746cad8d2b372f6221775eef58b9..bb56ae3f89b601f9c2ae428dd92498f35b8aa181 100644 (file)
@@ -523,6 +523,8 @@ static unsigned long vmx_get_rflags(struct kvm_vcpu *vcpu)
 
 static void vmx_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags)
 {
+       if (vcpu->rmode.active)
+               rflags |= IOPL_MASK | X86_EFLAGS_VM;
        vmcs_writel(GUEST_RFLAGS, rflags);
 }