qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Glauber Costa <gcosta@redhat.com>
To: qemu-devel@nongnu.org
Cc: kvm@vger.kernel.org
Subject: [Qemu-devel] [PATCH 6/6] cpu-exec-dump
Date: Wed, 28 May 2008 11:01:36 -0300	[thread overview]
Message-ID: <1211983296-27395-7-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <1211983296-27395-6-git-send-email-gcosta@redhat.com>

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	other threads:[~2008-05-28 14:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-28 14:01 [Qemu-devel] [PATCH 0/6] Simplify cpu_exec - spin 3 Glauber Costa
2008-05-28 14:01 ` [Qemu-devel] [PATCH 1/6] remove REGWPTR Glauber Costa
2008-05-28 14:01   ` [Qemu-devel] [PATCH 2/6] simplify cpu_exec Glauber Costa
2008-05-28 14:01     ` [Qemu-devel] [PATCH 3/6] Push common interrupt variables to cpu-defs.h Glauber Costa
2008-05-28 14:01       ` [Qemu-devel] [PATCH 4/6] use halted attribute for i386 too Glauber Costa
2008-05-28 14:01         ` [Qemu-devel] [PATCH 5/6] simply cpu_exec further Glauber Costa
2008-05-28 14:01           ` Glauber Costa [this message]
2008-05-28 18:03           ` Blue Swirl
2008-05-28 14:25 ` [Qemu-devel] [PATCH 0/6] Simplify cpu_exec - spin 3 Paul Brook
2008-05-28 14:44   ` Glauber Costa
  -- strict thread matches above, loose matches on Subject: below --
2008-05-27 15:18 [Qemu-devel] [PATCH 0/6] simplify cpu-exec new spin Glauber Costa
2008-05-27 15:18 ` [Qemu-devel] [PATCH 1/6] simplify cpu_exec Glauber Costa
2008-05-27 15:18   ` [Qemu-devel] [PATCH 2/6] Push common interrupt variables to cpu-defs.h Glauber Costa
2008-05-27 15:18     ` [Qemu-devel] [PATCH 3/6] use halted attribute for i386 too Glauber Costa
2008-05-27 15:18       ` [Qemu-devel] [PATCH 4/6] simply cpu_exec further Glauber Costa
2008-05-27 15:18         ` [Qemu-devel] [PATCH 5/6] isolate mmu code in arch-specific function Glauber Costa
2008-05-27 15:18           ` [Qemu-devel] [PATCH 6/6] cpu-exec-dump Glauber Costa
2008-05-27 15:38             ` Paul Brook

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=1211983296-27395-7-git-send-email-gcosta@redhat.com \
    --to=gcosta@redhat.com \
    --cc=kvm@vger.kernel.org \
    --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).