From patchwork Thu Mar 10 11:27:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 550136 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp949968mag; Thu, 10 Mar 2022 04:35:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzxtkorYmX2tLzAPKagryOosGbHGqmFIUCQbhIGv6QaJknjQzYUVzUTxEJ8HHTIQwz5EGpg X-Received: by 2002:a81:ad0:0:b0:2dc:86d2:1d6c with SMTP id 199-20020a810ad0000000b002dc86d21d6cmr3689739ywk.498.1646915704302; Thu, 10 Mar 2022 04:35:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646915704; cv=none; d=google.com; s=arc-20160816; b=Q0T4UDLfHgapoq7mJzGh9ZwrTzK57HEUOSlhdOJpy3c4L68YwEJHSycFlTOS5VpptN rXXzbtRTkDCRrkLiBeUkQMvGoptXjOD+oZoj1lvBSseH2ZTuk9vR/OpDhm1Q1GVGtmXu mCoz4l6pWTD0CBhk6TcnVekYM4OaUGqJtq4p5+OFhETC3BWIGLmdabdhXUJRQjIl/5qk S/Dp1+mZAzbcgGJDHifxruZ6EQBOBLeTb7n5suQiiJ/+mr0v1Wg2H3o+qTGf8U1ilqw7 Z5KMvLS7XFJVlXRoqsA60hmCdB3hWiDxsJ2oP5QvPSoPOIEwvIfJA3x5f0URnT8inGfa 76bw== 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=MVyC4ASoKbDoWqWtQ6it33/tXOmFXiabY9tyAWzkgHg=; b=Ace7iU4oAGHr5OWQlzOOTensoryn0BXOMD2iTS0A45gs/0xtJaOhXWGmucNGaTX1hn 9CBN7GGeVcpKQOM4FZ8jMOYjafN4tmmtSi3EU72haPA96mLOTlvXi7IuqFnOnirehfkZ ST7FAJvYflZqnROxwErXeAJiCbvIWuR5glmHG1DY8QoTuWsvpS4aCr46SqdPMUbMPcwT KzLavxKw1SeZ5aEaYEzOv9tbocNLfEFHQCWCQa/cL/d4aUZ4BSyuQfNsGHFt61/FnsNV MllQCGiiw2ElxmA8PnnZ84OaOBl7OTYF9xZXrlFFxJ7QTd1cpzAFPrYFiJaLyJwVs2BS PAnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="G8JdJh/m"; 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 d17-20020a5b00d1000000b006220e248ea7si2798060ybp.433.2022.03.10.04.35.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Mar 2022 04:35:04 -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="G8JdJh/m"; 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]:59862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nSI0V-0004gk-Qj for patch@linaro.org; Thu, 10 Mar 2022 07:35:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nSH0p-0002Wo-LO for qemu-devel@nongnu.org; Thu, 10 Mar 2022 06:31:23 -0500 Received: from [2607:f8b0:4864:20::1033] (port=56259 helo=mail-pj1-x1033.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nSH0n-0008TK-LN for qemu-devel@nongnu.org; Thu, 10 Mar 2022 06:31:18 -0500 Received: by mail-pj1-x1033.google.com with SMTP id e3so4819678pjm.5 for ; Thu, 10 Mar 2022 03:31:17 -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=MVyC4ASoKbDoWqWtQ6it33/tXOmFXiabY9tyAWzkgHg=; b=G8JdJh/mnLXGyv0MmsQUXsBl2mSG8XRFkAfJkovZ7cMY5SO2XK1KepvXOvx/qw6xaV H/i1LoUqECvKwAomO8Sq7L5nDRmPYL6AoUeYwwxqAbR4a944LtZZNEA5HCqMJrhVV7TY g7l1V22dox1xdc9hgRZYmlwj8ZtlYTc7VFeMrdGV9hKdZOT57yrI4jaCTOV/hk3+WO88 bFYnBAAFpYvNez9Cb00nUyzjEsArwyOFgEh6cJXfVJRkpZAhBcsQh8sQgvvuuGSJ4mHb 99vkcEKCNETxJwaNxytiuW1SKTTIkt5rrcMuaymXLYVzw1t22LUGOKBzgQVdi68GAowU c4VA== 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=MVyC4ASoKbDoWqWtQ6it33/tXOmFXiabY9tyAWzkgHg=; b=mi2Oat6Q7j8o1058hVA5hN5TGcTvkgLnW8dG5zPYyoibB6kgiV2MFE9CItkG9zqPtk DYYDHUojEqZhAqjdh8Pett9WM1tLNwJWuN8De+dqPPHEQM9Use8xN7V+9o6VGRBLEjbK wCJdtgzpl/gPVklHHFpiPbojJ3y7rrI+7SPcf5yiTEjwaOstmqnhuj5byUZp4hwydSCu 0oBYHSkVx5OTG73YEv2At1OC2uUKs1SKikyzbraDC1wqMChvNkRsaQUT166BIPn9mrpF 4oy1hvpDHihUJ7OIyaXg4q/qeaAYjGB2fRbqW071ajQjPmDyXVhka8xL4tgE00M9x6XZ cj3g== X-Gm-Message-State: AOAM53198l37cePNd8L/8s4aFlGdCToBREXV5C48Q8099zaET4Vbl3WB d+tidbS1kc+qfCB59eNxOxuEsgSKwJwFHA== X-Received: by 2002:a17:90a:a78f:b0:1bc:8042:9330 with SMTP id f15-20020a17090aa78f00b001bc80429330mr15339983pjq.229.1646911876397; Thu, 10 Mar 2022 03:31:16 -0800 (PST) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020a056a001a8e00b004f75cf1ab6csm6011246pfv.206.2022.03.10.03.31.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Mar 2022 03:31:15 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 43/48] target/nios2: Update helper_eret for shadow registers Date: Thu, 10 Mar 2022 03:27:20 -0800 Message-Id: <20220310112725.570053-44-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::1033 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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" When CRS = 0, we restore from estatus; otherwise from sstatus. Update for the new CRS. Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 1 + target/nios2/op_helper.c | 3 ++- target/nios2/translate.c | 13 ++++++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h index 26d4dcfe12..62a73c7b32 100644 --- a/target/nios2/cpu.h +++ b/target/nios2/cpu.h @@ -82,6 +82,7 @@ enum { R_FP = 28, R_EA = 29, R_BA = 30, + R_SSTATUS = 30, R_RA = 31, }; diff --git a/target/nios2/op_helper.c b/target/nios2/op_helper.c index e5e70268da..2eac957f68 100644 --- a/target/nios2/op_helper.c +++ b/target/nios2/op_helper.c @@ -73,7 +73,7 @@ void helper_eret(CPUNios2State *env, uint32_t new_status, uint32_t new_pc) } /* - * Both estatus and bstatus have no constraints on write; + * None of estatus, bstatus, or sstatus have constraints on write; * do not allow reserved fields in status to be set. */ new_status &= (cpu->cr_state[CR_STATUS].writable | @@ -81,6 +81,7 @@ void helper_eret(CPUNios2State *env, uint32_t new_status, uint32_t new_pc) env->ctrl[CR_STATUS] = new_status; env->pc = new_pc; + nios2_update_crs(env); cpu_loop_exit(cs); } diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 2b2f528e00..7a25c864e2 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -435,11 +435,14 @@ static void eret(DisasContext *dc, uint32_t code, uint32_t flags) #ifdef CONFIG_USER_ONLY g_assert_not_reached(); #else - TCGv tmp = tcg_temp_new(); - tcg_gen_ld_tl(tmp, cpu_env, offsetof(CPUNios2State, ctrl[CR_ESTATUS])); - gen_helper_eret(cpu_env, tmp, load_gpr(dc, R_EA)); - tcg_temp_free(tmp); - + if (dc->crs0) { + TCGv tmp = tcg_temp_new(); + tcg_gen_ld_tl(tmp, cpu_env, offsetof(CPUNios2State, ctrl[CR_ESTATUS])); + gen_helper_eret(cpu_env, tmp, load_gpr(dc, R_EA)); + tcg_temp_free(tmp); + } else { + gen_helper_eret(cpu_env, load_gpr(dc, R_SSTATUS), load_gpr(dc, R_EA)); + } dc->base.is_jmp = DISAS_NORETURN; #endif }