@@ -1822,13 +1822,23 @@ static u64 vmx_get_segment_base(struct kvm_vcpu *vcpu, int seg)
static void vmx_get_segment(struct kvm_vcpu *vcpu,
struct kvm_segment *var, int seg)
{
+ struct vcpu_vmx *vmx = to_vmx(vcpu);
struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg];
u32 ar;
+ if (vmx->rmode.vm86_active && seg == VCPU_SREG_TR) {
+ var->base = vmx->rmode.tr.base;
+ var->limit = vmx->rmode.tr.limit;
+ var->selector = vmx->rmode.tr.selector;
+ ar = vmx->rmode.tr.ar;
+ goto ar;
+ }
+
var->base = vmcs_readl(sf->base);
var->limit = vmcs_read32(sf->limit);
var->selector = vmcs_read16(sf->selector);
ar = vmcs_read32(sf->ar_bytes);
+ar:
if ((ar & AR_UNUSABLE_MASK) && !emulate_invalid_guest_state)
ar = 0;
var->type = ar & 15;