From patchwork Sun May 27 14:13:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 137013 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1786321lji; Sun, 27 May 2018 07:17:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI04+4HWl58KHq27G3WgLrQH/CFwLvzqrM53hLg8FBr91QKT8+LEidAWt1yaLJ5rDs+IsXu X-Received: by 2002:a0c:b503:: with SMTP id d3-v6mr9103057qve.107.1527430651127; Sun, 27 May 2018 07:17:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527430651; cv=none; d=google.com; s=arc-20160816; b=VQQnxKY3B+fBJubUNRg5oQaqPPw575JbGs2bifKp+WBgfHA/RpkI4ntt+WKE3fGSSH UloCxhWg4gXEsZMUC4QV35r4WbSIrpAOuYLSyheWgknlLNVLtknyNczCcVo12K9o1P0Z 01mYJer90zgfVTRxoG3flZfML/97idBVZm1FW0aFu3xnsUiBsK0yqoq/JIG+fucvoBqW y3UChNKyIBVSfthMgFY0BtGVq/wGwIUKNgTLTaTzaUjniwLy7o5v/ul87WNM1UtWeby0 O0M7rTq7dn0VXNsWX8pbYvJeOZk/zYni/7Fw7TGgM38RCl33RfFhVI5HDEhNZWvzK+ei Dd5w== 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=7xiVnQhbVRorvuZfqDUYYp2ZTVo4pufmMXCHOnvHU4w=; b=ofe3dH32nF/+YeBthbbHbeFRv/JPGOCGn/kMjPAzZNEH6Y2w6dfNqjXqVRipc+/VAd oE9ZCEu8kIVeUMimnYV29vGZWEYcXyGGF9446ilKagE5oGCPq5OSze/fExwAPZse3aWs XE9MJoqBckhp6sAQhYJ7kXf0+tz8vMJwb5iuUO8Ktx2KdqBbLbQHcOCnUCxvLYeFSc0u Piw54Zhh2KM1ypOMR/Fd8KtkNzKW9upkX8IdVDP63D5UDExXCrgBEhhIfDWlunXUHbMH luKR6CTE5nncQda8K1lM5QuowNTJSoaz9rGZmRU81Qmc2ObJorbWo2+znPR8Z01274c0 D18Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cdIBGUJX; 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 f12-v6si23594755qtk.50.2018.05.27.07.17.30 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 27 May 2018 07:17:31 -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=cdIBGUJX; 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]:52214 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fMwUE-0002at-Gk for patch@linaro.org; Sun, 27 May 2018 10:17:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57727) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fMwQV-0008Rv-KJ for qemu-devel@nongnu.org; Sun, 27 May 2018 10:13:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fMwQU-0004OD-RG for qemu-devel@nongnu.org; Sun, 27 May 2018 10:13:39 -0400 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:37546) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fMwQU-0004O4-Lq for qemu-devel@nongnu.org; Sun, 27 May 2018 10:13:38 -0400 Received: by mail-pg0-x242.google.com with SMTP id a13-v6so4191439pgu.4 for ; Sun, 27 May 2018 07:13:38 -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=7xiVnQhbVRorvuZfqDUYYp2ZTVo4pufmMXCHOnvHU4w=; b=cdIBGUJXrHEmXEiYmRQtN/reESx4Tefe6uguDwak8E9xnXNOdrHWCyvJXJnYJQFFvL MEeLYGrxE2zpapZKcmsbtKx9YFNdRenuT8jHc4rtqVY8pZyGKz+SeMn5Lh617VQQ/5S+ EUQfKEGg/9UUe5uKVmkPypiCgSobIpUHel+n4= 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=7xiVnQhbVRorvuZfqDUYYp2ZTVo4pufmMXCHOnvHU4w=; b=RaPN3uQuSZA5U0qRfi2Fn/dWhdTxGbnmnQ/lIdAtJ5hxTtaNvpIc6tvleyATal/p8A gN5fAgqkhZbWDMB/VezZXvwspSax2NSp+iZHkQoCHBNBhLbwVoc3BKUvTGiH8ZUDuhL/ Uc47x2nAhTeC71ZQUFMapedhtt0wXe0HNGGchkoiGyIHLeuz5NJqT7EvZjx7wwzzIayv SAEnS5y4iKzPknIkQO1eh9x6UY4QoXpp3Rh8XISbL8aEhp/SqUVL70PfcXOW64gi1lne oudRDkVIP5hTVXxvILvc3cQkNiRzJXNI5a1VgVOPQ7d2JL5teIXxNBqddlo6azJwvVEy 0v7Q== X-Gm-Message-State: ALKqPwdy27/p1xw//f1oOno53Sae3hF3nfy+Z3C6OPETPvMFiUps/KWg JqQPGrbYoNbiAT/hBht5bkNAqMOup/0= X-Received: by 2002:a63:7247:: with SMTP id c7-v6mr7791917pgn.68.1527430417331; Sun, 27 May 2018 07:13:37 -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.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 May 2018 07:13:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 27 May 2018 09:13:10 -0500 Message-Id: <20180527141324.11937-7-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:c05::242 Subject: [Qemu-devel] [PATCH 06/20] target/openrisc: Exit the TB after l.mtspr 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" A store to SR changes interrupt state, which should return to the main loop to recognize that state. Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) -- 2.17.0 Reviewed-by: Stafford Horne diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 61e6deef69..c7bfb395b0 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -940,9 +940,31 @@ static bool trans_l_mtspr(DisasContext *dc, arg_l_mtspr *a, uint32_t insn) if (is_user(dc)) { gen_illegal_exception(dc); } else { - TCGv_i32 ti = tcg_const_i32(a->k); + TCGv_i32 ti; + + /* For SR, we will need to exit the TB to recognize the new + * exception state. For NPC, in theory this counts as a branch + * (although the SPR only exists for use by an ICE). Save all + * of the cpu state first, allowing it to be overwritten. + */ + if (dc->tb_flags & TB_FLAGS_DFLAG) { + tcg_gen_movi_i32(cpu_dflag, 0); + } + tcg_gen_movi_tl(cpu_ppc, dc->base.pc_next); + tcg_gen_movi_tl(cpu_pc, dc->base.pc_next + 4); + + ti = tcg_const_i32(a->k); gen_helper_mtspr(cpu_env, cpu_R[a->a], cpu_R[a->b], ti); tcg_temp_free_i32(ti); + + /* For PPC, we want the value that was just written and not + the generic update that we'd get from DISAS_EXIT. */ + if (unlikely(dc->base.singlestep_enabled)) { + gen_exception(dc, EXCP_DEBUG); + } else { + tcg_gen_exit_tb(0); + } + dc->base.is_jmp = DISAS_NORETURN; } return true; }