From nobody Wed Feb 11 00:56:37 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1651610873; cv=none; d=zohomail.com; s=zohoarc; b=AqWuxulecu7n7B422Xd0qdeJJQ5RFQ03DprKH7UTBo3wGuc8wnUKocHl1bo/jEYbwfn8V2LHxfjkkQXtGDoxLzpH1Sf9kS2hirPiwQ8n2higzZ4Aa70hbP0/WrspGIH6VWigEU2hKB2Euxu2iHt7PO41J6EmIhEba2mNDlpWu64= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651610873; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QUpRdJbpx7VQuY/FyAcpatmDIjI0TndHoNfi0QxhsFU=; b=M7HfdIw+qLKqDTC3vqTbC+p2qt+CY2+GcC5dSn5n/55M2qIgTBEoglO3kiXbDKdmetSdyuikOl364bA8patLlZIO84ACql1GtNp+SJ9EFkFG7v3RbC88hFYQq8oRt6KoViiWnG0ewqmQbH0LTIbFHEnBOqFGGfpfo7td6ayd7cQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651610873475949.0549048079168; Tue, 3 May 2022 13:47:53 -0700 (PDT) Received: from localhost ([::1]:53362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlzR2-0008H6-97 for importer@patchew.org; Tue, 03 May 2022 16:47:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40652) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyZw-0000lg-Sk for qemu-devel@nongnu.org; Tue, 03 May 2022 15:53:01 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:33363) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlyZt-0006Gc-5j for qemu-devel@nongnu.org; Tue, 03 May 2022 15:53:00 -0400 Received: by mail-pj1-x1034.google.com with SMTP id cu23-20020a17090afa9700b001d98d8e53b7so2552004pjb.0 for ; Tue, 03 May 2022 12:52:55 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id fz16-20020a17090b025000b001dbe11be891sm1692286pjb.44.2022.05.03.12.52.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 May 2022 12:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=QUpRdJbpx7VQuY/FyAcpatmDIjI0TndHoNfi0QxhsFU=; b=d/t6hJXzAb5M3+WOQp7wV86NfCYE4d6AXt80oxmT0/PtOCtTZaGFvn5EyPZsU7kL6e NMFXNNBShL/4WHgcZo66j8qOeuua1B5uSr8wlRK78Up1XITVYml87OW8sh2Ugg1HW1lx JnRC98H+kKrbJrFhMSs1wsnNZNcwEKksJ/fLcUMAPqjZs05lbmxiJZ0eCvjw1otj6UG4 2jeZbic3vK+8UKKIkLl8teG9T14Me69lpNB+McofFIAoDWAiMbcQlQRURwA1mHZuLzbT 4Np8MwmbGb/TBkoe/Baz7lYTnQaMri9mC5uOiZSs65yRM9gOvZTaKVsoeTF3kay6U3+u 4cWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QUpRdJbpx7VQuY/FyAcpatmDIjI0TndHoNfi0QxhsFU=; b=jGP4Z069Xr3qjWYN93oEMOw0Dt+7Pf6n3cd3RgszIXNJezvfEWT8nHoFntt89VzkHx KFnl8HqQYiW9rso9ANfMddCNMFiJUOfAv0IfmMYN2NKR9mYPUFrPa7U8vHlyvl2wnFMc b2N5Xm1neAF+nJHtd0bkM4cotWCmU3Ar7lUUzdcA+g5L0LmjsgVlp79n8mIEQfy2nOOm nLCXI3mmfm2oD9Wh+p4Jhp0s/blGbQqIb1WgNqftNr/J5blv0Y8ldJnG2fuPAGvMFFob fLg8CdefOl3RvIMH08pA2rPqTs8Ne2Q7OwBDPeiZKZL7A1JiuI+xhnUvmSsfcoqn+44e WRvw== X-Gm-Message-State: AOAM531Jlr79kdHr3izZzQz9wDBRrr2zJ6eE6Uie2d1Jd+03Hs3tw57H x90SUubPKj1DPg9ss+DFjMr04N+bsuxmVA== X-Google-Smtp-Source: ABdhPJzoBMptAFdareiMR6gabpEobGoqTQiEdpZCa96QRlNhC3FigvkSrxMnRQLJewexO2xhyma2Fw== X-Received: by 2002:a17:90b:3e8d:b0:1dc:3db4:920a with SMTP id rj13-20020a17090b3e8d00b001dc3db4920amr6470883pjb.161.1651607575518; Tue, 03 May 2022 12:52:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 70/74] target/rx: Name the exceptions Date: Tue, 3 May 2022 12:48:39 -0700 Message-Id: <20220503194843.1379101-71-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220503194843.1379101-1-richard.henderson@linaro.org> References: <20220503194843.1379101-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1651610875387100001 Content-Type: text/plain; charset="utf-8" Provide EXCP_* names to the fixed and relocatable vector table entries. Signed-off-by: Richard Henderson --- target/rx/cpu.h | 20 ++++++++++++++++++++ target/rx/helper.c | 25 ++++++++++++++++--------- target/rx/op_helper.c | 15 +++++++-------- 3 files changed, 43 insertions(+), 17 deletions(-) diff --git a/target/rx/cpu.h b/target/rx/cpu.h index 5655dffeff..99e28fb70f 100644 --- a/target/rx/cpu.h +++ b/target/rx/cpu.h @@ -66,6 +66,26 @@ enum { NUM_REGS =3D 16, }; =20 +enum { + /* + * The Fixed Vector Table begins at 0xffffff80 and contains 32 entries, + * most of which are reserved. + */ + EXCP_PRIVILEGED =3D 20, + EXCP_ACCESS =3D 21, + EXCP_UNDEFINED =3D 23, + EXCP_FPU =3D 25, + EXCP_NMI =3D 30, + EXCP_RESET =3D 31, + + /* + * The Relocatable Vector Table begins at env->intb and + * contains 256 entries. + */ + EXCP_INTB_0 =3D 0x100, + EXCP_INTB_255 =3D EXCP_INTB_0 + 255, +}; + typedef struct CPUArchState { /* CPU registers */ uint32_t regs[NUM_REGS]; /* general registers */ diff --git a/target/rx/helper.c b/target/rx/helper.c index c6e285657e..29a4b075fa 100644 --- a/target/rx/helper.c +++ b/target/rx/helper.c @@ -83,36 +83,43 @@ void rx_cpu_do_interrupt(CPUState *cs) } } else { uint32_t vec =3D cs->exception_index; - const char *expname =3D "unknown exception"; + const char *expname; =20 env->isp -=3D 4; cpu_stl_data(env, env->isp, save_psw); env->isp -=3D 4; cpu_stl_data(env, env->isp, env->pc); =20 - if (vec < 0x100) { + if (vec < EXCP_INTB_0) { env->pc =3D cpu_ldl_data(env, 0xffffff80 + vec * 4); } else { - env->pc =3D cpu_ldl_data(env, env->intb + (vec & 0xff) * 4); + env->pc =3D cpu_ldl_data(env, env->intb + (vec - EXCP_INTB_0) = * 4); } switch (vec) { - case 20: + case EXCP_PRIVILEGED: expname =3D "privilege violation"; break; - case 21: + case EXCP_ACCESS: expname =3D "access exception"; break; - case 23: + case EXCP_UNDEFINED: expname =3D "illegal instruction"; break; - case 25: + case EXCP_FPU: expname =3D "fpu exception"; break; - case 30: + case EXCP_NMI: expname =3D "non-maskable interrupt"; break; - case 0x100 ... 0x1ff: + case EXCP_RESET: + expname =3D "reset interrupt"; + break; + case EXCP_INTB_0 ... EXCP_INTB_255: expname =3D "unconditional trap"; + break; + default: + expname =3D "unknown exception"; + break; } qemu_log_mask(CPU_LOG_INT, "exception 0x%02x [%s] raised\n", (vec & 0xff), expname); diff --git a/target/rx/op_helper.c b/target/rx/op_helper.c index 9ca32dcc82..6ab7b070bd 100644 --- a/target/rx/op_helper.c +++ b/target/rx/op_helper.c @@ -114,7 +114,7 @@ static void update_fpsw(CPURXState *env, float32 ret, u= intptr_t retaddr) enable =3D FIELD_EX32(env->fpsw, FPSW, ENABLE); enable |=3D 1 << 5; /* CE always enabled */ if (cause & enable) { - raise_exception(env, 21, retaddr); + raise_exception(env, EXCP_FPU, retaddr); } } } @@ -420,8 +420,7 @@ uint32_t helper_divu(CPURXState *env, uint32_t num, uin= t32_t den) =20 /* exception */ static inline G_NORETURN -void raise_exception(CPURXState *env, int index, - uintptr_t retaddr) +void raise_exception(CPURXState *env, int index, uintptr_t retaddr) { CPUState *cs =3D env_cpu(env); =20 @@ -431,17 +430,17 @@ void raise_exception(CPURXState *env, int index, =20 G_NORETURN void helper_raise_privilege_violation(CPURXState *env) { - raise_exception(env, 20, GETPC()); + raise_exception(env, EXCP_PRIVILEGED, GETPC()); } =20 G_NORETURN void helper_raise_access_fault(CPURXState *env) { - raise_exception(env, 21, GETPC()); + raise_exception(env, EXCP_ACCESS, GETPC()); } =20 G_NORETURN void helper_raise_illegal_instruction(CPURXState *env) { - raise_exception(env, 23, GETPC()); + raise_exception(env, EXCP_UNDEFINED, GETPC()); } =20 G_NORETURN void helper_wait(CPURXState *env) @@ -456,10 +455,10 @@ G_NORETURN void helper_wait(CPURXState *env) =20 G_NORETURN void helper_rxint(CPURXState *env, uint32_t vec) { - raise_exception(env, 0x100 + vec, 0); + raise_exception(env, EXCP_INTB_0 + vec, 0); } =20 G_NORETURN void helper_rxbrk(CPURXState *env) { - raise_exception(env, 0x100, 0); + raise_exception(env, EXCP_INTB_0, 0); } --=20 2.34.1