qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [6452] Log reset events (Jan Kiszka)
Date: Mon, 26 Jan 2009 19:54:31 +0000	[thread overview]
Message-ID: <E1LRXXT-0003ZJ-Gm@cvs.savannah.gnu.org> (raw)

Revision: 6452
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6452
Author:   aliguori
Date:     2009-01-26 19:54:31 +0000 (Mon, 26 Jan 2009)

Log Message:
-----------
Log reset events (Jan Kiszka)

Original idea&code by Kevin Wolf, split-up in two patches and added more
archs.

This patch introduces a flag to log CPU resets. Useful for tracing
unexpected resets (such as those triggered by x86 triple faults).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Modified Paths:
--------------
    trunk/cpu-all.h
    trunk/exec.c
    trunk/target-arm/helper.c
    trunk/target-cris/translate.c
    trunk/target-i386/helper.c
    trunk/target-m68k/helper.c
    trunk/target-mips/translate.c
    trunk/target-ppc/helper.c
    trunk/target-sh4/translate.c
    trunk/target-sparc/helper.c

Modified: trunk/cpu-all.h
===================================================================
--- trunk/cpu-all.h	2009-01-26 19:37:41 UTC (rev 6451)
+++ trunk/cpu-all.h	2009-01-26 19:54:31 UTC (rev 6452)
@@ -816,6 +816,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 {

Modified: trunk/exec.c
===================================================================
--- trunk/exec.c	2009-01-26 19:37:41 UTC (rev 6451)
+++ trunk/exec.c	2009-01-26 19:54:31 UTC (rev 6452)
@@ -1569,6 +1569,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",

Modified: trunk/target-arm/helper.c
===================================================================
--- trunk/target-arm/helper.c	2009-01-26 19:37:41 UTC (rev 6451)
+++ trunk/target-arm/helper.c	2009-01-26 19:54:31 UTC (rev 6452)
@@ -159,6 +159,12 @@
 void cpu_reset(CPUARMState *env)
 {
     uint32_t id;
+
+    if (qemu_loglevel_mask(CPU_LOG_RESET)) {
+        qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
+        log_cpu_state(env, 0);
+    }
+
     id = env->cp15.c0_cpuid;
     memset(env, 0, offsetof(CPUARMState, breakpoints));
     if (id)

Modified: trunk/target-cris/translate.c
===================================================================
--- trunk/target-cris/translate.c	2009-01-26 19:37:41 UTC (rev 6451)
+++ trunk/target-cris/translate.c	2009-01-26 19:54:31 UTC (rev 6452)
@@ -3458,6 +3458,11 @@
 
 void cpu_reset (CPUCRISState *env)
 {
+	if (qemu_loglevel_mask(CPU_LOG_RESET)) {
+		qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
+		log_cpu_state(env, 0);
+	}
+
 	memset(env, 0, offsetof(CPUCRISState, breakpoints));
 	tlb_flush(env, 1);
 

Modified: trunk/target-i386/helper.c
===================================================================
--- trunk/target-i386/helper.c	2009-01-26 19:37:41 UTC (rev 6451)
+++ trunk/target-i386/helper.c	2009-01-26 19:54:31 UTC (rev 6452)
@@ -418,6 +418,11 @@
 {
     int i;
 
+    if (qemu_loglevel_mask(CPU_LOG_RESET)) {
+        qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
+        log_cpu_state(env, X86_DUMP_FPU | X86_DUMP_CCOP);
+    }
+
     memset(env, 0, offsetof(CPUX86State, breakpoints));
 
     tlb_flush(env, 1);

Modified: trunk/target-m68k/helper.c
===================================================================
--- trunk/target-m68k/helper.c	2009-01-26 19:37:41 UTC (rev 6451)
+++ trunk/target-m68k/helper.c	2009-01-26 19:54:31 UTC (rev 6452)
@@ -143,6 +143,11 @@
 
 void cpu_reset(CPUM68KState *env)
 {
+    if (qemu_loglevel_mask(CPU_LOG_RESET)) {
+        qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
+        log_cpu_state(env, 0);
+    }
+
     memset(env, 0, offsetof(CPUM68KState, breakpoints));
 #if !defined (CONFIG_USER_ONLY)
     env->sr = 0x2700;

Modified: trunk/target-mips/translate.c
===================================================================
--- trunk/target-mips/translate.c	2009-01-26 19:37:41 UTC (rev 6451)
+++ trunk/target-mips/translate.c	2009-01-26 19:54:31 UTC (rev 6452)
@@ -8489,6 +8489,11 @@
 
 void cpu_reset (CPUMIPSState *env)
 {
+    if (qemu_loglevel_mask(CPU_LOG_RESET)) {
+        qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
+        log_cpu_state(env, 0);
+    }
+
     memset(env, 0, offsetof(CPUMIPSState, breakpoints));
 
     tlb_flush(env, 1);

Modified: trunk/target-ppc/helper.c
===================================================================
--- trunk/target-ppc/helper.c	2009-01-26 19:37:41 UTC (rev 6451)
+++ trunk/target-ppc/helper.c	2009-01-26 19:54:31 UTC (rev 6452)
@@ -2709,10 +2709,14 @@
 
 void cpu_ppc_reset (void *opaque)
 {
-    CPUPPCState *env;
+    CPUPPCState *env = opaque;
     target_ulong msr;
 
-    env = opaque;
+    if (qemu_loglevel_mask(CPU_LOG_RESET)) {
+        qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
+        log_cpu_state(env, 0);
+    }
+
     msr = (target_ulong)0;
     if (0) {
         /* XXX: find a suitable condition to enable the hypervisor mode */

Modified: trunk/target-sh4/translate.c
===================================================================
--- trunk/target-sh4/translate.c	2009-01-26 19:37:41 UTC (rev 6451)
+++ trunk/target-sh4/translate.c	2009-01-26 19:54:31 UTC (rev 6452)
@@ -184,6 +184,11 @@
 
 static void cpu_sh4_reset(CPUSH4State * env)
 {
+    if (qemu_loglevel_mask(CPU_LOG_RESET)) {
+        qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
+        log_cpu_state(env, 0);
+    }
+
 #if defined(CONFIG_USER_ONLY)
     env->sr = 0;
 #else

Modified: trunk/target-sparc/helper.c
===================================================================
--- trunk/target-sparc/helper.c	2009-01-26 19:37:41 UTC (rev 6451)
+++ trunk/target-sparc/helper.c	2009-01-26 19:54:31 UTC (rev 6452)
@@ -639,6 +639,11 @@
 
 void cpu_reset(CPUSPARCState *env)
 {
+    if (qemu_loglevel_mask(CPU_LOG_RESET)) {
+        qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
+        log_cpu_state(env, 0);
+    }
+
     tlb_flush(env, 1);
     env->cwp = 0;
     env->wim = 1;

                 reply	other threads:[~2009-01-26 19:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E1LRXXT-0003ZJ-Gm@cvs.savannah.gnu.org \
    --to=anthony@codemonkey.ws \
    --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).