From patchwork Fri Apr 22 16:51:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 564853 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp667483map; Fri, 22 Apr 2022 10:08:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWbqhFyhIKfV7GKGevol3PUcEqdm8Q0zDqZ1KBBcuB3BanJUeGAWAlnZKqhzxKEMPOPIjq X-Received: by 2002:a05:622a:1013:b0:2f2:5ba:53e8 with SMTP id d19-20020a05622a101300b002f205ba53e8mr3986996qte.614.1650647313665; Fri, 22 Apr 2022 10:08:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650647313; cv=none; d=google.com; s=arc-20160816; b=fUtY+7CsGhXWBzpJnkqF1TZ1noXK7eTAm3edt93EmUexaoZh220JPtXhLKgZnYrbCS K56bMqOc/E1eLpZup4brP2FItu0tte5fdjGB/CXfPYUFBqA89CYxKf5h3CGFB5+Ynkxr Yc5DBx116EbOR/SQmMERzHldMtxVAcQG18MGqQ2ZKmRMnlGAl+5XcLr1dMP6rCkkzAoS JqkGLdxrdqiTEvokBHJdaz24co2G7TpvwM14DINrytR79B0LqvHMYOkz6R+tGiM/UOs8 fRnemf58A8JF6hEOUwvM92eHjeraTPTpN4Q5p6YI63fHOyHOTu2Muk3NpQ/FzsewnZFd +RVQ== 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=qf4cYEUah8+UZ9PulZzd1wKH6UWiuDaNT9BP/AwB7KQ=; b=gGkN7Zfw36WUQ9bIepEXm6LfUXjNypnBInyZW45OgU1UwHPPv2EN/alYzsM9U3YeWi l2/LNbMCinYXP1aZYPBoW7IL2nKU7YDqzKE1TlEZGVXSGYgENtIitewtKZvTB3luJlUf UeykLl8BAuyJcyVk4BBwSnBlohkZuj6AFDiyDt7sFrVqkK0lzcxNafyD1wNwCL6kNJcb ZgyJJ9FysFRxZER8ipOgTQka/iXGouGA7kqGwSv4t2KPO7ve0Dl+mdppiwNBdZnW8Jfc L4iCK0mWFmMtnoCg8RNoouOilpePYCICBMPK0HKQy61odfSwpAr1+G18KCT8XaMJ2+jg NjOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=u4S1Jllj; 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 199-20020a370bd0000000b0069ecb2eb3fdsi2252687qkl.299.2022.04.22.10.08.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 10:08:33 -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=u4S1Jllj; 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]:54920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhwll-0000Iq-8G for patch@linaro.org; Fri, 22 Apr 2022 13:08:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhwWw-0000xP-LK for qemu-devel@nongnu.org; Fri, 22 Apr 2022 12:53:15 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:39608) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhwWv-0007Ge-1M for qemu-devel@nongnu.org; Fri, 22 Apr 2022 12:53:14 -0400 Received: by mail-pl1-x62c.google.com with SMTP id c12so12097468plr.6 for ; Fri, 22 Apr 2022 09:53:12 -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=qf4cYEUah8+UZ9PulZzd1wKH6UWiuDaNT9BP/AwB7KQ=; b=u4S1Jlljp6IxiHSeGBC5SlgoYO6hEkMQi5nIu7m9GycUWJvHvgz0A4NZxLQKUXe4cb /V1mV/ThxfZYnQwxcnFqfTJpQbSAf3rdBsY0kYQOq1GgrNIfScQ189SWQX+T5i61uuUf gSZxV3ZG6rrMxc6ZTSqppawv9h2zmf0Q9w/qQ2k8FxW/+HMUhzLr9yN/DgVognNT8PQW fSkqpv8jk0GErCm2nFzNLNVm4ODI9F9aMJAjQH/2tGVI0yoet3H6Vn5mPInFStB675R6 NfEc/xnKNf/qJ481VJX8nENYJpUnbBpONFLMDtcNQTlrBeRF85H1P0coeF/gMsZId4ps 69/A== 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=qf4cYEUah8+UZ9PulZzd1wKH6UWiuDaNT9BP/AwB7KQ=; b=MeMNfv7Bhc3IucmMhEfytVc/VNMNnBGR0xZZ8dlSlI//YPhLVoFXWBw5bA1H1AkLeH hLNCfDGxyqLOSoDqYD89kaAdEUEyO41rYwqVBPwOOrmMrLAfZkev4VlAeHNhcObjN1Rp O1mmzB94IXdlH0+BSPfKhJNQp0gWwN3guo3eXEGK8TsD77ZSc/kGszh3zluK17n6rowL s+0zsUMopeXohyJgPYM8cyh6wJtjxydUI8Mgmkc8cMYqGp5N1JgikBdcO0JCSoERCSSw VSPNzolVdMUhRuBJcQR783DpyV20rcZeitbwMuJAUBIRR8awLlk1DeXvwB9XxWWi0uce I1NA== X-Gm-Message-State: AOAM531oNW8POVl2dGPm23jNxdNrFc2GNja6lNhU3hqXB08sO5VTIMA+ p/6ZC6IskVstdvCVI4FcncDjsLClUqZPVsct X-Received: by 2002:a17:902:d3cb:b0:15b:a002:d80c with SMTP id w11-20020a170902d3cb00b0015ba002d80cmr5289221plb.108.1650646391361; Fri, 22 Apr 2022 09:53:11 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 09:53:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 17/68] target/nios2: Split out helper for eret instruction Date: Fri, 22 Apr 2022 09:51:47 -0700 Message-Id: <20220422165238.1971496-18-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::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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 The implementation of eret will become much more complex with the introduction of shadow registers. [rth: Split out of a larger patch for shadow register sets. Directly exit to the cpu loop from the helper.] Reviewed-by: Peter Maydell Signed-off-by: Amir Gonnen Message-Id: <20220303153906.2024748-3-amir.gonnen@neuroblade.ai> Signed-off-by: Richard Henderson Message-Id: <20220421151735.31996-18-richard.henderson@linaro.org> --- target/nios2/helper.h | 1 + target/nios2/op_helper.c | 9 +++++++++ target/nios2/translate.c | 10 ++++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/target/nios2/helper.h b/target/nios2/helper.h index a44ecfdf7a..525b6b685b 100644 --- a/target/nios2/helper.h +++ b/target/nios2/helper.h @@ -21,6 +21,7 @@ DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_WG, noreturn, env, i32) #if !defined(CONFIG_USER_ONLY) +DEF_HELPER_3(eret, noreturn, env, i32, i32) DEF_HELPER_2(mmu_write_tlbacc, void, env, i32) DEF_HELPER_2(mmu_write_tlbmisc, void, env, i32) DEF_HELPER_2(mmu_write_pteaddr, void, env, i32) diff --git a/target/nios2/op_helper.c b/target/nios2/op_helper.c index caa885f7b4..ee5ad8b23f 100644 --- a/target/nios2/op_helper.c +++ b/target/nios2/op_helper.c @@ -30,3 +30,12 @@ void helper_raise_exception(CPUNios2State *env, uint32_t index) cs->exception_index = index; cpu_loop_exit(cs); } + +#ifndef CONFIG_USER_ONLY +void helper_eret(CPUNios2State *env, uint32_t new_status, uint32_t new_pc) +{ + env->regs[CR_STATUS] = new_status; + env->pc = new_pc; + cpu_loop_exit(env_cpu(env)); +} +#endif /* !CONFIG_USER_ONLY */ diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 226bd9e30b..53699ee088 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -391,10 +391,12 @@ static void eret(DisasContext *dc, uint32_t code, uint32_t flags) return; } - tcg_gen_mov_tl(cpu_R[CR_STATUS], cpu_R[CR_ESTATUS]); - tcg_gen_mov_tl(cpu_pc, cpu_R[R_EA]); - - dc->base.is_jmp = DISAS_JUMP; +#ifdef CONFIG_USER_ONLY + g_assert_not_reached(); +#else + gen_helper_eret(cpu_env, cpu_R[CR_ESTATUS], cpu_R[R_EA]); + dc->base.is_jmp = DISAS_NORETURN; +#endif } /* PC <- ra */