diff options
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 8d860e0301a0..279318677911 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -4410,6 +4410,15 @@ static int is_vm86_segment(struct kvm_vcpu *vcpu, int seg) | |||
4410 | (kvm_get_rflags(vcpu) & X86_EFLAGS_VM); | 4410 | (kvm_get_rflags(vcpu) & X86_EFLAGS_VM); |
4411 | } | 4411 | } |
4412 | 4412 | ||
4413 | static void kvm_check_segment_descriptor(struct kvm_vcpu *vcpu, int seg, | ||
4414 | u16 selector) | ||
4415 | { | ||
4416 | /* NULL selector is not valid for CS and SS */ | ||
4417 | if (seg == VCPU_SREG_CS || seg == VCPU_SREG_SS) | ||
4418 | if (!selector) | ||
4419 | kvm_queue_exception_e(vcpu, TS_VECTOR, selector >> 3); | ||
4420 | } | ||
4421 | |||
4413 | int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, | 4422 | int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, |
4414 | int type_bits, int seg) | 4423 | int type_bits, int seg) |
4415 | { | 4424 | { |
@@ -4419,6 +4428,8 @@ int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, | |||
4419 | return kvm_load_realmode_segment(vcpu, selector, seg); | 4428 | return kvm_load_realmode_segment(vcpu, selector, seg); |
4420 | if (load_segment_descriptor_to_kvm_desct(vcpu, selector, &kvm_seg)) | 4429 | if (load_segment_descriptor_to_kvm_desct(vcpu, selector, &kvm_seg)) |
4421 | return 1; | 4430 | return 1; |
4431 | |||
4432 | kvm_check_segment_descriptor(vcpu, seg, selector); | ||
4422 | kvm_seg.type |= type_bits; | 4433 | kvm_seg.type |= type_bits; |
4423 | 4434 | ||
4424 | if (seg != VCPU_SREG_SS && seg != VCPU_SREG_CS && | 4435 | if (seg != VCPU_SREG_SS && seg != VCPU_SREG_CS && |