From patchwork Sun May 27 14:13:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 137016 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1788465lji; Sun, 27 May 2018 07:20:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIxiiqhSbKjyFtY+HdkM2YG1olYj+NNF6X9IPkemrd48FKx12bmEKzEV2kzyYLP9PRa13MT X-Received: by 2002:a0c:81e1:: with SMTP id 30-v6mr9030217qve.187.1527430819502; Sun, 27 May 2018 07:20:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527430819; cv=none; d=google.com; s=arc-20160816; b=qcdfhZz9nd7rCzBr0RqT39F/OB7DiZIyjn9NYrEY7LNdc71wWaHgxP/RjRXyoEKA5O p1dhxseZY51aacAsGc+V6JbL7h0H44cRVTdN0z0/hV9uWIebkKYVHUpG/D/t/rmgpffM kG+k8MXvSyLigUfVIdtlu01/shnCOSdVCnOc7SYEhiZjDIxWgatEHRndnzM2OuwcKEcz PDOEhPzlo2YC731T+BZARt//ZcaLt4dIhHe/aGInM34V4OUGraQQXgPFi7GKY8SP2OUD aPDo2aB2dspRLqsjI4rd76DxPcll6Sf9JPihOnJpC0NsbMzpcrBnZxEuWgKGV9xtNKcr BFXw== 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=r57v6jrRbtE42Q+OBojj/J0UuniCJHknBOwTp86sJ0c=; b=jeWAMs/ChXbDcUc/JSr0z7Bj2nRenZfgNG3oA5sXMfayj9p61V4tHJCSpxen8i3Gw/ M/LaQA0L3NmH2OL5oaZ4zhBIts3Z8E7cZHPEf0FoU+4Kjiiolsbm9zQgTp6uMAznz5AA xBJVgPIA8+CuERaxsAqRr0EauH+1YYDfgFOBoxeljxEcgCdZcJj3iOV+5Ki8+ReOgTmq O7+lt11NN276WaOEhatQn1kRq2CB43FZDSkdhG2S+dzP1vEwhljehK3N4L5UXZESwAGp OJ348H1A66wZOaEXpx1CDq4JdKP2Ffmhm+8Ae9/V7TKT0dunnIXWMFXzD0zHzTAes6L9 jT8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=D5LGFh8X; 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 c47-v6si2090021qvh.93.2018.05.27.07.20.19 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 27 May 2018 07:20:19 -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=D5LGFh8X; 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]:52229 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fMwWw-000570-Sv for patch@linaro.org; Sun, 27 May 2018 10:20:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fMwQR-0008Ps-9S for qemu-devel@nongnu.org; Sun, 27 May 2018 10:13:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fMwQQ-0004NF-7v for qemu-devel@nongnu.org; Sun, 27 May 2018 10:13:35 -0400 Received: from mail-pl0-x22c.google.com ([2607:f8b0:400e:c01::22c]:44997) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fMwQQ-0004N5-24 for qemu-devel@nongnu.org; Sun, 27 May 2018 10:13:34 -0400 Received: by mail-pl0-x22c.google.com with SMTP id z9-v6so2382770plk.11 for ; Sun, 27 May 2018 07:13:34 -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=r57v6jrRbtE42Q+OBojj/J0UuniCJHknBOwTp86sJ0c=; b=D5LGFh8Xd3c8wgUH2BaBP6k+izyZAYxRbwAR7Hw6NtjmroqXXU+/8zwyx9997UEY8h SnNN8i1F8MqkhjUC7v4OzuHJjyDTAjnS79HuKGN93qNVr1/d9BKtOASFjO5TjdA12PAy snAw1cowt8bh4iKqGHyUpIPdmMbc1cOK2ORVE= 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=r57v6jrRbtE42Q+OBojj/J0UuniCJHknBOwTp86sJ0c=; b=stydjCUVkbnYQRfZXFFQrBzx3S9r9zB6ZHNiU4qzBHxoYSATtbsIFSpmJutWD4hyeO tFp4gJAu6aGWvBVzirHDQBPmDi68YNuUys/DmrjZ70w319j2EU0M1MShqHaBTsfMCaFh ZtccXv7qa8Xbki9Q4vtWWgCn7rZ7bZSaVpji4TCb4aQHLpK3P+fiB0c0xZaeGvQvYOK7 kl9nWHkgBFF3ZEGe+VZqYIU7Suu+GZMX3WYinrLCbFZl0qrtorrw3eIOjYlZ7xLkfEiW yyC9PdJicGnX33keAV/T9igplaXjEFbi7I/ueVJ1mIhi5/xlJ+t8AbccZ4OWgz4HEYbK RZoQ== X-Gm-Message-State: ALKqPwfBn2m9Sx4lFe89k5lJCmwEwfMOM8DvbG/TdIyL2DI2yL8MB/JW HRAGujn8oih9/DQI/uVQTFR0didAE8A= X-Received: by 2002:a17:902:bccc:: with SMTP id o12-v6mr10106139pls.56.1527430412816; Sun, 27 May 2018 07:13:32 -0700 (PDT) Received: from cloudburst.twiddle.net (50-233-235-3-static.hfc.comcastbusiness.net. [50.233.235.3]) by smtp.gmail.com with ESMTPSA id b89-v6sm66680075pfd.85.2018.05.27.07.13.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 May 2018 07:13:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 27 May 2018 09:13:07 -0500 Message-Id: <20180527141324.11937-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180527141324.11937-1-richard.henderson@linaro.org> References: <20180527141324.11937-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::22c Subject: [Qemu-devel] [PATCH 03/20] 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: Stafford Horne 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. Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) -- 2.17.0 Reviewed-by: Stafford Horne diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index dae673afa4..e566be6d3c 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(0); - break; - default: - g_assert_not_reached(); } + break; + default: + g_assert_not_reached(); } }