Commit d54d07b2 authored by Gleb Natapov's avatar Gleb Natapov Committed by Marcelo Tosatti

KVM: VMX: Do not fix segment register during vcpu initialization.

Segment registers will be fixed according to current emulation policy
during switching to real mode for the first time.
Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent d99e4152
...@@ -3621,12 +3621,9 @@ static void seg_setup(int seg) ...@@ -3621,12 +3621,9 @@ static void seg_setup(int seg)
vmcs_write16(sf->selector, 0); vmcs_write16(sf->selector, 0);
vmcs_writel(sf->base, 0); vmcs_writel(sf->base, 0);
vmcs_write32(sf->limit, 0xffff); vmcs_write32(sf->limit, 0xffff);
if (enable_unrestricted_guest) { ar = 0x93;
ar = 0x93; if (seg == VCPU_SREG_CS)
if (seg == VCPU_SREG_CS) ar |= 0x08; /* code segment */
ar |= 0x08; /* code segment */
} else
ar = 0xf3;
vmcs_write32(sf->ar_bytes, ar); vmcs_write32(sf->ar_bytes, ar);
} }
...@@ -3967,14 +3964,9 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) ...@@ -3967,14 +3964,9 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
vmx_segment_cache_clear(vmx); vmx_segment_cache_clear(vmx);
seg_setup(VCPU_SREG_CS); seg_setup(VCPU_SREG_CS);
/* if (kvm_vcpu_is_bsp(&vmx->vcpu))
* GUEST_CS_BASE should really be 0xffff0000, but VT vm86 mode
* insists on having GUEST_CS_BASE == GUEST_CS_SELECTOR << 4. Sigh.
*/
if (kvm_vcpu_is_bsp(&vmx->vcpu)) {
vmcs_write16(GUEST_CS_SELECTOR, 0xf000); vmcs_write16(GUEST_CS_SELECTOR, 0xf000);
vmcs_writel(GUEST_CS_BASE, 0x000f0000); else {
} else {
vmcs_write16(GUEST_CS_SELECTOR, vmx->vcpu.arch.sipi_vector << 8); vmcs_write16(GUEST_CS_SELECTOR, vmx->vcpu.arch.sipi_vector << 8);
vmcs_writel(GUEST_CS_BASE, vmx->vcpu.arch.sipi_vector << 12); vmcs_writel(GUEST_CS_BASE, vmx->vcpu.arch.sipi_vector << 12);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment