From patchwork Mon Jul 2 15:10:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 10501817 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7A4CE6028F for ; Mon, 2 Jul 2018 15:15:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69F0B28711 for ; Mon, 2 Jul 2018 15:15:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E17C28727; Mon, 2 Jul 2018 15:15:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0B10C28711 for ; Mon, 2 Jul 2018 15:15:08 +0000 (UTC) Received: from localhost ([::1]:33461 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa0Xj-0007ZN-7i for patchwork-qemu-devel@patchwork.kernel.org; Mon, 02 Jul 2018 11:15:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa0Tr-00047K-7P for qemu-devel@nongnu.org; Mon, 02 Jul 2018 11:11:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fa0Tm-0007tH-AD for qemu-devel@nongnu.org; Mon, 02 Jul 2018 11:11:07 -0400 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:41670) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fa0Tm-0007sn-4E for qemu-devel@nongnu.org; Mon, 02 Jul 2018 11:11:02 -0400 Received: by mail-pl0-x242.google.com with SMTP id w8-v6so8106837ply.8 for ; Mon, 02 Jul 2018 08:11:02 -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=XbaEK4q2kgaq6Gz7+BgDFAZVMMcpSYUy9/kbsO3LcTrg4zn5jhhQjDSd5AuoCaHOGU E5ka4P14F6wfOYbkwsOY6p/yN1C8lMv0uAaYO0x5z1txFspCfkue0OGAfSh8xCDzNcqs 1gX+tlCINNVk2o0kGeYvxoLUKznwwVEoPakAdwX85fqt8C//C1VAR9r7OTQw1N2pUOp7 Dt1L4Z9MBlqxv/w5/kJvVnZ0rC3NLcWDFRBywB5Vu+0I/VrQ16HZYwaFvmsygswwoIQO jzs7oQfzMFEdpQ1conw4IXsxrVtOfugL4ZKsZIfTLjy+xEhUSaQzcBJzI0lJzksovp6C mvvQ== 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=icsTvLAJSQK7iT22RePq6WeCzpbjaqTDa/EgXg7qVeb+M6CkZwsVN+6P+dJFm1kaIr G2RtqhE59LAhHhzX0laqVomgQYG8jVvs0ooEAG92ZvFg9+Xm3CQZhq7lDcUQxEBGlnJO esJ4VPSPFMej1PzoRWqswWJcbzzbwEdKPwD0CxEbmpVQpT0CHu9qX/OyaKxAhrdxUA7l J9sMPvXPgFAdDeRwwKr6/n6yNCZbqlGFVoM+va1Kf6JC8o8UdEx67YBbDtSFUA3Mg27p WKO4Oms8vhpoPFnwCe1bumyp09JDppSmSx7iep7vEnKcKo2zV4Uiizjs1Z2t+dEjXc1B VjRw== X-Gm-Message-State: APt69E3QPecjUmvg4T8l4OLAfVdyDGrLgkYSq/QPTiUiNt5sCTlYFGuQ MEWb1naatUch8/HRACgKN3k= X-Google-Smtp-Source: ADUXVKJZRh2rg5mhp/3Q8ejSErwTELhEr74Zz9AMn4pVU3haj2fY+F+QEE7UuK8BE76mBdd/aocj/Q== X-Received: by 2002:a17:902:9a06:: with SMTP id v6-v6mr26211447plp.21.1530544261296; Mon, 02 Jul 2018 08:11:01 -0700 (PDT) Received: from localhost (g90.124-44-6.ppp.wakwak.ne.jp. [124.44.6.90]) by smtp.gmail.com with ESMTPSA id w10-v6sm4658053pfg.187.2018.07.02.08.11.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Jul 2018 08:11:00 -0700 (PDT) From: Stafford Horne To: Peter Maydell Date: Tue, 3 Jul 2018 00:10:07 +0900 Message-Id: <20180702151023.24532-10-shorne@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180702151023.24532-1-shorne@gmail.com> References: <20180702151023.24532-1-shorne@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::242 Subject: [Qemu-devel] [PULL v2 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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); }