qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Resend: x86: Reboot CPU on triple fault
@ 2009-01-04 15:45 lkundrak
  2009-01-12 12:14 ` [Qemu-devel] " Jan Kiszka
  0 siblings, 1 reply; 5+ messages in thread
From: lkundrak @ 2009-01-04 15:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jan Kiszka

[-- Attachment #1: Type: text/plain, Size: 435 bytes --]

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.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: qemu-0.9.2-triplefault.patch --]
[-- Type: text/x-patch; name="qemu-0.9.2-triplefault.patch", Size: 2838 bytes --]

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 - Version 8
Message-ID: <483C340E.1030207@siemens.com>
Date: Tue, 27 May 2008 18:17:18 +0200
From: Jan Kiszka <jan.kiszka@siemens.com>

Index: exec.c
===================================================================
--- 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
===================================================================
--- target-i386/helper.c	(revision 6159)
+++ target-i386/helper.c	(working copy)
@@ -418,6 +418,11 @@
 {
     int i;
 
+   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_CCOP);
+   }
+
     memset(env, 0, offsetof(CPUX86State, breakpoints));
 
     tlb_flush(env, 1);
Index: target-i386/op_helper.c
===================================================================
--- target-i386/op_helper.c	(revision 6159)
+++ target-i386/op_helper.c	(working copy)
@@ -1244,6 +1244,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.
@@ -1261,9 +1264,19 @@
         fprintf(logfile, "check_exception old: 0x%x new 0x%x\n",
                 env->old_exception, intno);
 
-    if (env->old_exception == EXCP08_DBLE)
-        cpu_abort(env, "triple fault");
+#if !defined(CONFIG_USER_ONLY)
+    if (env->old_exception == EXCP08_DBLE) {
+        if (env->intercept)
+            helper_vmexit(SVM_EXIT_SHUTDOWN, 0);
 
+        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 == EXCP0E_PAGE &&
             (second_contributory || (intno == EXCP0E_PAGE)))) {
Index: cpu-all.h
===================================================================
--- 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)
 
 /* define log items */
 typedef struct CPULogItem {

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-01-12 16:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-04 15:45 [Qemu-devel] [PATCH] Resend: x86: Reboot CPU on triple fault lkundrak
2009-01-12 12:14 ` [Qemu-devel] " Jan Kiszka
2009-01-12 15:58   ` Alexander Graf
2009-01-12 16:05     ` Jan Kiszka
2009-01-12 16:41       ` Alexander Graf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).