Skip to content

Commit

Permalink
KVM: VMX: Retain limit and attributes when entering protected mode
Browse files Browse the repository at this point in the history
Real processors don't change segment limits and attributes while in
real mode.  Mimic that behaviour.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
  • Loading branch information
Avi Kivity authored and Marcelo Tosatti committed Aug 27, 2012
1 parent f5f7b2f commit c865c43
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions arch/x86/kvm/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2696,14 +2696,14 @@ static __exit void hardware_unsetup(void)
static void fix_pmode_dataseg(struct kvm_vcpu *vcpu, int seg, struct kvm_segment *save)
{
struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg];
struct kvm_segment tmp = *save;

if (vmcs_readl(sf->base) == save->base && save->s) {
vmx_set_segment(vcpu, save, seg);
} else {
u32 dpl = (vmcs_read16(sf->selector) & SELECTOR_RPL_MASK)
<< AR_DPL_SHIFT;
vmcs_write32(sf->ar_bytes, 0x93 | dpl);
if (!(vmcs_readl(sf->base) == tmp.base && tmp.s)) {
tmp.base = vmcs_readl(sf->base);
tmp.selector = vmcs_read16(sf->selector);
tmp.s = 1;
}
vmx_set_segment(vcpu, &tmp, seg);
}

static void enter_pmode(struct kvm_vcpu *vcpu)
Expand Down

0 comments on commit c865c43

Please sign in to comment.