From patchwork Fri Apr 22 16:51:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 564854 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp668672map; Fri, 22 Apr 2022 10:09:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzj5OxR1pak2saZ35dPRDfXs9Is1f6M3BXpDwqdRMYv0GOtfTiFE3Yn/dOfNElo2nWGoW1s X-Received: by 2002:a05:620a:15ec:b0:69e:98c6:aed5 with SMTP id p12-20020a05620a15ec00b0069e98c6aed5mr3395457qkm.120.1650647392808; Fri, 22 Apr 2022 10:09:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650647392; cv=none; d=google.com; s=arc-20160816; b=AbQeP9JbbeA/+4k8NfVvtKytn0rwLifiiVXDz/jd8pDsM2OIjsNa2O6UZm/vMQ6rcu KMUc53RxpRmKDWvyB5fv6PBwXrmpsAQEDxvbm3JXh1h2mRwaNKCsbO5cc55FwpluOjvJ rngmTFULOC4l6IQ0C2R9fg0h3V586KRMvS8t+7pXWeF/G0gRK/yrmbgMpOKrSLVsmX90 vbi+jj5yUdxKYrlyHmShx86H80kFtIrGTLT0R1cDgLxmArX0frNymj5wOF2xrZLrS3pZ ELUigH2fJJkm5XlZVpS3G4ylZVYpxqeMLshzeVQASVK1wjGsyJza93Pj82Kr9Sx94xZP nohQ== 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=6UYSlRGZfhDryiA9u1wA9vZSGmpcy5aRg3TaG0SXLQ4=; b=y0nm57is3EwbJM+2TE0cQNUILUgDXiVwgCHInFT8KzyUt1MIo09eQoiSPgZAK+rrOg hENLG1EnWoLNZC54CFQhoBKWVItZGaQ/bD/dCjazMIx6tub2Jzua+hkpnnXXTYaeFjX4 ia6ZWwjgQ1SsEKVlBJKJbW8FduRWLREMj/LlTY6z72gWGRHOwqoWa12JThVQrBOyfKfq UXZmkOIAGBqFNiS2hslzk718LKEvrgZG9TvPEf0PCPhLoYp9QABwuJELUXBhW6qcQwFq Iysg5ybYLBGS+I32+sfYfB8GcuSjrgXQvzOVXXJeWZVfUQqAa5NUY5Yg8GxhGHhRSNXg FjIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PZfOO4AM; 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 t11-20020a05622a148b00b002f205a5109esi2506994qtx.243.2022.04.22.10.09.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 10:09:52 -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=PZfOO4AM; 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]:59098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhwn2-0003A7-DD for patch@linaro.org; Fri, 22 Apr 2022 13:09:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhwWr-0000sl-EU for qemu-devel@nongnu.org; Fri, 22 Apr 2022 12:53:09 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]:43699) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhwWq-0007Ft-0y for qemu-devel@nongnu.org; Fri, 22 Apr 2022 12:53:09 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d15so12081761pll.10 for ; Fri, 22 Apr 2022 09:53:07 -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=6UYSlRGZfhDryiA9u1wA9vZSGmpcy5aRg3TaG0SXLQ4=; b=PZfOO4AMGrpELFvOUr3lygr5vpSb4R9fbKALp+uFhJvHzV+Z1FPaO/15r+EeySd/2w AYx/Wz60DRQqBPiSrwi3kpKNU9VCXi0jRo4A1jYrVJxMNM8gwU3LmN4AKU0Sc2LwHRgI ARatgfNznMBsCaAcDG+KwzT1k9gmhP4ccYt5DpWVuje+X0QBdx9B17FkoKvJqgQtGN0s zGg/FZoz0aPRB99Wzr6QdtpVGhfEpka4stp7vqDU0VnM3fl/u/+cZhV1NEpT4GqhZNb+ MOfRdaf5XrOmKgywojFriEVA3b8Pl7G41euVRaKermKOpBZznH05AKPa0VyTAN/BOrij UkNg== 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=6UYSlRGZfhDryiA9u1wA9vZSGmpcy5aRg3TaG0SXLQ4=; b=pERF8pwNDf9gylc12cJ6liCZmNlS00+YwDC0dZR/Wj8hMZ6QWWtRqsb493cEpFsh/r Em4QBetTJJtR1b3qsw9Q24axVa1jnLVW7Slwms1uTZT+o+bHbweV0aS1uW2xoK3asMa+ VMF3UQT6PRFmX8NeaT7qh8vlOyFxHKpAmkAETJm45VhrW1IgK6GX5RHdG5bipRXukiJw c+Y7jaMWDoxMhpD4xslj78n1nCS2l9/g1y4hLbXuwcw4+MhvccTP+Yu+CRKTgLYP7KZj aafL2N6QksFPld7ot+FsI55B0Bal+vGBZbY1WrMFmDn8mSSv+O1XoBlUKDuUoQrbM0tV ZnLQ== X-Gm-Message-State: AOAM530kp3Tq8yLj+JGoeGSVO55wqyOkcthaBNtdHB4fiPm4aqhtSZYI VLU1cBPoe/LC3F2V150U8slI+cydl9mIxURw X-Received: by 2002:a17:902:820f:b0:158:c308:d4c5 with SMTP id x15-20020a170902820f00b00158c308d4c5mr5176196pln.155.1650646383955; Fri, 22 Apr 2022 09:53:03 -0700 (PDT) Received: from stoup.. ([2607:fb90:27d0:b0f2:934d:3e2:9f8c:dd1]) by smtp.gmail.com with ESMTPSA id 6-20020a17090a030600b001cd4989ff5fsm6835904pje.38.2022.04.22.09.53.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 09:53:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 13/68] target/nios2: Check supervisor on eret Date: Fri, 22 Apr 2022 09:51:43 -0700 Message-Id: <20220422165238.1971496-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220422165238.1971496-1-richard.henderson@linaro.org> References: <20220422165238.1971496-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: Peter Maydell , Amir Gonnen 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 Message-Id: <20220421151735.31996-14-richard.henderson@linaro.org> --- target/nios2/translate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 89b97ef520..eb97e13feb 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]);