From patchwork Tue Mar 8 07:19:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 549253 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp2391459mag; Mon, 7 Mar 2022 23:37:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzXRXZZyBJF4VYBiuuD2R8KLZFct5kMBaL2sRYBENuA8eGB0td9PatWbluAfwsNtpr5Oo0a X-Received: by 2002:a05:620a:bcb:b0:67d:1b1c:a988 with SMTP id s11-20020a05620a0bcb00b0067d1b1ca988mr513574qki.587.1646725078104; Mon, 07 Mar 2022 23:37:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646725078; cv=none; d=google.com; s=arc-20160816; b=YzRny5+K3/m94ne/duwLkyFDjFtrluk22PqegztXfYIekV/jKK+aDuoan96nakDN+x Pn6tCp0EjMECmmZviKnmcwuQCaMqCy3nPU+7FquKsXuwXgG5lNBDKgjtzx0TZEszK5fZ CbsbXOhuGWdqeVmwtxT/f733RkV39hsrbGafCSaUhp8LgFV6wr0sKwMqzNo2I3UUtZFp n3UK3jC5E8hbKKDwY3Ao3IN2D3gIUxW8cJ3nhl7r4UnKZfnKMdBnYl2GaILGNAT/gacg XfaojS4/a4ro/FLobSYCW0eD6RNs1UCydpIFSk3ZgalytCGO4HyQM+nDrIhdwY8WV+pP 0lvQ== 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=ois2JoZ1sznM8822SyfVxQPmV9CSqStEGCSJaWikHEs=; b=NJ7joE0Tfh6WLyg5cMx3zJ10ID7DLMyjG223qF5MzIYlVq8lcHOxbGbvQXlLUuyioa foeVHmTHFMfubrndBv7cGmDlnA1O7qyHNZtqVEyUFeE2OIPzeAynlH+MoTxXPTU1+g72 2xvOSiadJe+M2Ij6lKgpWj2F7BLZwy4xLmtE1h26FxHGrt4ICEGDN3/SPXwe85Xh7hee ZA01CvVDId3Tr82VQEWEqHerbeo4Oxo12bf8u7zuu42HhHt2xND5KomUgilAHxy3wlJ2 J4cC4B7LawtvzHIXVtCem8kBeySbs5glUj7nPdn4B8tpDfkq3S71XCW9a/Wb1E1jGIEd Fd2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=gJdbN11Y; 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 x7-20020a05620a448700b0067b137cf007si3147923qkp.207.2022.03.07.23.37.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Mar 2022 23:37:58 -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=gJdbN11Y; 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]:60598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRUPt-0004zb-Id for patch@linaro.org; Tue, 08 Mar 2022 02:37:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRU91-0005BP-In for qemu-devel@nongnu.org; Tue, 08 Mar 2022 02:20:32 -0500 Received: from [2607:f8b0:4864:20::530] (port=38856 helo=mail-pg1-x530.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRU8z-0006Jn-W8 for qemu-devel@nongnu.org; Tue, 08 Mar 2022 02:20:31 -0500 Received: by mail-pg1-x530.google.com with SMTP id 132so15683848pga.5 for ; Mon, 07 Mar 2022 23:20:29 -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=ois2JoZ1sznM8822SyfVxQPmV9CSqStEGCSJaWikHEs=; b=gJdbN11Y6frWYAEA2OiUSlZTHPOV+1Oh64stV3JA50SQv7CrcMvmJvf/esq/1z681P mwNS0cwUvt8F7oWYElX4Et9QCWWAmiFUckunEWySMtxhLTG/6P3C310Ap9Tx2p23+9M5 +vcJW8iopjajnBZh2KMnOpJvgLuhLMO3QnCknc/r4t2HkmW0iD8KBgxz2oBagoo1WhkE HTpmd0oYsryJLOPP7f1Ssw6nauP/YhYAXYsE44XmlqWFfuMCoRlFhN8YYmd0ypqnQLBk Dch1SrbNps7L3U0TteBpjOLa4KWpLKt6s87YDrhLKowVHRMh3JQLs+qFgl7Gr773ibAE N0mA== 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=ois2JoZ1sznM8822SyfVxQPmV9CSqStEGCSJaWikHEs=; b=TA+ZDBtrS37VdMDl84zVXKFRFksdSUgr4y+zW+WyBl8NOWjifegaklvIW1+SJrXf/P 6hTkChVAJX5Ttg+Z407cnfOSxmQoLwY/HiaPzRKuATn6yJn0PvVFjWs/FBZwmYQ8+5JK v7ut+bm6pYeFxpgClNoM+/XT8X1Bugr3X+YDENJDwrFlzaIGW0FFZnR5O3hC0SOGAW8+ eExfEVsYxicyzoZbN+b0TWsf1K/NUrD2DoxFC6ychuoZzs0Z/paanStyNViidy08FXSN tFZRIxoISou10jNT0sTu5YCGuR2JB1TkcesMFQdeGFus/p8D7UfzGPOuys5k8BtGFf64 skxw== X-Gm-Message-State: AOAM530+HbvNQPdI3zNLT2/XRG2+zWGifk+b6SzQeyTCjlEj6AF8InU9 9gXL8xix66ZJOnbelwQVsd7BnvPTBe4oqA== X-Received: by 2002:a62:8085:0:b0:4df:443c:7227 with SMTP id j127-20020a628085000000b004df443c7227mr16942943pfd.34.1646724028262; Mon, 07 Mar 2022 23:20:28 -0800 (PST) Received: from localhost.localdomain (cpe-50-113-46-110.hawaii.res.rr.com. [50.113.46.110]) by smtp.gmail.com with ESMTPSA id p125-20020a622983000000b004f6c5d58225sm13790899pfp.90.2022.03.07.23.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 23:20:27 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 12/33] target/nios2: Use hw/registerfields.h for CR_EXCEPTION fields Date: Mon, 7 Mar 2022 21:19:44 -1000 Message-Id: <20220308072005.307955-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308072005.307955-1-richard.henderson@linaro.org> References: <20220308072005.307955-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::530 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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" Sink the set of env->exception to the end of nios2_cpu_do_interrupt. Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 4 ++++ target/nios2/helper.c | 24 +++--------------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h index 26618baa70..35b4d88859 100644 --- a/target/nios2/cpu.h +++ b/target/nios2/cpu.h @@ -105,6 +105,10 @@ FIELD(CR_STATUS, NMI, 22, 1) #define CR_CPUID 5 #define CR_CTL6 6 #define CR_EXCEPTION 7 + +FIELD(CR_EXCEPTION, CAUSE, 2, 5) +FIELD(CR_EXCEPTION, ECCFTL, 31, 1) + #define CR_PTEADDR 8 #define CR_PTEADDR_PTBASE_SHIFT 22 #define CR_PTEADDR_PTBASE_MASK (0x3FF << CR_PTEADDR_PTBASE_SHIFT) diff --git a/target/nios2/helper.c b/target/nios2/helper.c index 3c49b0cfbf..eb354f78e2 100644 --- a/target/nios2/helper.c +++ b/target/nios2/helper.c @@ -64,9 +64,6 @@ void nios2_cpu_do_interrupt(CPUState *cs) env->status |= CR_STATUS_IH; env->status &= ~(CR_STATUS_PIE | CR_STATUS_U); - env->exception &= ~(0x1F << 2); - env->exception |= (cs->exception_index & 0x1F) << 2; - env->regs[R_EA] = env->pc + 4; env->pc = cpu->exception_addr; break; @@ -83,9 +80,6 @@ void nios2_cpu_do_interrupt(CPUState *cs) env->status |= CR_STATUS_EH; env->status &= ~(CR_STATUS_PIE | CR_STATUS_U); - env->exception &= ~(0x1F << 2); - env->exception |= (cs->exception_index & 0x1F) << 2; - env->tlbmisc &= ~CR_TLBMISC_DBL; env->tlbmisc |= CR_TLBMISC_WR; @@ -98,9 +92,6 @@ void nios2_cpu_do_interrupt(CPUState *cs) env->status |= CR_STATUS_EH; env->status &= ~(CR_STATUS_PIE | CR_STATUS_U); - env->exception &= ~(0x1F << 2); - env->exception |= (cs->exception_index & 0x1F) << 2; - env->tlbmisc |= CR_TLBMISC_DBL; env->pc = cpu->exception_addr; @@ -116,9 +107,6 @@ void nios2_cpu_do_interrupt(CPUState *cs) env->status |= CR_STATUS_EH; env->status &= ~(CR_STATUS_PIE | CR_STATUS_U); - env->exception &= ~(0x1F << 2); - env->exception |= (cs->exception_index & 0x1F) << 2; - if ((env->status & CR_STATUS_EH) == 0) { env->tlbmisc |= CR_TLBMISC_WR; } @@ -140,9 +128,6 @@ void nios2_cpu_do_interrupt(CPUState *cs) env->status |= CR_STATUS_EH; env->status &= ~(CR_STATUS_PIE | CR_STATUS_U); - env->exception &= ~(0x1F << 2); - env->exception |= (cs->exception_index & 0x1F) << 2; - env->pc = cpu->exception_addr; break; @@ -158,9 +143,6 @@ void nios2_cpu_do_interrupt(CPUState *cs) env->status |= CR_STATUS_EH; env->status &= ~(CR_STATUS_PIE | CR_STATUS_U); - env->exception &= ~(0x1F << 2); - env->exception |= (cs->exception_index & 0x1F) << 2; - env->pc = cpu->exception_addr; break; @@ -183,9 +165,6 @@ void nios2_cpu_do_interrupt(CPUState *cs) env->status |= CR_STATUS_EH; env->status &= ~(CR_STATUS_PIE | CR_STATUS_U); - env->exception &= ~(0x1F << 2); - env->exception |= (cs->exception_index & 0x1F) << 2; - env->pc = cpu->exception_addr; break; @@ -194,6 +173,9 @@ void nios2_cpu_do_interrupt(CPUState *cs) cs->exception_index); break; } + + env->exception = FIELD_DP32(env->exception, CR_EXCEPTION, CAUSE, + cs->exception_index); } hwaddr nios2_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)