From patchwork Mon Jun 18 18:40:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 139051 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4284680lji; Mon, 18 Jun 2018 11:47:35 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKHRmKbs3p8sR5BVNO5TGm0JicNDs59CvEcWs0umuHZa9gIXEirbLM8FntIRk74fcIZHCwE X-Received: by 2002:a37:1286:: with SMTP id 6-v6mr11066602qks.158.1529347655123; Mon, 18 Jun 2018 11:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529347655; cv=none; d=google.com; s=arc-20160816; b=BRcoPuZHSQPwyTvEkp6/+3Rg7SKuVF9FkEkilal2/2njhy21yxhNNWLIS2cx1dcMuq 5WH6yAGrf3uFVnuMKAM3iAvskBEFupBpGn6D8N2BGHqaaSo8OHGB6vcrz/onf1ArxvzH hGMHmPKZeacEifC6XffnQShpMpJUOsUYSRpUOADtNs0NoGDygKSRacEABKRCDm/Zqygs exwV+R+o6eyAPBzX8XCfJ9OVdeP0KhSQTaQQtTy0lvlf981O5CDVHeHjjV9aJishuxrc EG4pQa3JRaCW+VW1UMXA+JHC1QvZ7LdoIjIOipnzSQwFY4UqUJuwbB4eGWuSuhdfqACF rVEQ== 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=okrGuESigjgaQnuZmSE8aRSEUI5aZPcWynqKq+MblOQ=; b=y2xJFXPln7Sn0LvXTsk8GK5EByI0zzQUGWcUqvjsAIwGCmQGKNXygyJ3Arv/jf87pw 4wc00VFQwMBaiOqAKQtcUW3lAX8VIQOl6mOCUKE9dTvVBeY6/INCNdEX45pkOd6bdysM xHtYzT4WT0ae+uopsXYonKa2HVA2R7YWPUgBEmi+OL944765mk1tb0QWcssKpC4ua1fT 9biCgerZDbrKlENNhPNaI6Dkc3L0vmUeS9SkYlPQudKQfBkO4qLQM0hVYaUxMc9XBgfw Lim9EbsGLlA8TbfFGs3fkqxSpC5S1EWkHVtvEndWirm2xxb1kvFjIEXzSpEcUQgCqUlV MDmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Lhky2cjd; 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 h35-v6si7830015qkh.156.2018.06.18.11.47.34 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Jun 2018 11:47:35 -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=Lhky2cjd; 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]:36493 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUzBe-0008M8-IQ for patch@linaro.org; Mon, 18 Jun 2018 14:47:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUz5G-0003Lf-NY for qemu-devel@nongnu.org; Mon, 18 Jun 2018 14:40:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fUz5F-0004QR-Ss for qemu-devel@nongnu.org; Mon, 18 Jun 2018 14:40:58 -0400 Received: from mail-pg0-x231.google.com ([2607:f8b0:400e:c05::231]:44218) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fUz5F-0004O3-Mi for qemu-devel@nongnu.org; Mon, 18 Jun 2018 14:40:57 -0400 Received: by mail-pg0-x231.google.com with SMTP id p21-v6so7919533pgd.11 for ; Mon, 18 Jun 2018 11:40:57 -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=okrGuESigjgaQnuZmSE8aRSEUI5aZPcWynqKq+MblOQ=; b=Lhky2cjd5lpXu/Id/givO6Lb8+LZbx1QmxxiKkInklMr6vDbjEPAuHFepa7ENd1Ocg 6lstaGOB40/6fBWNlOIiBRJk8wJISKSQhDmYbXS2RDPeFeRprmGXSwHrDmyQCmwKxFNj HXKDoFuUcNJfuSmApQWYfv31cbJm5o3GMWCBk= 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=okrGuESigjgaQnuZmSE8aRSEUI5aZPcWynqKq+MblOQ=; b=N7jFSKg0a43BPdU9BRImOJ6TwBh7sWuXfsQ3xlKbfGK7x/SWG9JpJi7TIiKzvvkIlb 8wL7P9Cim7BwhnkbL+18aPWDUxCzbIE7GOFS3UK1xr0nMc0RGjmkRm/O3h3JMamM74Ra dG470RZ0Pqo4DoQBzmPQ27OmHIIOyzK6z7ULg9Q1bBmZJ8Td3f7vnDeOaUql0eoaK+6A 8mios5GsDXfRRXzv9cdIlq880+j/CdlS88Hl00jRNChY6/8BdsKPF/e2plFAIoQ3oqcu eqpEezej4ZLXG2pSjLGJ18ZBhZckvobjLcJJydNj0h/e3D6TtWkLe3LLV44kqCJ57gkv hu4A== X-Gm-Message-State: APt69E3ddsQ20amw5nrs0AgBwKvEcMTXverBqS1rp3oT2d5CH2/ivF+p OkTtP/qHCdvVi9GT939Y8ePXYTlLl0w= X-Received: by 2002:a62:660a:: with SMTP id a10-v6mr14685794pfc.156.1529347256452; Mon, 18 Jun 2018 11:40:56 -0700 (PDT) Received: from cloudburst.twiddle.net (mta-98-147-121-51.hawaii.rr.com. [98.147.121.51]) by smtp.gmail.com with ESMTPSA id i65-v6sm49457254pfd.17.2018.06.18.11.40.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 11:40:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 08:40:27 -1000 Message-Id: <20180618184046.6270-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618184046.6270-1-richard.henderson@linaro.org> References: <20180618184046.6270-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:c05::231 Subject: [Qemu-devel] [PATCH v2 03/22] 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 c7c1f40782..5c0c9dee09 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -1449,31 +1449,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(); } }