[PATCH QEMU-KVM 1/4] Move internal error handling into a function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Avi Kivity <avi@xxxxxxxxxx>
---
 qemu-kvm.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/qemu-kvm.c b/qemu-kvm.c
index 809fd65..4b22537 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -869,6 +869,18 @@ int kvm_is_ready_for_interrupt_injection(CPUState *env)
     return env->kvm_run->ready_for_interrupt_injection;
 }
 
+static int kvm_handle_internal_error(kvm_context_t kvm,
+                                     CPUState *env,
+                                     struct kvm_run *run)
+{
+    fprintf(stderr, "KVM internal error. Suberror: %d\n",
+            run->internal.suberror);
+    kvm_show_regs(env);
+    if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION)
+        fprintf(stderr, "emulation failure, check dmesg for details\n");
+    abort();
+}
+
 int kvm_run(CPUState *env)
 {
     int r;
@@ -967,12 +979,7 @@ int kvm_run(CPUState *env)
             break;
 #endif
 	case KVM_EXIT_INTERNAL_ERROR:
-	    fprintf(stderr, "KVM internal error. Suberror: %d\n",
-		    run->internal.suberror);
-	    kvm_show_regs(env);
-	    if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION)
-		fprintf(stderr, "emulation failure, check dmesg for details\n");
-	    abort();
+            r = kvm_handle_internal_error(kvm, env, run);
 	    break;
         default:
             if (kvm_arch_run(env)) {
-- 
1.6.5.2

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux