From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jm8mR-00029X-0i for qemu-devel@nongnu.org; Wed, 16 Apr 2008 10:38:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jm8mQ-00028r-8D for qemu-devel@nongnu.org; Wed, 16 Apr 2008 10:38:34 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jm8mQ-00028d-26 for qemu-devel@nongnu.org; Wed, 16 Apr 2008 10:38:34 -0400 Received: from mx2.suse.de ([195.135.220.15]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jm8mP-00063a-Iv for qemu-devel@nongnu.org; Wed, 16 Apr 2008 10:38:33 -0400 Received: from Relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 9485C44ACC for ; Wed, 16 Apr 2008 16:38:29 +0200 (CEST) Message-ID: <48060E28.7000606@suse.de> Date: Wed, 16 Apr 2008 16:33:12 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <47EE86E0.4070703@reactos.org> <9C7667CB-2CF0-4AC0-843B-6EF442196CAC@csgraf.de> <47F0B445.4030806@suse.de> <4804D254.5040301@siemens.com> <4805F4B0.5020802@siemens.com> <4806009E.8060407@suse.de> <48060ACC.2020309@siemens.com> In-Reply-To: <48060ACC.2020309@siemens.com> Content-Type: multipart/mixed; boundary="------------070604080001080400030900" Subject: [Qemu-devel] [PATCH] x86: Reboot CPU on triple fault - Version 5 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. --------------070604080001080400030900 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Didn't you dare posting another patch yourself? ;-) But you're right with those two points, I've fixed them now. The hopefully final patch is attached. Signed-off-by: Kevin Wolf --------------070604080001080400030900 Content-Type: text/x-patch; name="qemu-triple-fault-v5.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="qemu-triple-fault-v5.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: exec.c =================================================================== --- exec.c (Revision 4215) +++ exec.c (Arbeitskopie) @@ -1259,6 +1259,8 @@ #ifdef TARGET_I386 { CPU_LOG_PCALL, "pcall", "show protected mode far calls/returns/exceptions" }, + { CPU_LOG_RESET, "cpu_reset", + "show CPU state before CPU resets" }, #endif #ifdef DEBUG_IOPORT { CPU_LOG_IOPORT, "ioport", Index: target-i386/helper.c =================================================================== --- target-i386/helper.c (Revision 4215) +++ target-i386/helper.c (Arbeitskopie) @@ -1231,6 +1231,9 @@ } } +/* This should come from sysemu.h - if we could include it here... */ +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,9 +1251,20 @@ 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) { + 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); + } + if (loglevel & CPU_LOG_RESET) + fprintf(logfile, "Triple fault\n"); + + qemu_system_reset_request(); + return EXCP_HLT; + } + if ((first_contributory && second_contributory) || (env->old_exception == EXCP0E_PAGE && (second_contributory || (intno == EXCP0E_PAGE)))) { Index: target-i386/helper2.c =================================================================== --- target-i386/helper2.c (Revision 4215) +++ target-i386/helper2.c (Arbeitskopie) @@ -362,6 +362,10 @@ void cpu_reset(CPUX86State *env) { int i; + + if (loglevel & CPU_LOG_RESET) { + cpu_dump_state(env, logfile, fprintf, X86_DUMP_FPU | X86_DUMP_CCOP); + } memset(env, 0, offsetof(CPUX86State, breakpoints)); Index: cpu-all.h =================================================================== --- cpu-all.h (Revision 4215) +++ cpu-all.h (Arbeitskopie) @@ -779,6 +779,7 @@ #define CPU_LOG_PCALL (1 << 6) #define CPU_LOG_IOPORT (1 << 7) #define CPU_LOG_TB_CPU (1 << 8) +#define CPU_LOG_RESET (1 << 9) /* define log items */ typedef struct CPULogItem { --------------070604080001080400030900--