aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/svm.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-11-25 07:12:03 -0500
committerAvi Kivity <avi@qumranet.com>2008-01-30 10:53:18 -0500
commitc1a5d4f990ce034bcb19aebbb910c07019e60f6b (patch)
tree23aeb993f99c0b9523486c0dcbedb61247352a45 /drivers/kvm/svm.c
parentc3c91fee5195ba5176a6da5ddc2a2822243eb79f (diff)
KVM: Replace #GP injection by the generalized exception queue
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/svm.c')
-rw-r--r--drivers/kvm/svm.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index aa8e90b404a0..f9769338c621 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -207,17 +207,6 @@ static bool svm_exception_injected(struct kvm_vcpu *vcpu)
207 return !(svm->vmcb->control.exit_int_info & SVM_EXITINTINFO_VALID); 207 return !(svm->vmcb->control.exit_int_info & SVM_EXITINTINFO_VALID);
208} 208}
209 209
210static void svm_inject_gp(struct kvm_vcpu *vcpu, unsigned error_code)
211{
212 struct vcpu_svm *svm = to_svm(vcpu);
213
214 svm->vmcb->control.event_inj = SVM_EVTINJ_VALID |
215 SVM_EVTINJ_VALID_ERR |
216 SVM_EVTINJ_TYPE_EXEPT |
217 GP_VECTOR;
218 svm->vmcb->control.event_inj_err = error_code;
219}
220
221static void inject_ud(struct kvm_vcpu *vcpu) 210static void inject_ud(struct kvm_vcpu *vcpu)
222{ 211{
223 to_svm(vcpu)->vmcb->control.event_inj = SVM_EVTINJ_VALID | 212 to_svm(vcpu)->vmcb->control.event_inj = SVM_EVTINJ_VALID |
@@ -1115,7 +1104,7 @@ static int rdmsr_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
1115 u64 data; 1104 u64 data;
1116 1105
1117 if (svm_get_msr(&svm->vcpu, ecx, &data)) 1106 if (svm_get_msr(&svm->vcpu, ecx, &data))
1118 svm_inject_gp(&svm->vcpu, 0); 1107 kvm_inject_gp(&svm->vcpu, 0);
1119 else { 1108 else {
1120 svm->vmcb->save.rax = data & 0xffffffff; 1109 svm->vmcb->save.rax = data & 0xffffffff;
1121 svm->vcpu.regs[VCPU_REGS_RDX] = data >> 32; 1110 svm->vcpu.regs[VCPU_REGS_RDX] = data >> 32;
@@ -1176,7 +1165,7 @@ static int wrmsr_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
1176 | ((u64)(svm->vcpu.regs[VCPU_REGS_RDX] & -1u) << 32); 1165 | ((u64)(svm->vcpu.regs[VCPU_REGS_RDX] & -1u) << 32);
1177 svm->next_rip = svm->vmcb->save.rip + 2; 1166 svm->next_rip = svm->vmcb->save.rip + 2;
1178 if (svm_set_msr(&svm->vcpu, ecx, data)) 1167 if (svm_set_msr(&svm->vcpu, ecx, data))
1179 svm_inject_gp(&svm->vcpu, 0); 1168 kvm_inject_gp(&svm->vcpu, 0);
1180 else 1169 else
1181 skip_emulated_instruction(&svm->vcpu); 1170 skip_emulated_instruction(&svm->vcpu);
1182 return 1; 1171 return 1;
@@ -1688,8 +1677,6 @@ static struct kvm_x86_ops svm_x86_ops = {
1688 1677
1689 .tlb_flush = svm_flush_tlb, 1678 .tlb_flush = svm_flush_tlb,
1690 1679
1691 .inject_gp = svm_inject_gp,
1692
1693 .run = svm_vcpu_run, 1680 .run = svm_vcpu_run,
1694 .handle_exit = handle_exit, 1681 .handle_exit = handle_exit,
1695 .skip_emulated_instruction = skip_emulated_instruction, 1682 .skip_emulated_instruction = skip_emulated_instruction,