From 78f7826868da8e27d097802139a3fec39f47f3b8 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Tue, 16 Oct 2007 19:06:15 +0200 Subject: [PATCH] KVM: VMX: Force vm86 mode if setting flags during real mode When resetting from userspace, we need to handle the flags being cleared even after we are in real mode. Signed-off-by: Avi Kivity --- drivers/kvm/vmx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index f130c01422..bb56ae3f89 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c @@ -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); } -- 2.39.5