diff options
author | Avi Kivity <avi@redhat.com> | 2012-08-21 10:07:01 -0400 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2012-08-27 19:02:20 -0400 |
commit | c865c43de66dc973865bda337022f03b6e16c8df (patch) | |
tree | 73bd966f4e624f8060104593d693b9ad5945b165 | |
parent | f5f7b2fe3bf849b58c8144729aba78b8e29e1e4c (diff) |
KVM: VMX: Retain limit and attributes when entering protected mode
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>
-rw-r--r-- | arch/x86/kvm/vmx.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 7e95ff68b9da..88eeb405560f 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -2696,14 +2696,14 @@ static __exit void hardware_unsetup(void) | |||
2696 | static void fix_pmode_dataseg(struct kvm_vcpu *vcpu, int seg, struct kvm_segment *save) | 2696 | static void fix_pmode_dataseg(struct kvm_vcpu *vcpu, int seg, struct kvm_segment *save) |
2697 | { | 2697 | { |
2698 | struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; | 2698 | struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; |
2699 | struct kvm_segment tmp = *save; | ||
2699 | 2700 | ||
2700 | if (vmcs_readl(sf->base) == save->base && save->s) { | 2701 | if (!(vmcs_readl(sf->base) == tmp.base && tmp.s)) { |
2701 | vmx_set_segment(vcpu, save, seg); | 2702 | tmp.base = vmcs_readl(sf->base); |
2702 | } else { | 2703 | tmp.selector = vmcs_read16(sf->selector); |
2703 | u32 dpl = (vmcs_read16(sf->selector) & SELECTOR_RPL_MASK) | 2704 | tmp.s = 1; |
2704 | << AR_DPL_SHIFT; | ||
2705 | vmcs_write32(sf->ar_bytes, 0x93 | dpl); | ||
2706 | } | 2705 | } |
2706 | vmx_set_segment(vcpu, &tmp, seg); | ||
2707 | } | 2707 | } |
2708 | 2708 | ||
2709 | static void enter_pmode(struct kvm_vcpu *vcpu) | 2709 | static void enter_pmode(struct kvm_vcpu *vcpu) |