From patchwork Thu Nov 7 01:04:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 289077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0F1B22C014B for ; Thu, 7 Nov 2013 12:06:51 +1100 (EST) Received: from localhost ([::1]:36823 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeE3b-0006lT-To for incoming@patchwork.ozlabs.org; Wed, 06 Nov 2013 20:06:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeE32-0006kO-8G for qemu-devel@nongnu.org; Wed, 06 Nov 2013 20:06:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VeE2w-0005s5-DT for qemu-devel@nongnu.org; Wed, 06 Nov 2013 20:06:12 -0500 Received: from mail-pd0-x22a.google.com ([2607:f8b0:400e:c02::22a]:34775) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeE2w-0005rs-5o for qemu-devel@nongnu.org; Wed, 06 Nov 2013 20:06:06 -0500 Received: by mail-pd0-f170.google.com with SMTP id v10so301063pde.15 for ; Wed, 06 Nov 2013 17:06:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=fX95oUZEBHKvrfEWRBjPmD8gveT59Yo51gJibiVbNOM=; b=rXiwAmDlDNZHKuyuxlWC+ZlUmIc6fB7lABc2KBdGOAOL73C/18gY254ezSW/7yONcn dKus8M3Tzkfn9xpXmmjAgp+Mby5MadtFAkqFjo16dnzlF62we8EnxgtwBWMijALWKLMu mJUrr4+RLST1ztqGSBLee9Re1PaoooiVrJaU6m05x/9dsd4tKL4d5GgFZsv4XJhg7Adr TkbYKXjdvPN7eNMMi+A+dmtXxq/6VkUjWMiecyjkMsEfKRlRJtmSuAeyAx9itS+St0kd WwE9QGvPRe2jIm4BhiHcpR/9ISGWv8TC48QnqmB/CqoD9LDTi+whRdLCGvIqAuvGEXWY x5BQ== X-Received: by 10.68.202.38 with SMTP id kf6mr6132813pbc.43.1383786365185; Wed, 06 Nov 2013 17:06:05 -0800 (PST) Received: from pebble.com (CPE-138-130-249-46.lnse4.cha.bigpond.net.au. [138.130.249.46]) by mx.google.com with ESMTPSA id xs1sm1726198pac.7.2013.11.06.17.06.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Nov 2013 17:06:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 7 Nov 2013 11:04:24 +1000 Message-Id: <1383786324-18415-2-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1383786324-18415-1-git-send-email-rth@twiddle.net> References: <1383786324-18415-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c02::22a Subject: [Qemu-devel] [PATCH for-1.8 01/61] exec: Delay CPU_LOG_TB_CPU until we actually execute a TB X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The previous placement could result in duplicate logging while still processing interrupts. Signed-off-by: Richard Henderson --- cpu-exec.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 30cfa2a..3c4800f 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -53,7 +53,25 @@ void cpu_resume_from_signal(CPUArchState *env, void *puc) static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, uint8_t *tb_ptr) { CPUArchState *env = cpu->env_ptr; - uintptr_t next_tb = tcg_qemu_tb_exec(env, tb_ptr); + uintptr_t next_tb; + +#if defined(DEBUG_DISAS) + if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) { +#if defined(TARGET_I386) + log_cpu_state(cpu, CPU_DUMP_CCOP); +#elif defined(TARGET_M68K) + /* ??? Should not modify env state for dumping. */ + 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); + log_cpu_state(cpu, 0); +#else + log_cpu_state(cpu, 0); +#endif + } +#endif /* DEBUG_DISAS */ + + next_tb = tcg_qemu_tb_exec(env, tb_ptr); if ((next_tb & TB_EXIT_MASK) > TB_EXIT_IDX1) { /* We didn't start executing this TB (eg because the instruction * counter hit zero); we must restore the guest PC to the address @@ -579,22 +597,6 @@ int cpu_exec(CPUArchState *env) env->exception_index = EXCP_INTERRUPT; cpu_loop_exit(env); } -#if defined(DEBUG_DISAS) - if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) { - /* restore flags in standard format */ -#if defined(TARGET_I386) - log_cpu_state(cpu, CPU_DUMP_CCOP); -#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); - log_cpu_state(cpu, 0); -#else - log_cpu_state(cpu, 0); -#endif - } -#endif /* DEBUG_DISAS */ spin_lock(&tcg_ctx.tb_ctx.tb_lock); tb = tb_find_fast(env); /* Note: we do it here to avoid a gcc bug on Mac OS X when