From patchwork Mon May 9 21:34:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 94859 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E0F3CB6F17 for ; Tue, 10 May 2011 07:36:57 +1000 (EST) Received: from localhost ([::1]:56350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJY8N-0005pv-5v for incoming@patchwork.ozlabs.org; Mon, 09 May 2011 17:36:55 -0400 Received: from eggs.gnu.org ([140.186.70.92]:38263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJY6X-0003FI-JS for qemu-devel@nongnu.org; Mon, 09 May 2011 17:35:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QJY6W-0006BL-Pw for qemu-devel@nongnu.org; Mon, 09 May 2011 17:35:01 -0400 Received: from mail-iy0-f173.google.com ([209.85.210.173]:48729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJY6W-0006A3-MN for qemu-devel@nongnu.org; Mon, 09 May 2011 17:35:00 -0400 Received: by mail-iy0-f173.google.com with SMTP id 10so5564538iym.4 for ; Mon, 09 May 2011 14:35:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:subject:date:message-id:x-mailer :in-reply-to:references; bh=leJnjuuXd0PYleemEMjiSatfGTrVE/8C7w2sL388XCo=; b=dnXZJ0ap14L8jK4N2Z28zO/gfyX46txjlX7Ili7uB9qnsUFKA1feLMET1fFGJPApwk BBqYa/+iZHfzCPIchdwp77+jbjC8jheUFhk6qA1AxBcBIvrH5Uf6ViiVrocbcCCX/Mr1 fLFw8Crqql7iSdBP0oWph24IAoH1jtlBFAMDU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; b=dY8ALT9aPl+49ywWlznIufQ1Z/7+yBu1AP9WCP5SSNSA/29aNnE2atuXSxIVDH5BFv 2S3xDw/5Ixf4/SgXDZOiwJNDsPcPC3B4DO9R3OzHpNLnqyvcTe+gf95MX96Wgxx6IJmT hbjnTy8hGROTrGgnO8dlKjViXPhr6e75QFYv0= Received: by 10.43.45.198 with SMTP id ul6mr6395955icb.500.1304976900329; Mon, 09 May 2011 14:35:00 -0700 (PDT) Received: from localhost.localdomain (are.twiddle.net [75.101.38.216]) by mx.google.com with ESMTPS id ui7sm2549819icb.14.2011.05.09.14.34.59 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 May 2011 14:34:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 9 May 2011 14:34:18 -0700 Message-Id: <1304976889-29675-5-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1304976889-29675-1-git-send-email-rth@twiddle.net> References: <1304976889-29675-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.173 Subject: [Qemu-devel] [PATCH 04/35] target-alpha: Single-step properly across branches. 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 We were failing to generate EXC_DEBUG in the EXIT_PC_UPDATED path. This caused us not to stop at the instruction after a branch, but on the instruction afterward. Signed-off-by: Richard Henderson --- target-alpha/translate.c | 35 ++++++++++++++++++++--------------- 1 files changed, 20 insertions(+), 15 deletions(-) diff --git a/target-alpha/translate.c b/target-alpha/translate.c index 456ba51..194a286 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -147,17 +147,21 @@ static void alpha_translate_init(void) done_init = 1; } -static ExitStatus gen_excp(DisasContext *ctx, int exception, int error_code) +static void gen_excp_1(int exception, int error_code) { TCGv_i32 tmp1, tmp2; - tcg_gen_movi_i64(cpu_pc, ctx->pc); tmp1 = tcg_const_i32(exception); tmp2 = tcg_const_i32(error_code); gen_helper_excp(tmp1, tmp2); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp1); +} +static ExitStatus gen_excp(DisasContext *ctx, int exception, int error_code) +{ + tcg_gen_movi_i64(cpu_pc, ctx->pc); + gen_excp_1(exception, error_code); return EXIT_NORETURN; } @@ -3211,18 +3215,15 @@ static inline void gen_intermediate_code_internal(CPUState *env, ctx.pc += 4; ret = translate_one(ctxp, insn); - if (ret == NO_EXIT) { - /* If we reach a page boundary, are single stepping, - or exhaust instruction count, stop generation. */ - if (env->singlestep_enabled) { - gen_excp(&ctx, EXCP_DEBUG, 0); - ret = EXIT_PC_UPDATED; - } else if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0 - || gen_opc_ptr >= gen_opc_end - || num_insns >= max_insns - || singlestep) { - ret = EXIT_PC_STALE; - } + /* If we reach a page boundary, are single stepping, + or exhaust instruction count, stop generation. */ + if (ret == NO_EXIT + && ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0 + || gen_opc_ptr >= gen_opc_end + || num_insns >= max_insns + || singlestep + || env->singlestep_enabled)) { + ret = EXIT_PC_STALE; } } while (ret == NO_EXIT); @@ -3238,7 +3239,11 @@ static inline void gen_intermediate_code_internal(CPUState *env, tcg_gen_movi_i64(cpu_pc, ctx.pc); /* FALLTHRU */ case EXIT_PC_UPDATED: - tcg_gen_exit_tb(0); + if (env->singlestep_enabled) { + gen_excp_1(EXCP_DEBUG, 0); + } else { + tcg_gen_exit_tb(0); + } break; default: abort();