From patchwork Tue Apr 26 18:18:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 566078 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp3848599map; Tue, 26 Apr 2022 11:42:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3uJIg/G9TPt4/+fThtGkgYGzNwoAJnvR8pAHRRPsis/Lzn06vyQh66c8ZEvYdtZ2yuDSy X-Received: by 2002:a05:6902:102a:b0:644:afab:d305 with SMTP id x10-20020a056902102a00b00644afabd305mr22415036ybt.150.1650998537656; Tue, 26 Apr 2022 11:42:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650998537; cv=none; d=google.com; s=arc-20160816; b=NmUCDC7gZT14SAoE38PfuE0UCDVo8/INrzf63znsBv9BG+0K4o4me0mSFgi07SWiOG Dojxzj02y5avTwHehmRRvkNwmvyEJD9VcQJNB2SJL2DO982y678rkkniKinjUo6PSTaZ A9x8LrgRFPB69+CW3OwnjjqoTPq2Ofz1/lX0oePcqtQi44iDxpW5D1dv7mq2mu7tci7I KrOetK6Q1FhMHCBAwFcqCJFglGakR2VASi1SIidQafqNXBvlG3gxySTmelnDwDnakgTg AXC7YNAocR4mZ5BeYF+I9cwv4oF/VZyI34gRCefg1zChnAZiZ/Mkih34cGuHMumBpIAa wmOQ== 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=i+pIlq3Zf7Ct4aEs80TxFQjBRjx+ntMdX+PCJRolBhs=; b=08Hq+LpYOUONz4N5/lhhacBoT06zm54t+SF46Zk70Bs1DAQ3MDP8wIFs4/FrvChla5 75rzAAZcTf8aSQTqj+uO7tXB+DD7K4fztD7dQoISOAsQ1jOXCxllT+B1G6DjHfXnoBif 2Luc5sWJftRxFKHatN0sFZiFhQU1fMW+N4Nr9akSrC34+FilyLwLsgeHV/5LHNmShbxb uH0h+qqUj0Hfi1eyPgn956KrjoHOh7H23JCICe8DKllxn0Qps6f4xW8cvBP94xLT3EZV /Ky6kFemxlOlNyu9I3PDtgCqZaDtnQipQit6uD9z/bDD0i0NlJdfCNMIJEkv+S1FSLzZ RrrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h1M3ibQB; 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=pass (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 i84-20020a255457000000b00648380f2c12si8952978ybb.520.2022.04.26.11.42.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Apr 2022 11:42:17 -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=pass header.i=@linaro.org header.s=google header.b=h1M3ibQB; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njQ8e-00023O-PR for patch@linaro.org; Tue, 26 Apr 2022 14:42:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njPmZ-0002Zq-KO for qemu-devel@nongnu.org; Tue, 26 Apr 2022 14:19:28 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:35603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1njPmY-0004OA-3y for qemu-devel@nongnu.org; Tue, 26 Apr 2022 14:19:27 -0400 Received: by mail-pg1-x529.google.com with SMTP id r83so16743077pgr.2 for ; Tue, 26 Apr 2022 11:19:25 -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=i+pIlq3Zf7Ct4aEs80TxFQjBRjx+ntMdX+PCJRolBhs=; b=h1M3ibQBXkj7y4vkNLhPwa2fp6HzgBPebAtCu/FIOr/3s9Y8zM9gPUYO2uC7DRFOVe NKooUyUITPmzRKCneXz5bFiGGGshblIZwsayp+foyh0MfSqs9/+ZeZLAxaM+ByvSDmTb YhYaPhboYAEZHV/zlbLA0E2n5PUr1wo2Jpa5FHx/HfxSYfwhecA227pZvKDA1tnbL2hS ti9PLcEteXSYkI7JCS3nlLjFdsRg9VlK182NzKMYkkGtvMVX8O4cxUfp9QSOC1cdfADG r86cQtAbBtiGBd9FelFirjh9usi3nZsBNuL1fwtyPChiUjZOAMdo4Qr/OkjFrUDgrzs4 cc4g== 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=i+pIlq3Zf7Ct4aEs80TxFQjBRjx+ntMdX+PCJRolBhs=; b=S9JgSgslTgGbMk+re3bJON+QIvIOzxF/7+SEfIix4ZZVMdf8yAYsJT/zQA7AhaLuFQ 8J784vGVrC42n4MxvAeaRyyxZgjll8Inve8GDyd/e/SjbhJjHNPNVKVoCtavJYC0QgMg ws/Bjz0NxucbQbz3QQWb27KIiM4KSh3JBr4U+n+RkvgSTBH+RuN1Y09zbnZM5YG8HL4R tjudpkycUrqswG9T8he04hva6Z7QSCx1X6/6LlS+SC8TkTk38shHikG48G/TeITaWxvJ /r8v83u3MkBz8Vxlwlh9u9rb1+CLYWk97ThMJUCiIIwPt839WcaB7fdmQFNeaHg+TI6X PhVA== X-Gm-Message-State: AOAM531/LqeHKviUXyeihk4i3PTV6PBzCMl3ar623r0c+pz0RMDfe1tg ZJZTHGC7Ra7XSccjoF4ovR+80E3OAcTRuA== X-Received: by 2002:a65:6657:0:b0:381:1b99:3f04 with SMTP id z23-20020a656657000000b003811b993f04mr20390053pgv.512.1650997164770; Tue, 26 Apr 2022 11:19:24 -0700 (PDT) Received: from stoup.. (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id j7-20020a056a00130700b004b9f7cd94a4sm16482827pfu.56.2022.04.26.11.19.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Apr 2022 11:19:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 18/68] target/nios2: Fix BRET instruction Date: Tue, 26 Apr 2022 11:18:17 -0700 Message-Id: <20220426181907.103691-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220426181907.103691-1-richard.henderson@linaro.org> References: <20220426181907.103691-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We had failed to copy BSTATUS back to STATUS, and diagnose supervisor-only. The spec is light on the specifics of the implementation of bret, but it is an easy assumption that the restore into STATUS should work the same as eret. Therefore, reuse the existing helper_eret. Reviewed-by: Peter Maydell Reported-by: Peter Maydell Signed-off-by: Richard Henderson Message-Id: <20220421151735.31996-19-richard.henderson@linaro.org> --- target/nios2/translate.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 53699ee088..3694f2503b 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -407,12 +407,22 @@ static void ret(DisasContext *dc, uint32_t code, uint32_t flags) dc->base.is_jmp = DISAS_JUMP; } -/* PC <- ba */ +/* + * status <- bstatus + * PC <- ba + */ static void bret(DisasContext *dc, uint32_t code, uint32_t flags) { - tcg_gen_mov_tl(cpu_pc, cpu_R[R_BA]); + if (!gen_check_supervisor(dc)) { + return; + } - dc->base.is_jmp = DISAS_JUMP; +#ifdef CONFIG_USER_ONLY + g_assert_not_reached(); +#else + gen_helper_eret(cpu_env, cpu_R[CR_BSTATUS], cpu_R[R_BA]); + dc->base.is_jmp = DISAS_NORETURN; +#endif } /* PC <- rA */