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: Wed, 28 May 2008 11:01:36 -0300

enclose the cpu dumping logic in cpu_exec() inside cpu_exec_dump()
---
 cpu-exec.c           |   29 ++---------------------------
 exec-all.h           |    4 ++++
 target-i386/exec.h   |    2 ++
 target-i386/helper.c |    6 ++++++
 4 files changed, 14 insertions(+), 27 deletions(-)

diff --git a/cpu-exec.c b/cpu-exec.c
index 46b0eb8..52d74f7 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -369,33 +369,8 @@ 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)
-                    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_save_flags(env);
+                    cpu_exec_dump(env);
                 }
 #endif
                 tb = tb_find_fast();
diff --git a/exec-all.h b/exec-all.h
index b9a9348..97b9f10 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -96,6 +96,10 @@ void cpu_exec_init(CPUState *env);
 #define cpu_info_ip(env, buf) (0)
 #endif
 
+#ifndef cpu_exec_dump
+#define cpu_exec_dump(env) cpu_dump_state(env, logfile, fprintf, 0)
+#endif
+
 /* implemented by the targets */
 void cpu_handle_interrupt_request(CPUState *env);
 /* implemented by cpu-exec.c */
diff --git a/target-i386/exec.h b/target-i386/exec.h
index 2c96914..ee36f5e 100644
--- a/target-i386/exec.h
+++ b/target-i386/exec.h
@@ -48,6 +48,8 @@ do {
 
 #define cpu_info_ip x86_cpu_info_ip
 
+#define cpu_exec_dump x86_cpu_exec_dump
+
 extern FILE *logfile;
 extern int loglevel;
 
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 5e83efd..b10ebb8 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -4798,6 +4798,12 @@ int x86_cpu_info_ip(CPUState *env, char *buf)
     return 1;
 }
 
+void x86_cpu_exec_dump(CPUState *env)
+{
+    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) 
-- 
1.5.4.5





reply via email to

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