From patchwork Mon Jun 18 18:40:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 139054 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4287066lji; Mon, 18 Jun 2018 11:50:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLp1qUqrD1L8AVGyGmplmW0WB7dLsd+m0rfWr8ogFMIpR3F6lh9nj/fLUS47ffxdPsEGU2s X-Received: by 2002:ac8:720f:: with SMTP id a15-v6mr11725990qtp.243.1529347827499; Mon, 18 Jun 2018 11:50:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529347827; cv=none; d=google.com; s=arc-20160816; b=gUPXrdpHQC4bBssF6CbahSIqUpOgyLaf7jHxdndJX6UMFEDahkEsvlRkTZksAaYwTw Oc30NrXrtWcmPPDkjFCVzJUgbk4GIayqKsgjiYeQxqVazAsMMxGqvVHutZGpe4cBFihZ FAbugMybaGHUcD8/FvlYCH6jJ3BnUvTwJNYgdBhJGwSa3bC+wQtO/jXcF3PHJBN+qfS1 wI1tPZare67aeOGG3yv8fc2EeaSKxdAfT9JSBaGF3DGsngZtH+wHmTDkdAB84MJi9HkD rKOPHe66EqNidO+UlVkKuuaV4olpTbRLCGQs+BTHi4CjBFJy3FJaZmiEDQswRlrYIUBA RjTg== 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=XOIEmxBFkBr/QGsQcVjBP400/Ed4lIS4eM3GEO+xQ9w=; b=w4MAVFXBYY5DA93oVJaU3K4uufDdPV6XtYcci8MP+wYQxL7cUZpwKl9SzUSY8tCnEd yXsSTuk5+apas2su2HaOg7NSFyb6UsCYiVbM6pkvmpWRKRzFOytah/0lmuVS2CQ/QS7F wyL0ruv45D8QIZpIQjNVA9s6DORn3+9nxSHTxImoRzN2rCpEUMHQDKhsvFM7Gy9F+TS/ 070HHAF9Pi1nFU/sKQkk92qigMK2SmjM6L+Py9SGQu+Blv9Ta2oZw1N9hRqytsou+rID HfJE5ANoQKqu1dMdEm1nZBR/S6jSPv0lvan7DmmryNddZdFB574dI77cc9bOyEoSBK8+ n5fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YJy9l0hK; 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 h18-v6si5275208qtb.333.2018.06.18.11.50.27 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Jun 2018 11:50:27 -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=YJy9l0hK; 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]:36511 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUzEQ-0002h5-Vy for patch@linaro.org; Mon, 18 Jun 2018 14:50:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57318) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUz5N-0003OV-MQ for qemu-devel@nongnu.org; Mon, 18 Jun 2018 14:41:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fUz5L-0004dq-6F for qemu-devel@nongnu.org; Mon, 18 Jun 2018 14:41:05 -0400 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]:41991) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fUz5L-0004cu-0P for qemu-devel@nongnu.org; Mon, 18 Jun 2018 14:41:03 -0400 Received: by mail-pl0-x241.google.com with SMTP id w17-v6so9497071pll.9 for ; Mon, 18 Jun 2018 11:41:02 -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=XOIEmxBFkBr/QGsQcVjBP400/Ed4lIS4eM3GEO+xQ9w=; b=YJy9l0hKHiGpDZ54l5pE+6G+7pfdbioGeTzHeDVJrONg7J5oFKfTZT9in+1vz9Hoxl 5O5HRWHznKTpXO4UmfFBc2o340PW9M4AWFEVgKYq0EjTqng+WI87LLWWxd4AvI69jS4c EQr5TWvgzohSfVv1PqQmrI6ehdCoVmVuddtqY= 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=XOIEmxBFkBr/QGsQcVjBP400/Ed4lIS4eM3GEO+xQ9w=; b=qjG+BQBRw1UdRc2w3Przi1s9mElXoVlELCsKBVJdT0Z0pgzyJaEjbP4di6h89ZJ62E TIeOwmvA5fSP+APwr+dqhG7B63XxfYWzbRvQbyY11rrfZakyfImbQ+XPIhtlSJosbxQW siDADw+6+q8wFcd0xn6rrXWABPO5aH4YV0UYFImWy1Fp+mh4pCUgeyBon1PKaY2CuCkr oHlsJTPc+oYvwY9QJUL2m4giUErCMBwMYp2Otdz349scX6HYm8XNyxqbuVpQbmm9l7gN 2M2q+7OPagUcmc+aM0/ehuP7slxF/BzoLURLq1F6cDKaUoYmnO3hs9U1tLmJgara40eT CJnw== X-Gm-Message-State: APt69E1MViMhoTOTQcsTCO2fARybRMlRdQT5YiQw6HpM8DDpMd9Qky78 8PO2dA+vHFO2bRmX+ijUboC6rnuyNPM= X-Received: by 2002:a17:902:3c5:: with SMTP id d63-v6mr15637963pld.163.1529347261623; Mon, 18 Jun 2018 11:41:01 -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.41.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 11:41:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 08:40:30 -1000 Message-Id: <20180618184046.6270-7-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:c01::241 Subject: [Qemu-devel] [PATCH v2 06/22] 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: shorne@gmail.com 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. Reviewed-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 16e69c75fa..6a7eb4a3e8 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(NULL, 0); + } + dc->base.is_jmp = DISAS_NORETURN; } return true; }