From patchwork Thu Mar 17 05:04:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 552208 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp874914mag; Wed, 16 Mar 2022 22:11:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNbTTr2Oi/jl8UrvfyoqhClrQIXokHh32GEi2VcEcx7B2IdfdVdI3vVTZrK2rXpjAJyYSg X-Received: by 2002:a05:6214:2487:b0:435:92e5:7f with SMTP id gi7-20020a056214248700b0043592e5007fmr2298364qvb.76.1647493910720; Wed, 16 Mar 2022 22:11:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647493910; cv=none; d=google.com; s=arc-20160816; b=o+IKrs0UqHPWEYnT7shXu8v1Pfj/0eHqQ7jsxwNTGcjAnrqtsemRKY7eLlI96xfJYb +Wysb98z1oGUPXeFYZt//1GheiwsENlwIZqWUebcdQWubJvno6N0hgdTL2rBMEJ1HwNg oHI+XgkiBR/HppfwliMamXcUOjlJhYNzRzbZHkZoLmUnvcP7t4GLsz8VA56C5vwl48UN myimkY82BBdAKsJjWvxiia55zeVs8igUKVQj+PU7LWuB2li2WgXTsM27WcGetNKsn7wI N6ytfEE9qjjbSncDSryoKH10+rruUoJ8tpdI8W3/j/kxfEYJ+JBWUN3MlOH4PE+nzWm4 ALFw== 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=YEVH85OA5FmUCX7rzNZqzXfEhDZG9zAq4/fgUJ4zuPJzA1qTFIiEs1L1nfMhkXPc2S 6pmB998Slp8YFXBmeOMvgx7EcARSSOnX9YgEecR81CZowB3QDkVvv3o/38SzH/go/h5v qkTv7Weop7sWnvsSreZtc3pld2ynQ4mtLg15XV6v6tEjCdHyaMUEIcHScoD5Hs7Lt1SG k3MGbX3ZdUaBesKwzUDpvj15HK6HTfisni1cy7jwF2WL2SHFsxLr4IyDpxmtZTg0ZSPo ax6NpROt1Bbr822qfL98IyxeForiK7b7LR51GPJGc3/2/d0u0plDUgCYHe2qoIbKMwHV +Wxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jQKBj7M1; 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 bp9-20020a05620a458900b0067d6441cd72si1066828qkb.18.2022.03.16.22.11.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Mar 2022 22:11:50 -0700 (PDT) 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=jQKBj7M1; 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]:51546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nUiQP-0006LG-Ut for patch@linaro.org; Thu, 17 Mar 2022 01:11:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUiKX-0000JE-5I for qemu-devel@nongnu.org; Thu, 17 Mar 2022 01:05:45 -0400 Received: from [2607:f8b0:4864:20::1036] (port=53762 helo=mail-pj1-x1036.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nUiKV-0002C1-L5 for qemu-devel@nongnu.org; Thu, 17 Mar 2022 01:05:44 -0400 Received: by mail-pj1-x1036.google.com with SMTP id bx5so3937073pjb.3 for ; Wed, 16 Mar 2022 22:05:43 -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 :mime-version:content-transfer-encoding; bh=NA9HskFqPeLh+02a0cXnYrdAXovGtw+F2Po8AxVhC7E=; b=jQKBj7M1B5PT4TVdwx8qOBj0rMYajDxageJyB2R9YfLuFnkRheYOnbvI9fDQlJcWaI G8TvYeQkMiBw7NUTm+wQZ7vacbDTYRHCgADZi5kToyLWzDMpOh8oI5vMZjXAjZpLcM3Q wR7G736RgNXcFbNStfEdsqZIhL472cnI4DM6tkk6Ta80XhRLiuYyQkoYcmCvlQ2yNxB3 SIVz4RMwaJWE3lF5ja6DKZG7N8ziQ9/NIeOUcrtBZk1ILZzNIGUxi7GwvyY0SHhLrilw v1qKQ2iJ7MLcLvQfRbBZEOOzj8IIk/CqCU3Nm3pFAflj9C1MZjYg19myuUQJ6f6NQ2J+ f5hA== 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=4iJsbRTrB8yFQr82DvUDNYOMjisuAIk1VfWv7iY4VWbF7amXsRUXiaFJD+3aErRJd8 elhfaqhrFfn24er+oFuRmdWtxRxsLZjFiYBhGQeDqWkpq35hyslHjtBAMi8cyi99Kt/S MLAt2xsjFNuCbYFYoay1cJT5W6AVjPC3Aw/z8uACK3aYWRt3RpT/K+JhbrZ8x6Zw7y8t Nhu315TpUSyecC7uu05n0QEbMlWiwHDiASLOj/2Ye69dNiLYsN97StWrb9LBYOcsCl+t ThN4knbH95ug3x5jhABMSHbH3+EnHEkZYs8BJJkDk9FSK5QNx/OGy5EJKKSXYfacLrRV 5PqA== X-Gm-Message-State: AOAM531Sm+uZSpSrCPy1OV+q3HFUvF8MlQS+LmMnbz2CDwS9KJbzhtnT uSzS99F78Q/WmLh2yoXRCX4ZcK8XK+MQvg== X-Received: by 2002:a17:90a:1f88:b0:1c6:7cf9:8a23 with SMTP id x8-20020a17090a1f8800b001c67cf98a23mr2171350pja.21.1647493542179; Wed, 16 Mar 2022 22:05:42 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id h22-20020a056a001a5600b004f7c17b291asm5101357pfv.87.2022.03.16.22.05.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 22:05:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH for-7.1 v6 02/51] target/nios2: Check supervisor on eret Date: Wed, 16 Mar 2022 22:04:49 -0700 Message-Id: <20220317050538.924111-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220317050538.924111-1-richard.henderson@linaro.org> References: <20220317050538.924111-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1036 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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 , 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]);