From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jm2wN-0001vq-3b for qemu-devel@nongnu.org; Wed, 16 Apr 2008 04:24:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jm2wI-0001vd-7B for qemu-devel@nongnu.org; Wed, 16 Apr 2008 04:24:26 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jm2wI-0001va-0Y for qemu-devel@nongnu.org; Wed, 16 Apr 2008 04:24:22 -0400 Received: from ns.suse.de ([195.135.220.2] helo=mx1.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jm2wH-0004ni-Jy for qemu-devel@nongnu.org; Wed, 16 Apr 2008 04:24:21 -0400 Received: from Relay2.suse.de (relay-ext.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id C74C240AA1 for ; Wed, 16 Apr 2008 10:24:17 +0200 (CEST) Message-ID: <4805B673.3010200@suse.de> Date: Wed, 16 Apr 2008 10:18:59 +0200 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH] Reboot CPU on triple fault References: <47EE86E0.4070703@reactos.org> <9C7667CB-2CF0-4AC0-843B-6EF442196CAC@csgraf.de> <47F0B445.4030806@suse.de> <4804D254.5040301@siemens.com> In-Reply-To: <4804D254.5040301@siemens.com> Content-Type: multipart/mixed; boundary="------------090706090607090003030806" Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------090706090607090003030806 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 --------------090706090607090003030806 Content-Type: text/x-patch; name="qemu-triple-fault.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="qemu-triple-fault.patch" 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 && --------------090706090607090003030806--