From patchwork Mon Dec 18 22:40:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 10122033 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D885D60327 for ; Mon, 18 Dec 2017 22:46:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9B8B28B1A for ; Mon, 18 Dec 2017 22:46:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BED3928B4A; Mon, 18 Dec 2017 22:46:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 34A1028B1A for ; Mon, 18 Dec 2017 22:46:58 +0000 (UTC) Received: from localhost ([::1]:50193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eR4BV-0003sy-7s for patchwork-qemu-devel@patchwork.kernel.org; Mon, 18 Dec 2017 17:46:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eR45a-0007Hj-HI for qemu-devel@nongnu.org; Mon, 18 Dec 2017 17:40:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eR45Z-00047n-I3 for qemu-devel@nongnu.org; Mon, 18 Dec 2017 17:40:50 -0500 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:43026) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eR45Z-0003vY-Bi for qemu-devel@nongnu.org; Mon, 18 Dec 2017 17:40:49 -0500 Received: from [2001:bc8:30d7:120:9bb5:8936:7e6a:9e36] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1eR45Q-0008DC-9x; Mon, 18 Dec 2017 23:40:40 +0100 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.90_RC3) (envelope-from ) id 1eR45P-00070S-H3; Mon, 18 Dec 2017 23:40:39 +0100 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 23:40:29 +0100 Message-Id: <20171218224030.26726-6-aurelien@aurel32.net> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171218224030.26726-1-aurelien@aurel32.net> References: <20171218224030.26726-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PULL 5/6] target/sh4: Do not singlestep after exceptions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Richard Henderson If we've already raised an exception (and set NORETURN), do not emit unreachable code to raise a debug exception. Note that gen_goto_tb takes single-stepping into account. Signed-off-by: Richard Henderson Message-Id: <20170907185057.23421-4-richard.henderson@linaro.org> Signed-off-by: Aurelien Jarno --- target/sh4/translate.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/target/sh4/translate.c b/target/sh4/translate.c index efd1081c57..dd9aaa4e63 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -270,6 +270,7 @@ static void gen_jump(DisasContext * ctx) } else { tcg_gen_lookup_and_goto_ptr(); } + ctx->bstate = DISAS_NORETURN; } else { gen_goto_tb(ctx, 0, ctx->delayed_pc); } @@ -2341,24 +2342,23 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb) ctx.envflags &= ~GUSA_MASK; } - if (cs->singlestep_enabled) { + switch (ctx.bstate) { + case DISAS_STOP: gen_save_cpu_state(&ctx, true); - gen_helper_debug(cpu_env); - } else { - switch (ctx.bstate) { - case DISAS_STOP: - gen_save_cpu_state(&ctx, true); + if (cs->singlestep_enabled) { + gen_helper_debug(cpu_env); + } else { tcg_gen_exit_tb(0); - break; - case DISAS_NEXT: - gen_save_cpu_state(&ctx, false); - gen_goto_tb(&ctx, 0, ctx.pc); - break; - case DISAS_NORETURN: - break; - default: - g_assert_not_reached(); - } + } + break; + case DISAS_NEXT: + gen_save_cpu_state(&ctx, false); + gen_goto_tb(&ctx, 0, ctx.pc); + break; + case DISAS_NORETURN: + break; + default: + g_assert_not_reached(); } gen_tb_end(tb, num_insns);