Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 185938
b: refs/heads/master
c: cb84b55
h: refs/heads/master
v: v3
  • Loading branch information
Marcelo Tosatti committed Mar 1, 2010
1 parent 5210eda commit 82a636b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3fd28fce765632d0fe46b31f63c0e7a7ec6c6b79
refs/heads/master: cb84b55f6cde26c7c17beaf87da08645ae6ccbf9
11 changes: 11 additions & 0 deletions trunk/arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -4410,6 +4410,15 @@ static int is_vm86_segment(struct kvm_vcpu *vcpu, int seg)
(kvm_get_rflags(vcpu) & X86_EFLAGS_VM);
}

static void kvm_check_segment_descriptor(struct kvm_vcpu *vcpu, int seg,
u16 selector)
{
/* NULL selector is not valid for CS and SS */
if (seg == VCPU_SREG_CS || seg == VCPU_SREG_SS)
if (!selector)
kvm_queue_exception_e(vcpu, TS_VECTOR, selector >> 3);
}

int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
int type_bits, int seg)
{
Expand All @@ -4419,6 +4428,8 @@ int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
return kvm_load_realmode_segment(vcpu, selector, seg);
if (load_segment_descriptor_to_kvm_desct(vcpu, selector, &kvm_seg))
return 1;

kvm_check_segment_descriptor(vcpu, seg, selector);
kvm_seg.type |= type_bits;

if (seg != VCPU_SREG_SS && seg != VCPU_SREG_CS &&
Expand Down

0 comments on commit 82a636b

Please sign in to comment.