From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jm8Ts-0002s1-7Y for qemu-devel@nongnu.org; Wed, 16 Apr 2008 10:19:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jm8Tp-0002qr-Bl for qemu-devel@nongnu.org; Wed, 16 Apr 2008 10:19:23 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jm8Tp-0002qi-5H for qemu-devel@nongnu.org; Wed, 16 Apr 2008 10:19:21 -0400 Received: from gecko.sbs.de ([194.138.37.40]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jm8To-0001uT-Lz for qemu-devel@nongnu.org; Wed, 16 Apr 2008 10:19:21 -0400 Received: from mail1.sbs.de (localhost [127.0.0.1]) by gecko.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id m3GEJ0Bn007695 for ; Wed, 16 Apr 2008 16:19:00 +0200 Received: from [139.21.95.227] (mchn012c.mchh.siemens.de [139.21.95.227] (may be forged)) by mail1.sbs.de (8.12.6/8.12.6) with ESMTP id m3GEJ0iS027470 for ; Wed, 16 Apr 2008 16:19:00 +0200 Message-ID: <48060ACC.2020309@siemens.com> Date: Wed, 16 Apr 2008 16:18:52 +0200 From: Jan Kiszka 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> In-Reply-To: <4806009E.8060407@suse.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] x86: Reboot CPU on triple fault - Version 4 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 Kevin Wolf wrote: > And another version which implements the -d cpu_reset suggested by > Jamie. Extending -d is probably better than introducing a completely new > option. Sounds good. > > Signed-off-by: Kevin Wolf > > 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,10 @@ > } > } > > +/* This should come from sysemu.h - if we could include it here... */ > +void qemu_system_reset_request(void); > +extern int warn_on_triple_fault; The latter is now obsolete. > + > /* > * 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 +1252,19 @@ > 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(stderr, "qemu: warning: triple fault\n"); Does 'loglevel' manage dumping to stderr as well? I don't think so. To remain consistent, the line above should probably be removed. > + fprintf(logfile, "qemu: warning: triple fault\n"); > + } > + qemu_system_reset_request(); > + return EXCP_HLT; > + } > > if ((first_contributory && second_contributory) > || (env->old_exception == 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 { Jan -- Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux