From patchwork Thu Mar 10 11:26:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 550094 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp908570mag; Thu, 10 Mar 2022 03:41:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyonQKXFwBy58Yxd346NeHJ2UOXVCLNox5jCH/SrGAzOc6mrORs75WHrwSNIuMU81EqROQ X-Received: by 2002:a81:1043:0:b0:2dc:289f:9533 with SMTP id 64-20020a811043000000b002dc289f9533mr3399883ywq.467.1646912519526; Thu, 10 Mar 2022 03:41:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646912519; cv=none; d=google.com; s=arc-20160816; b=nNi4Km36kxhdB4MZ6cTu53yjcvvfJ7+L37oFmDDL5gWjVvFJ0aThLVF6lcdPIqGS3T wfoIAqVlwUVRJMbv7Bp7Agm+kHeftfZivq9P2Ue6QWABJuTASmuLyBbNGDucghsxeX6U p7fl5HK354Czt0Ejfg3LEo4/SWLt4w1KkRNNh1Tn/8RtU9Bcb5037/wOD05q730w8TxO 4iVf7gKjvnPX/OS4VFE0gmkpV7yDoDGR4jJKBdV8PaBavwMyJqVAhr2OGK8a6Wga7KtB yS7prlDo1Vhul5UrhJ0CU6nmmN2J8seVhJsAbYwxfVqz7D69QsejC4cWKVrbHEOL+lc8 WBYA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=NA9HskFqPeLh+02a0cXnYrdAXovGtw+F2Po8AxVhC7E=; b=SwqyFH4ZugeOC6QDmPTJGdGxuor4xzJ3ufOILP/nr9NkDodMnCiG8+cAFQO9LkbCvR jbJPEFsE0KEWLJ3BFifhxW+x+VJJ/3USyXBkfzx4UGfV9ZLLevjmIopItmwJvFmn4LWe Vu6cw24kKTMwlA7E059R/g72GyGT+o7Uo8AFMCr1KQbqeC1hz+q46zoDdQVMl806z1Qw 8R8ndOB1uA9++V02EaqkKslFZsy1e7c4OYTjyZEcl159ULgwVOLilP+uxS/5CztLMGx8 4NUgosxFR8X5sBQVu2PPQsMosScMB+HDJ70TAOicewFSZDlh2CYxxgp0brn6Vc+88fS5 F51Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DZUuX833; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id c125-20020a251c83000000b00623df2e9dd0si2759369ybc.227.2022.03.10.03.41.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Mar 2022 03:41:59 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DZUuX833; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:54132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nSHB9-0005KH-1s for patch@linaro.org; Thu, 10 Mar 2022 06:41:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nSGx9-0004nP-Bd for qemu-devel@nongnu.org; Thu, 10 Mar 2022 06:27:31 -0500 Received: from [2607:f8b0:4864:20::102b] (port=35644 helo=mail-pj1-x102b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nSGx7-0007tn-Ln for qemu-devel@nongnu.org; Thu, 10 Mar 2022 06:27:30 -0500 Received: by mail-pj1-x102b.google.com with SMTP id mg21-20020a17090b371500b001bef9e4657cso8014949pjb.0 for ; Thu, 10 Mar 2022 03:27:29 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=NA9HskFqPeLh+02a0cXnYrdAXovGtw+F2Po8AxVhC7E=; b=DZUuX833jwyKf25fc16ZvWHBarUREFZrcPPZWxVd51RcBpv1SsMiqwtmWAM+VSSW6v ++FmquQQX8uKo/f33hbwCyCbF3YFC6Tsc2BQkxyV8ePOkV8yBNtNKWgGqoBzE6nd+aYi +MOqvYZGukQgsJgYD2+Hj6Df9M8AxZgFuiHONNkOt2gZoaVACXatJae755t841LnA6rl JdUqhGaTP8uaCjxViT6DHR1VVrx82CgRWATozFDVT7xqjJbHC5Huel7RVTfsUzgTc77Y VS3DqzvOvbJv1wwiZZKnJ/IMUj12T5EWMYn6t+SyvjS9oaMttM8tA/sLBME8QIupqsTn szxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NA9HskFqPeLh+02a0cXnYrdAXovGtw+F2Po8AxVhC7E=; b=aYeAlP2byz3lWpueidM1j2FQPW8iRA8Km+VuM1g9/Zb43X4I56pZNpAynpMOcwtkdL AdltOXAkHSDweNm/wERuClh//uh00DgWtGNZhdRLUgVrj+yXDYAUT70UP1yfxsVIGfX+ VJqFwcEKxc1OXuq+A/nteSV5f8hJRPrVjkKNj+wjezjU8DXK3+yglEdSRxXiiD7ySvv6 zMM5T8ISImQf4lYsojhS4hbmwjLyu4XnkYvDTgOqzh41EEWdEngWSjxx0A+29S+SL2oY FX0RUUnrgY/8DGnUWQOeGJOdEeZf/cUvmPnYksmrd9UO5S59VxGKlvzPJLOg1Zwxeant jycA== X-Gm-Message-State: AOAM531znU9OEmqVRX5oqWXRtIIjRRX+PnmQl1dY8SFjUX/uJkCyckyk /Y8h7hc0YPWYc8RuslvhlIqI6dW1Wq0vog== X-Received: by 2002:a17:902:8491:b0:14e:dad4:5ce5 with SMTP id c17-20020a170902849100b0014edad45ce5mr4505167plo.76.1646911648371; Thu, 10 Mar 2022 03:27:28 -0800 (PST) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id js15-20020a17090b148f00b001bfc8614b93sm3114977pjb.1.2022.03.10.03.27.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Mar 2022 03:27:27 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 01/48] target/nios2: Check supervisor on eret Date: Thu, 10 Mar 2022 03:26:38 -0800 Message-Id: <20220310112725.570053-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220310112725.570053-1-richard.henderson@linaro.org> References: <20220310112725.570053-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::102b (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, peter.maydell@linaro.org, amir.gonnen@neuroblade.ai Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Amir Gonnen eret instruction is only allowed in supervisor mode. Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson Signed-off-by: Amir Gonnen Message-Id: <20220303153906.2024748-2-amir.gonnen@neuroblade.ai> Signed-off-by: Richard Henderson --- target/nios2/translate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/nios2/translate.c b/target/nios2/translate.c index f89271dbed..341f3a8273 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -384,6 +384,8 @@ static const Nios2Instruction i_type_instructions[] = { */ static void eret(DisasContext *dc, uint32_t code, uint32_t flags) { + gen_check_supervisor(dc); + tcg_gen_mov_tl(cpu_R[CR_STATUS], cpu_R[CR_ESTATUS]); tcg_gen_mov_tl(cpu_R[R_PC], cpu_R[R_EA]);