Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297160
b: refs/heads/master
c: ea5e97e
h: refs/heads/master
v: v3
  • Loading branch information
Kevin Wolf authored and Avi Kivity committed Mar 8, 2012
1 parent 6a0b681 commit c27209b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 66b0ab8fac1031ffc70eb77491048339f2717a54
refs/heads/master: ea5e97e8bf1d56a4d9461c39e082b9c31a7be4ff
19 changes: 16 additions & 3 deletions trunk/arch/x86/kvm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,21 @@ static void svm_vcpu_put(struct kvm_vcpu *vcpu)
wrmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]);
}

static void svm_update_cpl(struct kvm_vcpu *vcpu)
{
struct vcpu_svm *svm = to_svm(vcpu);
int cpl;

if (!is_protmode(vcpu))
cpl = 0;
else if (svm->vmcb->save.rflags & X86_EFLAGS_VM)
cpl = 3;
else
cpl = svm->vmcb->save.cs.selector & 0x3;

svm->vmcb->save.cpl = cpl;
}

static unsigned long svm_get_rflags(struct kvm_vcpu *vcpu)
{
return to_svm(vcpu)->vmcb->save.rflags;
Expand Down Expand Up @@ -1607,9 +1622,7 @@ static void svm_set_segment(struct kvm_vcpu *vcpu,
s->attrib |= (var->g & 1) << SVM_SELECTOR_G_SHIFT;
}
if (seg == VCPU_SREG_CS)
svm->vmcb->save.cpl
= (svm->vmcb->save.cs.attrib
>> SVM_SELECTOR_DPL_SHIFT) & 3;
svm_update_cpl(vcpu);

mark_dirty(svm->vmcb, VMCB_SEG);
}
Expand Down

0 comments on commit c27209b

Please sign in to comment.