Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LJVB1-0008Ax-IZ for qemu-devel@nongnu.org; Sun, 04 Jan 2009 10:46:07 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LJVB0-0008AQ-M8 for qemu-devel@nongnu.org; Sun, 04 Jan 2009 10:46:07 -0500 Received: from [199.232.76.173] (port=54447 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LJVB0-0008AL-FE for qemu-devel@nongnu.org; Sun, 04 Jan 2009 10:46:06 -0500 Received: from norkia.v3.sk ([92.240.234.41]:36724 helo=norkia.kexik.net) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LJVAz-0007sQ-Es for qemu-devel@nongnu.org; Sun, 04 Jan 2009 10:46:06 -0500 Message-ID: <34308.89.102.207.186.1231083937.squirrel@mail.netbsd.sk> Date: Sun, 4 Jan 2009 10:45:37 -0500 (EST) From: lkundrak@v3.sk MIME-Version: 1.0 Content-Type: multipart/mixed;boundary="----=_20090104104537_32286" Subject: [Qemu-devel] [PATCH] Resend: x86: Reboot CPU on triple fault 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 Cc: Jan Kiszka ------=_20090104104537_32286 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable This is a (slightly adjusted for 2009-01-04 SVN) resend of Jan Kiszka's Reboot CPU on triple fault patch (see patch file for the exact reference) It seems like a consensus was reached on how to deal with tripple faults, but noone commited the last version (8) of the patch anyways. Just for the record -- 386BSD relies on this behavior to reset the CPU -- it unmaps the whole address space in order to trigger a tripple fault. ------=_20090104104537_32286 Content-Type: text/x-patch; name="qemu-0.9.2-triplefault.patch" Content-Disposition: attachment; filename="qemu-0.9.2-triplefault.patch" Content-Transfer-Encoding: quoted-printable This is a slightly adjusted (for 2009-01-04 SVN) "reset on tripple fault = patch" Originally from: Subject: [Qemu-devel] Re: [PATCH] x86: Reboot CPU on triple fault - Versi= on 8 Message-ID: <483C340E.1030207@siemens.com> Date: Tue, 27 May 2008 18:17:18 +0200 From: Jan Kiszka Index: exec.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- exec.c (revision 6159) +++ exec.c (working copy) @@ -1571,6 +1571,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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- target-i386/helper.c (revision 6159) +++ target-i386/helper.c (working copy) @@ -418,6 +418,11 @@ { int i; =20 + if (loglevel & CPU_LOG_RESET) { + fprintf(logfile, "CPU Reset (CPU %d)\n", env->cpu_index); + cpu_dump_state(env, logfile, fprintf, X86_DUMP_FPU | X86_DUMP_CCO= P); + } + memset(env, 0, offsetof(CPUX86State, breakpoints)); =20 tlb_flush(env, 1); Index: target-i386/op_helper.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- target-i386/op_helper.c (revision 6159) +++ target-i386/op_helper.c (working copy) @@ -1244,6 +1244,9 @@ } } =20 +/* 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. @@ -1261,9 +1264,19 @@ fprintf(logfile, "check_exception old: 0x%x new 0x%x\n", env->old_exception, intno); =20 - if (env->old_exception =3D=3D EXCP08_DBLE) - cpu_abort(env, "triple fault"); +#if !defined(CONFIG_USER_ONLY) + if (env->old_exception =3D=3D EXCP08_DBLE) { + if (env->intercept) + helper_vmexit(SVM_EXIT_SHUTDOWN, 0); =20 + if (loglevel & CPU_LOG_RESET) + fprintf(logfile, "Triple fault\n"); + + qemu_system_reset_request(); + return EXCP_HLT; + } +#endif + if ((first_contributory && second_contributory) || (env->old_exception =3D=3D EXCP0E_PAGE && (second_contributory || (intno =3D=3D EXCP0E_PAGE)))) { Index: cpu-all.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- cpu-all.h (revision 6159) +++ cpu-all.h (working copy) @@ -815,6 +815,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) =20 /* define log items */ typedef struct CPULogItem { ------=_20090104104537_32286--