From: Jan Kiszka <jan.kiszka@siemens.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] x86: Reboot CPU on triple fault - Version 3
Date: Wed, 16 Apr 2008 14:44:32 +0200 [thread overview]
Message-ID: <4805F4B0.5020802@siemens.com> (raw)
In-Reply-To: <4804D254.5040301@siemens.com>
Here comes a version that may hopefully make everyone happy: :)
Reset on triple fault, but only dump the CPU state to stderr and logfile
if -triple-fault was given as command line option.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
dyngen-exec.h | 1 +
target-i386/helper.c | 24 ++++++++++++++++++++++--
vl.c | 9 +++++++++
3 files changed, 32 insertions(+), 2 deletions(-)
Index: b/dyngen-exec.h
===================================================================
--- a/dyngen-exec.h
+++ b/dyngen-exec.h
@@ -86,6 +86,7 @@ typedef struct FILE FILE;
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: b/target-i386/helper.c
===================================================================
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1231,6 +1231,10 @@ 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);
+extern int warn_on_triple_fault;
+
/*
* 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,24 @@ static int check_exception(int intno, in
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 (warn_on_triple_fault) {
+ fprintf(stderr, "qemu: warning: triple fault\n");
+ cpu_dump_state(env, stderr, fprintf, X86_DUMP_FPU | X86_DUMP_CCOP);
+ if (logfile) {
+ fprintf(logfile, "qemu: warning: triple fault\n");
+ cpu_dump_state(env, logfile, fprintf,
+ X86_DUMP_FPU | X86_DUMP_CCOP);
+ }
+ }
+ qemu_system_reset_request();
+ return EXCP_HLT;
+ }
if ((first_contributory && second_contributory)
|| (env->old_exception == EXCP0E_PAGE &&
Index: b/vl.c
===================================================================
--- a/vl.c
+++ b/vl.c
@@ -200,6 +200,7 @@ CharDriverState *serial_hds[MAX_SERIAL_P
CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
#ifdef TARGET_I386
int win2k_install_hack = 0;
+int warn_on_triple_fault = 0;
#endif
int usb_enabled = 0;
static VLANState *first_vlan;
@@ -7730,6 +7731,7 @@ static void help(int exitcode)
"-std-vga simulate a standard VGA card with VESA Bochs Extensions\n"
" (default is CL-GD5446 PCI VGA)\n"
"-no-acpi disable ACPI\n"
+ "-triple-fault enable CPU state dump on triple fault\n"
#endif
#ifdef CONFIG_CURSES
"-curses use a curses/ncurses interface instead of SDL\n"
@@ -7852,6 +7854,7 @@ enum {
QEMU_OPTION_old_param,
QEMU_OPTION_clock,
QEMU_OPTION_startdate,
+ QEMU_OPTION_triple_fault,
};
typedef struct QEMUOption {
@@ -7964,6 +7967,9 @@ const QEMUOption qemu_options[] = {
#endif
{ "clock", HAS_ARG, QEMU_OPTION_clock },
{ "startdate", HAS_ARG, QEMU_OPTION_startdate },
+#if defined(TARGET_I386)
+ { "triple-fault", 0, QEMU_OPTION_triple_fault },
+#endif
{ NULL },
};
@@ -8702,6 +8708,9 @@ int main(int argc, char **argv)
case QEMU_OPTION_win2k_hack:
win2k_install_hack = 1;
break;
+ case QEMU_OPTION_triple_fault:
+ warn_on_triple_fault = 1;
+ break;
#endif
#ifdef USE_KQEMU
case QEMU_OPTION_no_kqemu:
next prev parent reply other threads:[~2008-04-16 12:44 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 ` Jan Kiszka [this message]
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 ` [Qemu-devel] " Jan Kiszka
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=4805F4B0.5020802@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).