From: Avi Kivity Date: Wed, 12 Aug 2009 12:29:37 +0000 (+0300) Subject: KVM: VMX: Adjust rflags if in real mode emulation X-Git-Tag: v2.6.32-rc1~693^2~25 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=345dcaa8fde7fa70252d58c862bf41fd2149ca2c;p=karo-tx-linux.git KVM: VMX: Adjust rflags if in real mode emulation We set rflags.vm86 when virtualizing real mode to do through vm8086 mode; so we need to take it out again when reading rflags. Signed-off-by: Avi Kivity --- diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 31c3a8740c42..2b7e7bd190fd 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -781,7 +781,12 @@ static void vmx_fpu_deactivate(struct kvm_vcpu *vcpu) static unsigned long vmx_get_rflags(struct kvm_vcpu *vcpu) { - return vmcs_readl(GUEST_RFLAGS); + unsigned long rflags; + + rflags = vmcs_readl(GUEST_RFLAGS); + if (to_vmx(vcpu)->rmode.vm86_active) + rflags &= ~(unsigned long)(X86_EFLAGS_IOPL | X86_EFLAGS_VM); + return rflags; } static void vmx_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags)