From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K10xH-0002tu-Mw for qemu-devel@nongnu.org; Tue, 27 May 2008 11:19:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K10xE-0002sk-Qu for qemu-devel@nongnu.org; Tue, 27 May 2008 11:19:15 -0400 Received: from [199.232.76.173] (port=40946 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K10xE-0002sf-J5 for qemu-devel@nongnu.org; Tue, 27 May 2008 11:19:12 -0400 Received: from mx1.redhat.com ([66.187.233.31]:48069) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K10xE-0006jI-IS for qemu-devel@nongnu.org; Tue, 27 May 2008 11:19:12 -0400 From: Glauber Costa Date: Tue, 27 May 2008 12:18:25 -0300 Message-Id: <1211901505-30519-7-git-send-email-gcosta@redhat.com> In-Reply-To: <1211901505-30519-6-git-send-email-gcosta@redhat.com> References: <1211901505-30519-1-git-send-email-gcosta@redhat.com> <1211901505-30519-2-git-send-email-gcosta@redhat.com> <1211901505-30519-3-git-send-email-gcosta@redhat.com> <1211901505-30519-4-git-send-email-gcosta@redhat.com> <1211901505-30519-5-git-send-email-gcosta@redhat.com> <1211901505-30519-6-git-send-email-gcosta@redhat.com> Subject: [Qemu-devel] [PATCH 6/6] cpu-exec-dump Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org 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"