]> err.no Git - linux-2.6/commitdiff
KVM: Workaround vmx inability to virtualize the reset state
authorAvi Kivity <avi@qumranet.com>
Tue, 20 Mar 2007 16:40:40 +0000 (18:40 +0200)
committerAvi Kivity <avi@qumranet.com>
Thu, 3 May 2007 07:52:25 +0000 (10:52 +0300)
The reset state has cs.selector == 0xf000 and cs.base == 0xffff0000,
which aren't compatible with vm86 mode, which is used for real mode
virtualization.

When we create a vcpu, we set cs.base to 0xf0000, but if we get there by
way of a reset, the values are inconsistent and vmx refuses to enter
guest mode.

Workaround by detecting the state and munging it appropriately.

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

index 0d9bf0b36d3759f698cc6783e6d77bfa5c8dc5b1..aa7e2ba6fb5adacbfd665179a9944a84bf79d5cb 100644 (file)
@@ -712,6 +712,8 @@ static void enter_rmode(struct kvm_vcpu *vcpu)
 
        vmcs_write32(GUEST_CS_AR_BYTES, 0xf3);
        vmcs_write32(GUEST_CS_LIMIT, 0xffff);
+       if (vmcs_readl(GUEST_CS_BASE) == 0xffff0000)
+               vmcs_writel(GUEST_CS_BASE, 0xf0000);
        vmcs_write16(GUEST_CS_SELECTOR, vmcs_readl(GUEST_CS_BASE) >> 4);
 
        fix_rmode_seg(VCPU_SREG_ES, &vcpu->rmode.es);