qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Re: [PATCH] Reboot CPU on triple fault


From: Kevin Wolf
Subject: Re: [Qemu-devel] Re: [PATCH] Reboot CPU on triple fault
Date: Wed, 16 Apr 2008 10:18:59 +0200
User-agent: Thunderbird 1.5.0.8 (X11/20060911)

Jan Kiszka schrieb:
> As the same requirement came up here, I worked out the following patch.
> I feel a bit uneasy about it because
> 
>  o I'm unsure if breaking out of the exception loop is OK this way.
> 
>  o including necessary headers fails, mostly due to stdio redefinitions
>    in dyngen-exec.h.
> 
> This patch behaves as it should, but only in one specific test case.
> Feedback is welcome.

This is exactly the behaviour I'd like to have. I still needed a small
change to your patch, though: You shouldn't return 0 from
check_exception, after all it's not a divide error. I'm not sure if
EXCP_HLT is the right thing to return here, but the attached patch works
for me. Without this change it kept hanging in a loop forever writing
more dumps than I ever wanted. ;-)

Signed-off-by: Kevin Wolf <address@hidden>

Index: dyngen-exec.h
===================================================================
--- dyngen-exec.h       (Revision 4215)
+++ dyngen-exec.h       (Arbeitskopie)
@@ -86,6 +86,7 @@
 extern int fprintf(FILE *, const char *, ...);
 extern int fputs(const char *, FILE *);
 extern int printf(const char *, ...);
+extern FILE *stderr;
 #undef NULL
 #define NULL 0
 
Index: target-i386/helper.c
===================================================================
--- target-i386/helper.c        (Revision 4215)
+++ target-i386/helper.c        (Arbeitskopie)
@@ -1231,6 +1231,8 @@
     }
 }
 
+void qemu_system_reset_request(void);
+
 /*
  * Check nested exceptions and change to double or triple fault if
  * needed. It should only be called, if this is not an interrupt.
@@ -1248,8 +1250,21 @@
         fprintf(logfile, "check_exception old: %x new %x\n",
                 env->old_exception, intno);
 
-    if (env->old_exception == EXCP08_DBLE)
-        cpu_abort(env, "triple fault");
+    if (env->old_exception == EXCP08_DBLE) {
+        fprintf(stderr, "qemu: warning: triple fault\n");
+        if(env->intercept & INTERCEPT_SVM_MASK) {
+            /* most probably the virtual machine should not
+               be shut down but rather caught by the VMM */
+            vmexit(SVM_EXIT_SHUTDOWN, 0);
+        }
+        cpu_dump_state(env, stderr, fprintf, X86_DUMP_FPU | X86_DUMP_CCOP);
+        if (logfile) {
+            fprintf(logfile, "qemu: warning: triple fault\n");
+            cpu_dump_state(env, logfile, fprintf, X86_DUMP_FPU | 
X86_DUMP_CCOP);
+        }
+        qemu_system_reset_request();
+        return EXCP_HLT;
+    }
 
     if ((first_contributory && second_contributory)
         || (env->old_exception == EXCP0E_PAGE &&

reply via email to

[Prev in Thread] Current Thread [Next in Thread]