diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2009-08-07 05:49:37 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-09-10 01:33:25 -0400 |
commit | 0295ad7de86a6347316bc7414c1b9c15f56a1333 (patch) | |
tree | 4edc72b30fc9c690e7249a92bc2866597bfa49f8 /arch/x86/kvm | |
parent | 9c4e40b9949868928bd7fec67a4b0902d90e57ed (diff) |
KVM: SVM: simplify nested_svm_check_exception
Makes the code of this function more readable by removing on
indentation level for the core logic.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r-- | arch/x86/kvm/svm.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 3bb6d4b92b34..67fad6641d55 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -1359,18 +1359,15 @@ static int nested_svm_check_permissions(struct vcpu_svm *svm) | |||
1359 | static int nested_svm_check_exception(struct vcpu_svm *svm, unsigned nr, | 1359 | static int nested_svm_check_exception(struct vcpu_svm *svm, unsigned nr, |
1360 | bool has_error_code, u32 error_code) | 1360 | bool has_error_code, u32 error_code) |
1361 | { | 1361 | { |
1362 | if (is_nested(svm)) { | 1362 | if (!is_nested(svm)) |
1363 | svm->vmcb->control.exit_code = SVM_EXIT_EXCP_BASE + nr; | 1363 | return 0; |
1364 | svm->vmcb->control.exit_code_hi = 0; | ||
1365 | svm->vmcb->control.exit_info_1 = error_code; | ||
1366 | svm->vmcb->control.exit_info_2 = svm->vcpu.arch.cr2; | ||
1367 | if (nested_svm_exit_handled(svm, false)) { | ||
1368 | nsvm_printk("VMexit -> EXCP 0x%x\n", nr); | ||
1369 | return 1; | ||
1370 | } | ||
1371 | } | ||
1372 | 1364 | ||
1373 | return 0; | 1365 | svm->vmcb->control.exit_code = SVM_EXIT_EXCP_BASE + nr; |
1366 | svm->vmcb->control.exit_code_hi = 0; | ||
1367 | svm->vmcb->control.exit_info_1 = error_code; | ||
1368 | svm->vmcb->control.exit_info_2 = svm->vcpu.arch.cr2; | ||
1369 | |||
1370 | return nested_svm_exit_handled(svm, false); | ||
1374 | } | 1371 | } |
1375 | 1372 | ||
1376 | static inline int nested_svm_intr(struct vcpu_svm *svm) | 1373 | static inline int nested_svm_intr(struct vcpu_svm *svm) |