]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
KVM: x86: correctly initialize the CS base on reset
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 19 Mar 2013 15:30:26 +0000 (16:30 +0100)
committerMarcelo Tosatti <mtosatti@redhat.com>
Wed, 20 Mar 2013 20:34:55 +0000 (17:34 -0300)
The CS base was initialized to 0 on VMX (wrong, but usually overridden
by userspace before starting) or 0xf0000 on SVM.  The correct value is
0xffff0000, and VMX is able to emulate it now, so use it.

Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/svm.c
arch/x86/kvm/vmx.c

index 7219a4012a0e6363c1edf5d5f398eba7adf18c7b..7a46c1f46861eae21f5cdd3bcd7d196d456d0705 100644 (file)
@@ -1131,17 +1131,11 @@ static void init_vmcb(struct vcpu_svm *svm)
        init_seg(&save->gs);
 
        save->cs.selector = 0xf000;
+       save->cs.base = 0xffff0000;
        /* Executable/Readable Code Segment */
        save->cs.attrib = SVM_SELECTOR_READ_MASK | SVM_SELECTOR_P_MASK |
                SVM_SELECTOR_S_MASK | SVM_SELECTOR_CODE_MASK;
        save->cs.limit = 0xffff;
-       /*
-        * cs.base should really be 0xffff0000, but vmx can't handle that, so
-        * be consistent with it.
-        *
-        * Replace when we have real mode working for vmx.
-        */
-       save->cs.base = 0xf0000;
 
        save->gdtr.limit = 0xffff;
        save->idtr.limit = 0xffff;
index ad978a6c282e896145d2424dd4f799591218d5ba..03f574641852b294f3d59e2e594039e7e2ea10ae 100644 (file)
@@ -4113,6 +4113,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu)
 
        seg_setup(VCPU_SREG_CS);
        vmcs_write16(GUEST_CS_SELECTOR, 0xf000);
+       vmcs_write32(GUEST_CS_BASE, 0xffff0000);
 
        seg_setup(VCPU_SREG_DS);
        seg_setup(VCPU_SREG_ES);