qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 6/6] cpu-exec-dump


From: Glauber Costa
Subject: [Qemu-devel] [PATCH 6/6] cpu-exec-dump
Date: Tue, 27 May 2008 12:18:25 -0300

enclose the cpu dumping logic in cpu_exec() inside cpu_exec_dump()

---
 cpu-exec.c            |   30 +-----------------------------
 target-alpha/helper.c |    5 +++++
 target-arm/helper.c   |    5 +++++
 target-cris/helper.c  |    5 +++++
 target-i386/helper.c  |    8 ++++++++
 target-m68k/helper.c  |   10 ++++++++++
 target-mips/helper.c  |    5 +++++
 target-ppc/helper.c   |    4 ++++
 target-sh4/helper.c   |    5 +++++
 target-sparc/helper.c |    9 +++++++++
 10 files changed, 57 insertions(+), 29 deletions(-)

Index: qemu/cpu-exec.c
===================================================================
--- qemu.orig/cpu-exec.c
+++ qemu/cpu-exec.c
@@ -369,35 +369,7 @@ int cpu_exec(CPUState *env1)
                 if ((loglevel & CPU_LOG_TB_CPU)) {
                     /* restore flags in standard format */
                     regs_to_env();
-#if defined(TARGET_I386)
-                    env->eflags = env->eflags | cc_table[CC_OP].compute_all() 
| (DF & DF_MASK);
-                    cpu_dump_state(env, logfile, fprintf, X86_DUMP_CCOP);
-                    env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | 
CC_P | CC_C);
-#elif defined(TARGET_ARM)
-                    cpu_dump_state(env, logfile, fprintf, 0);
-#elif defined(TARGET_SPARC)
-                   REGWPTR = env->regbase + (env->cwp * 16);
-                   env->regwptr = REGWPTR;
-                    cpu_dump_state(env, logfile, fprintf, 0);
-#elif defined(TARGET_PPC)
-                    cpu_dump_state(env, logfile, fprintf, 0);
-#elif defined(TARGET_M68K)
-                    cpu_m68k_flush_flags(env, env->cc_op);
-                    env->cc_op = CC_OP_FLAGS;
-                    env->sr = (env->sr & 0xffe0)
-                              | env->cc_dest | (env->cc_x << 4);
-                    cpu_dump_state(env, logfile, fprintf, 0);
-#elif defined(TARGET_MIPS)
-                    cpu_dump_state(env, logfile, fprintf, 0);
-#elif defined(TARGET_SH4)
-                   cpu_dump_state(env, logfile, fprintf, 0);
-#elif defined(TARGET_ALPHA)
-                    cpu_dump_state(env, logfile, fprintf, 0);
-#elif defined(TARGET_CRIS)
-                    cpu_dump_state(env, logfile, fprintf, 0);
-#else
-#error unsupported target CPU
-#endif
+                    cpu_exec_dump(env);
                 }
 #endif
                 tb = tb_find_fast();
Index: qemu/target-alpha/helper.c
===================================================================
--- qemu.orig/target-alpha/helper.c
+++ qemu/target-alpha/helper.c
@@ -466,3 +466,8 @@ void arch_handle_interrupt_request(CPUSt
         reset_tb();
     }
 }
+
+void cpu_exec_dump(CPUState *env)
+{
+    cpu_dump_state(env, logfile, fprintf, 0);
+}
Index: qemu/target-arm/helper.c
===================================================================
--- qemu.orig/target-arm/helper.c
+++ qemu/target-arm/helper.c
@@ -2555,3 +2555,8 @@ void arch_handle_interrupt_request(CPUSt
         reset_tb();
     }
 }
+
+void cpu_exec_dump(CPUState *env)
+{
+    cpu_dump_state(env, logfile, fprintf, 0);
+}
Index: qemu/target-cris/helper.c
===================================================================
--- qemu.orig/target-cris/helper.c
+++ qemu/target-cris/helper.c
@@ -197,3 +197,8 @@ void arch_handle_interrupt_request(CPUSt
         reset_tb();
     }
 }
+
+void cpu_exec_dump(CPUState *env)
+{
+    cpu_dump_state(env, logfile, fprintf, 0);
+}
Index: qemu/target-i386/helper.c
===================================================================
--- qemu.orig/target-i386/helper.c
+++ qemu/target-i386/helper.c
@@ -4767,6 +4767,14 @@ void cpu_reset_mmu(CPUState *env)
     }
 #endif
 }
+
+void cpu_exec_dump(CPUState *env)
+{
+    env->eflags = env->eflags | cc_table[CC_OP].compute_all() | (DF & DF_MASK);
+    cpu_dump_state(env, logfile, fprintf, X86_DUMP_CCOP);
+    env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
+}
+
 #if defined(CONFIG_USER_ONLY)
 
 void helper_vmrun(void) 
Index: qemu/target-m68k/helper.c
===================================================================
--- qemu.orig/target-m68k/helper.c
+++ qemu/target-m68k/helper.c
@@ -373,6 +373,16 @@ void arch_handle_interrupt_request(CPUSt
         reset_tb();
     }
 }
+
+void cpu_exec_dump(CPUState *env)
+{
+    cpu_m68k_flush_flags(env, env->cc_op);
+    env->cc_op = CC_OP_FLAGS;
+    env->sr = (env->sr & 0xffe0)
+              | env->cc_dest | (env->cc_x << 4);
+    cpu_dump_state(env, logfile, fprintf, 0);
+}
+
 #if defined(CONFIG_USER_ONLY)
 
 int cpu_m68k_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
Index: qemu/target-mips/helper.c
===================================================================
--- qemu.orig/target-mips/helper.c
+++ qemu/target-mips/helper.c
@@ -663,3 +663,8 @@ void arch_handle_interrupt_request(CPUSt
         reset_tb();
     }
 }
+
+void cpu_exec_dump(CPUState *env)
+{
+    cpu_dump_state(env, logfile, fprintf, 0);
+}
Index: qemu/target-ppc/helper.c
===================================================================
--- qemu.orig/target-ppc/helper.c
+++ qemu/target-ppc/helper.c
@@ -3014,3 +3014,7 @@ void arch_handle_interrupt_request(CPUSt
     }
 }
 
+void cpu_exec_dump(CPUState *env)
+{
+    cpu_dump_state(env, logfile, fprintf, 0);
+}
Index: qemu/target-sh4/helper.c
===================================================================
--- qemu.orig/target-sh4/helper.c
+++ qemu/target-sh4/helper.c
@@ -547,3 +547,8 @@ void arch_handle_interrupt_request(CPUSt
         reset_tb();
     }
 }
+
+void cpu_exec_dump(CPUState *env)
+{
+    cpu_dump_state(env, logfile, fprintf, 0);
+}
Index: qemu/target-sparc/helper.c
===================================================================
--- qemu.orig/target-sparc/helper.c
+++ qemu/target-sparc/helper.c
@@ -1342,6 +1342,15 @@ void cpu_put_flags(CPUState *env)
 
 void cpu_reset_mmu(CPUState *env) {}
 
+void cpu_exec_dump(CPUState *env)
+{
+#if defined(reg_REGWPTR)
+    REGWPTR = env->regbase + (env->cwp * 16);
+    env->regwptr = REGWPTR;
+#endif
+    cpu_dump_state(env, logfile, fprintf, 0);
+}
+
 #ifdef TARGET_SPARC64
 #if !defined(CONFIG_USER_ONLY)
 #include "qemu-common.h"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]