qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] x86: Reboot CPU on triple fault - Version 8
Date: Tue, 27 May 2008 18:17:18 +0200	[thread overview]
Message-ID: <483C340E.1030207@siemens.com> (raw)
In-Reply-To: <483C3052.1080807@siemens.com>

Jan Kiszka wrote:
> Jan Kiszka wrote:
>> To pick this up again, as the problem is still unfixed:
>>
>> Kevin Wolf wrote:
>>> Anthony Liguori schrieb:
>>>>>   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;
>>>>>   
>>>> This is unnecessary.
>>> Right. I'll fix this with the next version.
>> To accelerate this "a bit" ;), I attached a refreshed version of your
>> patch.
> 
> And here is a version that even compiles (sorry).

Sigh, almost. linux-user become broken, and I posted faster than it took
the compiler to reach that target.

No point in testing for double faults in user space, I guess...

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 cpu-all.h             |    1 +
 exec.c                |    2 ++
 target-i386/helper.c  |   17 +++++++++++++++--
 target-i386/helper2.c |    5 +++++
 4 files changed, 23 insertions(+), 2 deletions(-)

Index: b/exec.c
===================================================================
--- a/exec.c
+++ b/exec.c
@@ -1302,6 +1302,8 @@ CPULogItem cpu_log_items[] = {
 #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: b/target-i386/helper.c
===================================================================
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1261,6 +1261,9 @@ void do_interrupt(int intno, int is_int,
     }
 }
 
+/* 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.
@@ -1278,8 +1281,18 @@ static int check_exception(int intno, in
         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 & INTERCEPT_SVM_MASK)
+            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 &&
Index: b/target-i386/helper2.c
===================================================================
--- a/target-i386/helper2.c
+++ b/target-i386/helper2.c
@@ -363,6 +363,11 @@ void cpu_reset(CPUX86State *env)
 {
     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: b/cpu-all.h
===================================================================
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -824,6 +824,7 @@ target_phys_addr_t cpu_get_phys_page_deb
 #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 {

  reply	other threads:[~2008-05-27 16:17 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-29 18:13 [Qemu-devel] [PATCH] Reboot CPU on triple fault Hervé Poussineau
2008-03-30  1:36 ` Alexander Graf
2008-03-31  9:52   ` Kevin Wolf
2008-04-15 16:05     ` [Qemu-devel] " Jan Kiszka
2008-04-15 16:57       ` Paul Brook
2008-04-16  8:37         ` Kevin Wolf
2008-04-16  9:23           ` Jamie Lokier
2008-04-16  9:51             ` Antoine Kaufmann
2008-04-16  9:53             ` Kevin Wolf
2008-04-16 10:17               ` Michal Schulz
2008-04-16 10:25                 ` Michal Schulz
2008-04-16 12:08                 ` Kevin Wolf
2008-04-16 10:22               ` Jan Kiszka
2008-04-16 11:34               ` Jamie Lokier
2008-04-16 14:44         ` Anthony Liguori
2008-04-16  8:18       ` Kevin Wolf
2008-04-16 12:02         ` Jan Kiszka
2008-04-16 12:09           ` Avi Kivity
2008-04-16 12:36           ` Kevin Wolf
2008-04-16 12:57             ` Jamie Lokier
2008-04-16 12:44       ` [Qemu-devel] [PATCH] x86: Reboot CPU on triple fault - Version 3 Jan Kiszka
2008-04-16 13:35         ` [Qemu-devel] [PATCH] x86: Reboot CPU on triple fault - Version 4 Kevin Wolf
2008-04-16 14:18           ` [Qemu-devel] " Jan Kiszka
2008-04-16 14:33             ` [Qemu-devel] [PATCH] x86: Reboot CPU on triple fault - Version 5 Kevin Wolf
2008-04-16 14:57               ` [Qemu-devel] [PATCH] x86: Reboot CPU on triple fault - Version 6 Kevin Wolf
2008-04-17  9:52                 ` [Qemu-devel] " Jan Kiszka
2008-04-18 14:06                 ` [Qemu-devel] " Anthony Liguori
2008-04-21 11:53                   ` Kevin Wolf
2008-05-26 14:46                     ` [Qemu-devel] " Jan Kiszka
2008-05-27 16:01                       ` [Qemu-devel] [PATCH] x86: Reboot CPU on triple fault - Version 8 Jan Kiszka
2008-05-27 16:17                         ` Jan Kiszka [this message]
2008-04-16 14:37           ` [Qemu-devel] Re: [PATCH] x86: Reboot CPU on triple fault - Version 4 Anthony Liguori
2008-04-17  8:07             ` Jan Kiszka
2008-04-17 12:49               ` Anthony Liguori
2008-04-17 14:10                 ` Jan Kiszka
2008-04-17 18:30                   ` Anthony Liguori
2008-04-17 19:24                     ` Jan Kiszka
2008-04-18  8:38                     ` Kevin Wolf
2008-04-18 14:08                       ` Anthony Liguori
2008-04-21  9:37                         ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=483C340E.1030207@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).