From patchwork Thu Sep 7 18:50:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 111967 Delivered-To: patch@linaro.org Received: by 10.140.94.239 with SMTP id g102csp496955qge; Thu, 7 Sep 2017 11:54:57 -0700 (PDT) X-Received: by 10.28.214.206 with SMTP id n197mr160086wmg.21.1504810496930; Thu, 07 Sep 2017 11:54:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504810496; cv=none; d=google.com; s=arc-20160816; b=at1JH6IYtV/5NgaHd0pLICBPuFMm82gJ7mFIQ0syLE/UKsDNegxwdjSUR09fmyahXd wGVIH++JaN35gnTpdhGBqC1JuWICKh6Kojp37ChRczu7UWpRt11VKTDGqZJlGGgQdFlp E8jadyIbyfU5NB2vDxAMemiuILjoSo0hP4dSemDBp8ry0iDS/pG8KhovrABpdNsyy4fR CtsowG2vaPXcq9NP/mBLHOO4ytvuXiVMETf34iSVFb/xpXOCw5PsPwxD8+6AWh2VBM8Q 9fHygxp4HZbILEl6j/J8IP+1vPTH4z1I0YjXmgE+v7hiTN38j/51aHZIM4qSaBdYSZbb sl7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=+obuuT3KDqk3lML+4zyj2n1JXa6qR78HKFY2pMtYFmA=; b=uAu6fxRxlILHoO5lmSXXO/I0V0C1+bDjPgoNmMoN2DBaSp+lWjL4PhNPsXFxqY3ge2 S3QPIwGS0AQ7/RwKNYDb4WV0gHEWrPLKwbZhBTrsNep/B2Hzecjo3V55LvjSjfIculo1 IFNDk+qDTLFn3DmHEH96mJ4MhTJpTCvCKPCIJm+kOIDd/bOp4BiGG000bE4o4yNq/CpV Hl3axppbuNiLWUI9bkqU9jC4FqHGXVY+UVdFqgAvusuQltj3rBf2VtangtMXOXgkvtQm RsvJnLHBIyzLbYhdkoWWDurE9xGR3bq8LzmR9twOzw5XqKQIWOTiSjFWdMy+rJHjI3ky NHHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JnwOSDVH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id p65si8156wmg.109.2017.09.07.11.54.56 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 07 Sep 2017 11:54:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JnwOSDVH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41779 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq1x1-00032i-N2 for patch@linaro.org; Thu, 07 Sep 2017 14:54:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq1tM-0000A4-PZ for qemu-devel@nongnu.org; Thu, 07 Sep 2017 14:51:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq1tI-0000VH-7l for qemu-devel@nongnu.org; Thu, 07 Sep 2017 14:51:08 -0400 Received: from mail-pf0-x233.google.com ([2607:f8b0:400e:c00::233]:35759) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dq1tI-0000Ur-1b for qemu-devel@nongnu.org; Thu, 07 Sep 2017 14:51:04 -0400 Received: by mail-pf0-x233.google.com with SMTP id g13so834775pfm.2 for ; Thu, 07 Sep 2017 11:51:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+obuuT3KDqk3lML+4zyj2n1JXa6qR78HKFY2pMtYFmA=; b=JnwOSDVH65IdZBt4GomioBwawVzPBNGhhQmwF+vK/2rG8mb1dPW+0r5sjhaa8la1yB eW50md0xERs5pLkDps2lvfdyuhLvuuRu38xI7o1LJwIDgSJDyUiiQx5vW9qGrahXjsTn gnn3BHKaLGUc5WJQVdFwN1ty66mD3JZ9bawrY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+obuuT3KDqk3lML+4zyj2n1JXa6qR78HKFY2pMtYFmA=; b=KJcoPz6MdPjWJyp9pZAYL77DI4q0E98RtIRJPAWmrpn95z0Y/nbsKm//YFLCZ9mYb8 jYEbRv6gkcSawubzmNGTPLmug1OtP+JQwV6dKehL99eSF7CuXh1TQBnQMfNhtgXM3qFN /ZheoG5eudxMjQV9UKh3FX2umSD4l0Tf2xlN8SBIXsdcoDfXfGmLOq1VpqqFSM0SHLE8 ijMsvkl00UxQ7ZwF3JXNQAnm3EJJGblbu5x+2ltNOGrRu1Z7q83/t+ZlzvaGsHS1RFNq bLfPV7kqeN/62iP0e8uwjvcmxXLgVHCJYWvp07JVVVzZ2YLXaGbg5UBvvskLSRD4VQGI 2+Hw== X-Gm-Message-State: AHPjjUg+W91CLsei8STNdDbdxxAVN0s+xra2duN8Igs7sRTJrDRFW6Vb YHzsfVpbgiRWjdvBFTOzfQ== X-Google-Smtp-Source: ADKCNb5Pq79h9mMTbhRSZKBQQqool5j18X6wC25rhbhLh6sM3GsB/EHoOtieaQym5SIkl9jr/MQn1A== X-Received: by 10.99.44.86 with SMTP id s83mr299904pgs.341.1504810262625; Thu, 07 Sep 2017 11:51:02 -0700 (PDT) Received: from pike.twiddle.net (97-126-108-236.tukw.qwest.net. [97.126.108.236]) by smtp.gmail.com with ESMTPSA id l74sm481401pfi.9.2017.09.07.11.51.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Sep 2017 11:51:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 11:50:55 -0700 Message-Id: <20170907185057.23421-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170907185057.23421-1-richard.henderson@linaro.org> References: <20170907185057.23421-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::233 Subject: [Qemu-devel] [PATCH v2 3/5] 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@aurel32.net, Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- target/sh4/translate.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) -- 2.13.5 diff --git a/target/sh4/translate.c b/target/sh4/translate.c index 6e03370871..5cda27cc0a 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -281,6 +281,7 @@ static void gen_jump(DisasContext * ctx) } else { tcg_gen_lookup_and_goto_ptr(cpu_pc); } + ctx->bstate = DISAS_NORETURN; } else { gen_goto_tb(ctx, 0, ctx->delayed_pc); } @@ -2349,24 +2350,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);