From patchwork Thu Jun 28 03:03:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 140388 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1645379ljj; Wed, 27 Jun 2018 20:07:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcOwEiWBwYa5dNX1iN8d/ILWXqtSzKbY/1Ab/iil6baKEGJtBJxQsQCCVWj6TrOk+41uh4M X-Received: by 2002:a0c:d112:: with SMTP id a18-v6mr3769848qvh.200.1530155233043; Wed, 27 Jun 2018 20:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530155233; cv=none; d=google.com; s=arc-20160816; b=NBjqzryAWpLEBhoXp0t9Eh7/BnKaMCegPXTwD7AQUcXkcbCr50odnnPKmY7zvk3I+E ZVwliD45HbIQYB+dSVJHjI1AajF3JIDDb3/RYO9C3n2Cb2SQ69VYwx8lKzXkUTAJL8xR ncd4owxkcGAWoI8OjfoFuNTXfDMxBEBnnv1/Cojxkci6B5PZNimJfMVTNJqlPcjZmaeV SEQsVk8TqmVu8UMArM2JypH1zFZENxKPts7C0+e5/a6IrBxLjNW7Rh/OU8hvPsqPeY7a pXpoBavfeAOLmD8qw/Iwtfby2bEXuhp+YOhaLsSIm37lAz21s4GFtEIWP5+QtK6vmGaz yIVA== 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=R3p19GQQCpUaCzZ/5gjeFqnHGorzb/Pkw8aTgWN7PMI=; b=E4qym/+V1dtGSDEiaCc7wc8g6AF2rNUs8QDfaPT340pl7mX/K6HJfjpVmHfgxhnjQ9 jSLORwDwgO3sJsjFHJ8OTIrwkFSNmKHP0E0DExibhZKfImrnwmUYConyQhM5D53hnzY4 Wk8m7A0Rv/EmYdkMHcEqk0L4rZWzv7CtLEeFu8qHFspxcRIsTX5EtafGVA0ZWq9QFFAN rHCOy1QjATbgc28wCCUZZR8QZ3R2sySA/r2h6TiLAY0LOPq22HK59NN8D6GVuaFGpWii iGOPqe5VW6ixNOd+w4n+rUhia9W92NDDVIRBHtE5DSw1nhkNPExLXBPh+YEJGgHyvYy6 GTsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="MFjR/1/Z"; 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 h46-v6si1338435qth.404.2018.06.27.20.07.12 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 27 Jun 2018 20:07:13 -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="MFjR/1/Z"; 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]:34254 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYNH6-0007Qq-DE for patch@linaro.org; Wed, 27 Jun 2018 23:07:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYNDj-0004w4-7d for qemu-devel@nongnu.org; Wed, 27 Jun 2018 23:03:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYNDi-0007g3-CW for qemu-devel@nongnu.org; Wed, 27 Jun 2018 23:03:43 -0400 Received: from mail-pl0-x230.google.com ([2607:f8b0:400e:c01::230]:44071) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fYNDi-0007fQ-7L for qemu-devel@nongnu.org; Wed, 27 Jun 2018 23:03:42 -0400 Received: by mail-pl0-x230.google.com with SMTP id m16-v6so2005323pls.11 for ; Wed, 27 Jun 2018 20:03:42 -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=R3p19GQQCpUaCzZ/5gjeFqnHGorzb/Pkw8aTgWN7PMI=; b=MFjR/1/Z2HTMjvEbX8LqNsBcoQ+HVqcS3xsXLni7a4hQqCmmCPTv1UZkOz/FwwmYCo rWRRAY41veTaUhyIGn/wl4o/MhnznqwJBjejpUtGXH0SvmTvJ9ISnLcSwy0kK1uoBN/6 HUP9TFSfmiWhi7r2+2tBRdCg97lMT/8nRjZCo= 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=R3p19GQQCpUaCzZ/5gjeFqnHGorzb/Pkw8aTgWN7PMI=; b=ScUS4VI8ZcW18YmdEMx8HbXwq+r41hLWcEMt6GDK/N3z6LmrhifW7obYVaBQG9fpXy D0juaFXUp5ndEz+nnhH+ZA+sTdOsaNsrd13BOV6hoPBTGHDwUX86L8meNFWBLUz3sCq3 KTm56JNV4hZqqSHMpKqIvaZ8tJabFwmCGfT8cGYtCvvJCZnemIvqtXdrU4cGKL1ltAxi d3H53G2lu0eYBf1GlOOUqF/vFlKCqbd1EVkxYnbJOZyzdM3MdF99HCWiDHLXBKuA6/Mr /KuwZmUDHN9IKj+oeb0LQP4YpcZTJlMz1ijbLjBQoqk8qTxlrm9vDGNKWXKCrCGE7xfB bTSQ== X-Gm-Message-State: APt69E3VE2fHYZ4Yq/MUDMBwH2VrbLB9+FXAPQ7uDdRGnk80iXjTvNXE rMzu5NDp0LefjaiHaTpAUv35N+WHxvU= X-Received: by 2002:a17:902:3343:: with SMTP id a61-v6mr8552019plc.241.1530155020967; Wed, 27 Jun 2018 20:03:40 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-112-211.tukw.qwest.net. [97.126.112.211]) by smtp.gmail.com with ESMTPSA id y15-v6sm8030489pfm.136.2018.06.27.20.03.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Jun 2018 20:03:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 27 Jun 2018 20:03:13 -0700 Message-Id: <20180628030330.15615-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180628030330.15615-1-richard.henderson@linaro.org> References: <20180628030330.15615-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:c01::230 Subject: [Qemu-devel] [PATCH v3 06/23] target/openrisc: Fix singlestep_enabled 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: shorne@gmail.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We failed to store to cpu_pc before raising the exception, which caused us to re-execute the same insn that we stepped. Reviewed-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) -- 2.17.1 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 43bdf378eb..22848b17ad 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -1335,31 +1335,30 @@ static void openrisc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) { DisasContext *dc = container_of(dcbase, DisasContext, base); + /* If we have already exited the TB, nothing following has effect. */ + if (dc->base.is_jmp == DISAS_NORETURN) { + return; + } + if ((dc->tb_flags & TB_FLAGS_DFLAG ? 1 : 0) != (dc->delayed_branch != 0)) { tcg_gen_movi_i32(cpu_dflag, dc->delayed_branch != 0); } tcg_gen_movi_tl(cpu_ppc, dc->base.pc_next - 4); - if (dc->base.is_jmp == DISAS_NEXT) { - dc->base.is_jmp = DISAS_UPDATE; - tcg_gen_movi_tl(cpu_pc, dc->base.pc_next); - } - if (unlikely(dc->base.singlestep_enabled)) { - gen_exception(dc, EXCP_DEBUG); - } else { - switch (dc->base.is_jmp) { - case DISAS_TOO_MANY: - gen_goto_tb(dc, 0, dc->base.pc_next); - break; - case DISAS_NORETURN: - break; - case DISAS_UPDATE: - case DISAS_EXIT: + switch (dc->base.is_jmp) { + case DISAS_TOO_MANY: + gen_goto_tb(dc, 0, dc->base.pc_next); + break; + case DISAS_UPDATE: + case DISAS_EXIT: + if (unlikely(dc->base.singlestep_enabled)) { + gen_exception(dc, EXCP_DEBUG); + } else { tcg_gen_exit_tb(NULL, 0); - break; - default: - g_assert_not_reached(); } + break; + default: + g_assert_not_reached(); } }