aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/svm.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2010-02-23 11:47:54 -0500
committerAvi Kivity <avi@redhat.com>2010-04-25 06:00:37 -0400
commit116a4752c82f767a59c27b2630a8474b936a776a (patch)
tree5c8e5b08b4c939f59eff66f678ecaed27f4256b1 /arch/x86/kvm/svm.c
parent50a085bdd48af08cc7e3178ba0d7c1d5d8191698 (diff)
KVM: SVM: Move svm_queue_exception
Move svm_queue_exception past skip_emulated_instruction to allow calling it later on. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r--arch/x86/kvm/svm.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index bd8f52f0823f..908ec61895ce 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -236,23 +236,6 @@ static void svm_set_efer(struct kvm_vcpu *vcpu, u64 efer)
236 vcpu->arch.efer = efer; 236 vcpu->arch.efer = efer;
237} 237}
238 238
239static void svm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr,
240 bool has_error_code, u32 error_code)
241{
242 struct vcpu_svm *svm = to_svm(vcpu);
243
244 /* If we are within a nested VM we'd better #VMEXIT and let the
245 guest handle the exception */
246 if (nested_svm_check_exception(svm, nr, has_error_code, error_code))
247 return;
248
249 svm->vmcb->control.event_inj = nr
250 | SVM_EVTINJ_VALID
251 | (has_error_code ? SVM_EVTINJ_VALID_ERR : 0)
252 | SVM_EVTINJ_TYPE_EXEPT;
253 svm->vmcb->control.event_inj_err = error_code;
254}
255
256static int is_external_interrupt(u32 info) 239static int is_external_interrupt(u32 info)
257{ 240{
258 info &= SVM_EVTINJ_TYPE_MASK | SVM_EVTINJ_VALID; 241 info &= SVM_EVTINJ_TYPE_MASK | SVM_EVTINJ_VALID;
@@ -298,6 +281,23 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
298 svm_set_interrupt_shadow(vcpu, 0); 281 svm_set_interrupt_shadow(vcpu, 0);
299} 282}
300 283
284static void svm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr,
285 bool has_error_code, u32 error_code)
286{
287 struct vcpu_svm *svm = to_svm(vcpu);
288
289 /* If we are within a nested VM we'd better #VMEXIT and let the
290 guest handle the exception */
291 if (nested_svm_check_exception(svm, nr, has_error_code, error_code))
292 return;
293
294 svm->vmcb->control.event_inj = nr
295 | SVM_EVTINJ_VALID
296 | (has_error_code ? SVM_EVTINJ_VALID_ERR : 0)
297 | SVM_EVTINJ_TYPE_EXEPT;
298 svm->vmcb->control.event_inj_err = error_code;
299}
300
301static int has_svm(void) 301static int has_svm(void)
302{ 302{
303 const char *msg; 303 const char *msg;