qemu-devel
[Top][All Lists]
Advanced

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

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


From: Glauber Costa
Subject: [Qemu-devel] [PATCH 5/5] cpu-exec-dump
Date: Thu, 29 May 2008 12:16:06 -0300

enclose the cpu dumping logic in cpu_exec() inside cpu_exec_dump()
---
 cpu-exec.c            |   29 ++---------------------------
 exec-all.h            |    2 ++
 target-alpha/helper.c |    5 +++++
 target-arm/helper.c   |    5 +++++
 target-cris/helper.c  |    5 +++++
 target-i386/exec.h    |    2 ++
 target-i386/helper.c  |    6 ++++++
 target-m68k/helper.c  |    5 +++++
 target-mips/helper.c  |    5 +++++
 target-ppc/helper.c   |    5 +++++
 target-sh4/helper.c   |    5 +++++
 target-sparc/helper.c |    5 +++++
 12 files changed, 52 insertions(+), 27 deletions(-)

diff --git a/cpu-exec.c b/cpu-exec.c
index 9526608..df652fd 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -368,33 +368,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 3a6f2a5..139b975 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -79,6 +79,8 @@ void cpu_exec_init(CPUState *env);
 
 extern int cpu_info_ip(CPUState *env, char *buf);
 
+void cpu_exec_dump(CPUState *env);
+
 /* implemented by the targets */
 void cpu_handle_interrupt_request(CPUState *env);
 void do_interrupt(CPUState *env);
diff --git a/target-alpha/helper.c b/target-alpha/helper.c
index 593f600..16843c5 100644
--- a/target-alpha/helper.c
+++ b/target-alpha/helper.c
@@ -463,3 +463,8 @@ void cpu_handle_interrupt_request(CPUState *env)
         reset_tb();
     }
 }
+
+void cpu_exec_dump(CPUState *env)
+{
+    cpu_dump_state(env, logfile, fprintf, 0);
+}
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 80eda6f..61a07c7 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -2551,3 +2551,8 @@ void cpu_handle_interrupt_request(CPUState *env)
         reset_tb();
     }
 }
+
+void cpu_exec_dump(CPUState *env)
+{
+    cpu_dump_state(env, logfile, fprintf, 0);
+}
diff --git a/target-cris/helper.c b/target-cris/helper.c
index 5ae7c52..67ecf84 100644
--- a/target-cris/helper.c
+++ b/target-cris/helper.c
@@ -193,3 +193,8 @@ void cpu_handle_interrupt_request(CPUState *env)
         reset_tb();
     }
 }
+
+void cpu_exec_dump(CPUState *env)
+{
+    cpu_dump_state(env, logfile, fprintf, 0);
+}
diff --git a/target-i386/exec.h b/target-i386/exec.h
index 1a7f563..8a5d616 100644
--- a/target-i386/exec.h
+++ b/target-i386/exec.h
@@ -31,6 +31,8 @@
 
 register struct CPUX86State *env asm(AREG0);
 
+#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 997e377..a662dea 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -785,6 +785,12 @@ int cpu_info_ip(CPUState *env, char *buf)
     return 1;
 }
 
+void 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)
 
 int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index 83f0fe0..ad1908e 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -898,3 +898,8 @@ void HELPER(set_mac_extu)(CPUState *env, uint32_t val, 
uint32_t acc)
 }
 
 int cpu_info_ip(CPUState *env, char *buf) { return 0; }
+
+void cpu_exec_dump(CPUState *env)
+{
+    cpu_dump_state(env, logfile, fprintf, 0);
+}
diff --git a/target-mips/helper.c b/target-mips/helper.c
index 2cd322a..832d506 100644
--- a/target-mips/helper.c
+++ b/target-mips/helper.c
@@ -654,3 +654,8 @@ void r4k_invalidate_tlb (CPUState *env, int idx, int 
use_extra)
 }
 
 int cpu_info_ip(CPUState *env, char *buf) { return 0; }
+
+void cpu_exec_dump(CPUState *env)
+{
+    cpu_dump_state(env, logfile, fprintf, 0);
+}
diff --git a/target-ppc/helper.c b/target-ppc/helper.c
index d6a3ea5..c97f733 100644
--- a/target-ppc/helper.c
+++ b/target-ppc/helper.c
@@ -3009,3 +3009,8 @@ void cpu_handle_interrupt_request(CPUState *env)
         reset_tb();
     }
 }
+
+void cpu_exec_dump(CPUState *env)
+{
+    cpu_dump_state(env, logfile, fprintf, 0);
+}
diff --git a/target-sh4/helper.c b/target-sh4/helper.c
index 7043fb4..d75bf3b 100644
--- a/target-sh4/helper.c
+++ b/target-sh4/helper.c
@@ -544,3 +544,8 @@ void cpu_handle_interrupt_request(CPUState *env)
         reset_tb();
     }
 }
+
+void cpu_exec_dump(CPUState *env)
+{
+    cpu_dump_state(env, logfile, fprintf, 0);
+}
diff --git a/target-sparc/helper.c b/target-sparc/helper.c
index 39f077a..6cb67d9 100644
--- a/target-sparc/helper.c
+++ b/target-sparc/helper.c
@@ -1585,3 +1585,8 @@ void helper_tick_set_limit(void *opaque, uint64_t limit)
 #endif
 }
 #endif
+
+void cpu_exec_dump(CPUState *env)
+{
+    cpu_dump_state(env, logfile, fprintf, 0);
+}
-- 
1.5.4.5





reply via email to

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