From patchwork Mon Jul 2 13:57:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 140766 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4537ljj; Mon, 2 Jul 2018 07:13:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfiCMjqh7xY+C80eEhHwlhJil9hcysnWqzTEYDqgTlMBrIF+3ILtDecOEgTDWkCQaEepm9r X-Received: by 2002:ac8:6c3:: with SMTP id j3-v6mr23368242qth.138.1530540826420; Mon, 02 Jul 2018 07:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530540826; cv=none; d=google.com; s=arc-20160816; b=c2osy7hTBm/+diFlSf9UzfFrD2NNK9lsKEqQ+2EBf482SppNxaz7hM4yHSMDiGvSEZ M10O/T1n+MpU9O0Ao2NdHVneMCABF7BaI68kOJxkdHTuZ3SKw3IHCuNimJZLvcIDE9lC M6mafpL9aKYWcFegCkr9BPhp0AiZUDGs8/bDsbwv9kQi1N/MpxLuzJVkyXtbpt9xVg+O NyrsAynmVICl43Dws+g6RJrWFrdCUzTh4jfN1mtl3XPmc72fMaL/G7FGZsxDd0BebkbK aNA1YnueLVPefrC2Zlr4qmqojTDNGkBuMWy4lXq+hKQXK/hzy6qczaK2UB7rADuNtVJO k9Vg== 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=/JZVefHUUHKkgVlCuUjnyf/d1zk468BKGk0xxZUY1uE=; b=PXsCv2Bqyy1Ho0Vz0oYHNWp54JI/rhtEjDeGWOdGMmmYWc80+7Oa6aJoD6+JIz0jOX O1dSw11WTITRfFQJzWfCNAbAQqQLvJriTbrQ1zMy8I6A937IzfDfM4B+rjTpa+5XbQS2 4vDh0dzKrGAZcEH5ZbVNcR6eQYX7arwjjy9hZtt1/gccCxWNPBfSh0yKtvgp5mD5eVGB IBAth+So3LVGi1L9BcvWpo6UlhjviLu7Ox3Ul/VQwHkjfIQdNOSIp/aDeQoRQSjzRGUj deTli8V2cTldmfXVTK90/l1ak3sG0JZU8MHaUwqDAs/whSpTOJTuyhC0UyV203CJfPUH 3Hfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=t7na73Na; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o19-v6si2209759qki.245.2018.07.02.07.13.46 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 02 Jul 2018 07:13:46 -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=@gmail.com header.s=20161025 header.b=t7na73Na; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from localhost ([::1]:33023 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZzaL-0004v4-QC for patch@linaro.org; Mon, 02 Jul 2018 10:13:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZzLg-0002NE-Vx for qemu-devel@nongnu.org; Mon, 02 Jul 2018 09:58:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fZzLg-00086v-Ag for qemu-devel@nongnu.org; Mon, 02 Jul 2018 09:58:37 -0400 Received: from mail-pf0-x22e.google.com ([2607:f8b0:400e:c00::22e]:34347) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fZzLg-00086f-3S for qemu-devel@nongnu.org; Mon, 02 Jul 2018 09:58:36 -0400 Received: by mail-pf0-x22e.google.com with SMTP id e10-v6so996073pfn.1 for ; Mon, 02 Jul 2018 06:58:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/JZVefHUUHKkgVlCuUjnyf/d1zk468BKGk0xxZUY1uE=; b=t7na73NalEgvTAmOZIR8OM1NoiK//4+Gs8BB4Wtddj3UNB42cVBHdG9DmnG0PxjOWZ 6kIeM/YprerFRsPdCRBXeArQydgW1m+bTLHt0zn3G7Jmow4AUMMTZMNOOQkS41U0X5/I 1rU93gp7bjDm2jp2Fa8LNNwxH+TRGlC3hp3LQergYD9o1G9QCZFyrHzZ6q8OBZJI3Lsf P6znlwOaWE1S4MW3Q2t1p1gvGpmpJ3Iyu69TtEUVL+clBoo59+cq1dQCTKmtufZ/QUTh N/Zzmfkzbzgsah/63GEsa6zcPX8Sg3pRvEhr905QkxXAYEH1xn9N/Rnv7ungfZDwu0hT sf+A== 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=/JZVefHUUHKkgVlCuUjnyf/d1zk468BKGk0xxZUY1uE=; b=bxx1FNhmLW54Go/PNgjL1xNVIpKon3uSqynEhvEiPJuxXApF68Dq/c1l9qsKNo4bod 9Tj3aPV6/4Vo7QOZVe+xROMzDzkyScxX40jXRRcooywsrUK3RvQOh8n1S4Y6BdSNLVdO i7SRY+fIQIu53VkTNqHNmseKF0dwg56mh5rqwXL4M+VabZcQckqjwVP0yTDQB0LOATpW PdScaAml/bIHcU+JKHX8dJXrgO2zap4kAXIPTY+NqI3XHsKd3qhU/Mtsc3BVnBa/nHxD c+OTZa0quyIG48N2rmnq158uH3IAfGz3NCf3VXnqWgd0BeS5mSri3P+OsCxopFPpjJc4 FjBQ== X-Gm-Message-State: APt69E0UVCTzvLO6us0QbQdwlPJ8iFVPDJZ3iG4bCWvB3YBfTUSOeG+O sGpCwWNtdm21YiT5sgYuB4F7QRMc X-Received: by 2002:a65:4a90:: with SMTP id b16-v6mr21595587pgu.136.1530539915080; Mon, 02 Jul 2018 06:58:35 -0700 (PDT) Received: from localhost (g90.124-44-6.ppp.wakwak.ne.jp. [124.44.6.90]) by smtp.gmail.com with ESMTPSA id 9-v6sm28381993pfn.129.2018.07.02.06.58.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Jul 2018 06:58:34 -0700 (PDT) From: Stafford Horne To: Peter Maydell Date: Mon, 2 Jul 2018 22:57:50 +0900 Message-Id: <20180702135806.7087-10-shorne@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180702135806.7087-1-shorne@gmail.com> References: <20180702135806.7087-1-shorne@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::22e Subject: [Qemu-devel] [PULL 09/25] 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 , Richard Henderson , QEMU Development Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson A store to SR changes interrupt state, which should return to the main loop to recognize that state. Signed-off-by: Richard Henderson Signed-off-by: Stafford Horne --- target/openrisc/translate.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) -- 2.17.0 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index db149986af..59605aacca 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -877,7 +877,22 @@ 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->delayed_branch) { + tcg_gen_mov_tl(cpu_pc, jmp_pc); + tcg_gen_discard_tl(jmp_pc); + } else { + tcg_gen_movi_tl(cpu_pc, dc->base.pc_next + 4); + } + dc->base.is_jmp = DISAS_EXIT; + + 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); }