提交 c865c43d 编写于 作者: A Avi Kivity 提交者: Marcelo Tosatti

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: NAvi Kivity <avi@redhat.com>
Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
上级 f5f7b2fe
...@@ -2696,14 +2696,14 @@ static __exit void hardware_unsetup(void) ...@@ -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) 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_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg];
struct kvm_segment tmp = *save;
if (vmcs_readl(sf->base) == save->base && save->s) { if (!(vmcs_readl(sf->base) == tmp.base && tmp.s)) {
vmx_set_segment(vcpu, save, seg); tmp.base = vmcs_readl(sf->base);
} else { tmp.selector = vmcs_read16(sf->selector);
u32 dpl = (vmcs_read16(sf->selector) & SELECTOR_RPL_MASK) tmp.s = 1;
<< AR_DPL_SHIFT;
vmcs_write32(sf->ar_bytes, 0x93 | dpl);
} }
vmx_set_segment(vcpu, &tmp, seg);
} }
static void enter_pmode(struct kvm_vcpu *vcpu) static void enter_pmode(struct kvm_vcpu *vcpu)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册