Commit d0ba64f9 authored by Avi Kivity's avatar Avi Kivity Committed by Marcelo Tosatti

KVM: VMX: Save and restore tr selector across mode switches

When emulating real mode we play with tr hidden state, but leave
tr.selector alone.  That works well, except for save/restore, since
loading TR writes it to the hidden state in vmx->rmode.

Fix by also saving and restoring the tr selector; this makes things
more consistent and allows migration to work during the early
boot stages of Windows XP.
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent bc9c1933
...@@ -1683,6 +1683,7 @@ static void enter_pmode(struct kvm_vcpu *vcpu) ...@@ -1683,6 +1683,7 @@ static void enter_pmode(struct kvm_vcpu *vcpu)
vmx->emulation_required = 1; vmx->emulation_required = 1;
vmx->rmode.vm86_active = 0; vmx->rmode.vm86_active = 0;
vmcs_write16(GUEST_TR_SELECTOR, vmx->rmode.tr.selector);
vmcs_writel(GUEST_TR_BASE, vmx->rmode.tr.base); vmcs_writel(GUEST_TR_BASE, vmx->rmode.tr.base);
vmcs_write32(GUEST_TR_LIMIT, vmx->rmode.tr.limit); vmcs_write32(GUEST_TR_LIMIT, vmx->rmode.tr.limit);
vmcs_write32(GUEST_TR_AR_BYTES, vmx->rmode.tr.ar); vmcs_write32(GUEST_TR_AR_BYTES, vmx->rmode.tr.ar);
...@@ -1756,6 +1757,7 @@ static void enter_rmode(struct kvm_vcpu *vcpu) ...@@ -1756,6 +1757,7 @@ static void enter_rmode(struct kvm_vcpu *vcpu)
vmx->emulation_required = 1; vmx->emulation_required = 1;
vmx->rmode.vm86_active = 1; vmx->rmode.vm86_active = 1;
vmx->rmode.tr.selector = vmcs_read16(GUEST_TR_SELECTOR);
vmx->rmode.tr.base = vmcs_readl(GUEST_TR_BASE); vmx->rmode.tr.base = vmcs_readl(GUEST_TR_BASE);
vmcs_writel(GUEST_TR_BASE, rmode_tss_base(vcpu->kvm)); vmcs_writel(GUEST_TR_BASE, rmode_tss_base(vcpu->kvm));
......
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