From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573039; cv=none; d=zohomail.com; s=zohoarc; b=QUnpaPyeicqNTfNaZwPg1t102AilUh4lb1N+qSmmIfz46mFr+YSR/jQtqyxPfEEY+KSeHqT3aSlKuL4XErOX6J7Uqm88i1/cC/aG2XeXFIuAUCD0iEhE9bgnjv2zwgZiN/WZVfJwEy8icEOfkyMPwEY/NthAP3iemL71mefNMa8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573039; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VkeT4VEb7dbNZHrc7V8wy1qO12OU0ezx6Qp6yR7AiHI=; b=N21wXpCgooQYjfJMkr26Q1YNRBV2Jq9AJpMLxQDDVZioQdtzzZtcU6wRXYiOP+eskbXxDYqwsB+cvtLWt2OEdh7zTFfrMF85bliH8NSSMy+aCY/jBIUA79c/clKduHqLvzrANiiaY1MG8rGtfvaDQM+XpIhqiVaToVyHRcDZHHY= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573039489955.1437849988691; Sun, 27 Sep 2026 22:23:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3ni-0003Jo-LQ; Mon, 28 Sep 2026 01:21:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3ng-0003Ic-OD for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:21:16 -0400 Received: from mail-dl2-x0d.google.com ([2607:f8b0:4864:38::d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3nd-0007kp-CH for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:21:16 -0400 Received: by mail-dl2-x0d.google.com with SMTP id a92af1059eb24-148b5c829e8so740866c88.0 for ; Sun, 27 Sep 2026 22:21:13 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.21.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:21:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572872; x=1791177672; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VkeT4VEb7dbNZHrc7V8wy1qO12OU0ezx6Qp6yR7AiHI=; b=VhAPNbN+znXDwO1tvq92aK/J8rCuGDGzyjBniQIF9BfanNGBdJjxoMduc9Uu1lS3Gn 5Rh7ETWBMxmOj0zlFdQ0rTjrwt2l1HSumZHqmVCn4GdiU252wgx9hiJoydsQuyJWRXn9 1vJ1eNo51plBsAY7/0I/Q78v2AEV1RcVEFgKm94rMoaJGaiuPYgPwmjXv8zUrUZdUDe0 3yX7QmpfAVDkFM06BhWgIxU0iCcvCURGsWD1t2FvqeI1To6kqOMzmEoymHfObmLxoaki awPTCFZERkgSZkgVdyT/h6XcZzes8NDMY8LvqHVKtIQ+UuzE4yrvg/PNzgqwOpSMmJp3 rFyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572872; x=1791177672; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=VkeT4VEb7dbNZHrc7V8wy1qO12OU0ezx6Qp6yR7AiHI=; b=HDTZld6NhvThVTncaPgwJwptPfAb2YFCfs2T6js19b+yZLY/WMN8tv1ImeRYrgE4Ul Z3sXyKqlo+Ird3MRBQFl3c2q5qTTMrvyv6p5O+Qzf9CX4Z6qKWzjMr+V31+fa3HV3IIi ykNzquOmF8SGEr/G6IaeBP4yLUHzFmcDDXdEoteTkuPP9nBONV02k0YrBm5Ym8V3LUb+ vQYQTDrWXfo2yIdZrN47nPQ8FP2vJZC8K1iEE/aj1PWyGCrBmoicMpwZgZsh764Xa9Xf k58L0qjb893VBg0Yhc/vlY6tnIjyHRicMbzqoB+HWyXBwRf+w2Yd6wls28Wvy6HfN9UD dj9g== X-Gm-Message-State: AFuF++kwPMuStuEbovbpON19DooG7hSfmE/9Ff8wJDpIxcn77QOAJunW AFl1T5Hvfz4FQnk0YnzHtzjBL347vIxd3fVeirJjIucssFWJXzldc+VdAfguFE8EPn4= X-Gm-Gg: AYBFou0AcImmHskdX8n/MhLP7MCZgYm14KyAEoLfirEyEq+5bmaj7KRwq7KgTcIrAfK HqCVa+3/4Uhogi4/l2GRoxAzb7N0TOiXnZ86t7dD+g59paaPewnAFwORc8RVCHrQrrYcgc1U69s sHBs7M32xph8GD3UT46qlJ6kR3+LGAdWmyq7Agk5P6bvPToPWF9z79bpTgK0WZVP9uPsQG26pdM 2D1/b00BNzQTT6gOoSH4wbBxNL78Vh9LF6BG8kSGlFJ4JhShoF9XmYmsmwL+y1LoO9Bx/+ho3cM /f2c5BiV9mL6/VuyDjhD2czX+Yn/MLUA+nHROWAq3muxWtuZ3cmrKcDxtjeopf7CLsj8P7z7BJ6 +QkGS2aHZirUq4hNJwb6L6xIy2uBMEc3qL1SzyL8o6pwtNue1ImDZ1V566In1WAVl4RnjKzfbQx tDZ+nYldUSTaDfDVzO6OWTMuN2FjFvpW2eF/IR2st7fPBH8vjpYW49hGu7VgaajPRfSGzmOJBXO Vzu1z4ULRDTQ8CPCRur7XCtzLr2BIY= X-Received: by 2002:a05:7022:6881:b0:139:b575:d42f with SMTP id a92af1059eb24-146ce39a169mr13894870c88.17.1790572871683; Sun, 27 Sep 2026 22:21:11 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 01/24] accel/tcg: move helper_exit_atomic next to cpu_loop_exit_atomic Date: Mon, 28 Sep 2026 13:20:27 +0800 Message-ID: <20260928052051.251-2-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::d; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x0d.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, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573041670158500 Content-Type: text/plain; charset="utf-8" helper_exit_atomic only forwards to cpu_loop_exit_atomic. Define it in cpu-exec-common.c with that function, and move its DEF_HELPER line to cpu-exec-common.h. That file emits helper_info_exit_atomic. tcg-runtime.c keeps the integer helpers. Signed-off-by: Yonggang Luo --- MAINTAINERS | 1 + accel/tcg/cpu-exec-common.c | 10 ++++++++++ accel/tcg/cpu-exec-common.h | 2 ++ accel/tcg/tcg-runtime.c | 8 -------- accel/tcg/tcg-runtime.h | 2 -- include/exec/helper-gen-common.h | 4 ++++ include/exec/helper-proto-common.h | 4 ++++ 7 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 accel/tcg/cpu-exec-common.h diff --git a/MAINTAINERS b/MAINTAINERS index 1b66c65f689..7fa78a9bd74 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -174,6 +174,7 @@ F: system/watchpoint.c F: page-vary-system.c F: page-vary-common.c F: accel/tcg/ +F: accel/tcg/cpu-exec-common.h F: accel/stubs/tcg-stub.c F: util/cacheflush.c F: scripts/decodetree.py diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index 68077c8fd9d..d20cece1c5f 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -23,8 +23,13 @@ #include "qemu/plugin.h" #include "qemu/main-loop.h" #include "accel/tcg/cpu-loop.h" +#include "exec/helper-proto-common.h" #include "internal-common.h" =20 +#define HELPER_H "accel/tcg/cpu-exec-common.h" +#include "exec/helper-info.c.inc" +#undef HELPER_H + bool tcg_allowed; =20 /* @@ -120,3 +125,8 @@ void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc) cpu->exception_index =3D EXCP_ATOMIC; cpu_loop_exit_restore(cpu, pc); } + +void HELPER(exit_atomic)(CPUArchState *env) +{ + cpu_loop_exit_atomic(env_cpu(env), GETPC()); +} diff --git a/accel/tcg/cpu-exec-common.h b/accel/tcg/cpu-exec-common.h new file mode 100644 index 00000000000..19359a97bae --- /dev/null +++ b/accel/tcg/cpu-exec-common.h @@ -0,0 +1,2 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +DEF_HELPER_FLAGS_1(exit_atomic, TCG_CALL_NO_WG, noreturn, env) diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c index 7c0aab98a80..764c62c684d 100644 --- a/accel/tcg/tcg-runtime.c +++ b/accel/tcg/tcg-runtime.c @@ -23,10 +23,7 @@ */ #include "qemu/osdep.h" #include "qemu/host-utils.h" -#include "exec/cpu-common.h" #include "exec/helper-proto-common.h" -#include "accel/tcg/cpu-loop.h" -#include "accel/tcg/getpc.h" =20 #define HELPER_H "accel/tcg/tcg-runtime.h" #include "exec/helper-info.c.inc" @@ -129,8 +126,3 @@ uint64_t HELPER(ctpop_i64)(uint64_t arg) { return ctpop64(arg); } - -void HELPER(exit_atomic)(CPUArchState *env) -{ - cpu_loop_exit_atomic(env_cpu(env), GETPC()); -} diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h index 0b832176b33..9b4c1c24916 100644 --- a/accel/tcg/tcg-runtime.h +++ b/accel/tcg/tcg-runtime.h @@ -22,8 +22,6 @@ DEF_HELPER_FLAGS_1(ctpop_i64, TCG_CALL_NO_RWG_SE, i64, i6= 4) =20 DEF_HELPER_FLAGS_1(lookup_tb_ptr, TCG_CALL_NO_WG_SE, cptr, env) =20 -DEF_HELPER_FLAGS_1(exit_atomic, TCG_CALL_NO_WG, noreturn, env) - #ifndef IN_HELPER_PROTO /* * Pass calls to memset directly to libc, without a thunk in qemu. diff --git a/include/exec/helper-gen-common.h b/include/exec/helper-gen-com= mon.h index 834590dc4e5..ed5521ad881 100644 --- a/include/exec/helper-gen-common.h +++ b/include/exec/helper-gen-common.h @@ -7,6 +7,10 @@ #ifndef HELPER_GEN_COMMON_H #define HELPER_GEN_COMMON_H =20 +#define HELPER_H "accel/tcg/cpu-exec-common.h" +#include "exec/helper-gen.h.inc" +#undef HELPER_H + #define HELPER_H "accel/tcg/tcg-runtime.h" #include "exec/helper-gen.h.inc" #undef HELPER_H diff --git a/include/exec/helper-proto-common.h b/include/exec/helper-proto= -common.h index 76e6c25becb..28afa7782d0 100644 --- a/include/exec/helper-proto-common.h +++ b/include/exec/helper-proto-common.h @@ -9,6 +9,10 @@ =20 #include "qemu/atomic128.h" /* for HAVE_CMPXCHG128 */ =20 +#define HELPER_H "accel/tcg/cpu-exec-common.h" +#include "exec/helper-proto.h.inc" +#undef HELPER_H + #define HELPER_H "accel/tcg/tcg-runtime.h" #include "exec/helper-proto.h.inc" #undef HELPER_H --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790572905; cv=none; d=zohomail.com; s=zohoarc; b=DGQHmdOlgdjuP18m9FeZW/QlNN0ztfI49eoOdMnZBifD+eNQGN2raI0mfYDsL16Xac2kAh0LmfnkSvLGri9eGmudQb9ymQqBHmIBIIvIdBE0hAN9Lit/W2I/fQPSxLhStB9w8SyF1Z8bDfbetvlndS1xI9/YLQj6YbksFkCwwsM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790572905; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Q9Wafx0aXX2Ni1bBJzRLIBOxNOLdNJdd9ggXabMSVEY=; b=M3Px77zUhIfeF8Z+bNmiwn6x3gy3iYa/xUp6TdyZqTF535wENyby5NqaD5zt9if9QonE0smbc8a3+69k+IdljrCKUga/eO9coAAv24DOm+Gb1vft/ONfZx2xlPOfqRyL0mbmx3fPpgEoLCqbjBSOaxI2Cwtyqi6xHazp/IiIjrs= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790572905134836.0621569189625; Sun, 27 Sep 2026 22:21:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3o2-0003OD-Dd; Mon, 28 Sep 2026 01:21:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3nn-0003KJ-KT for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:21:26 -0400 Received: from mail-dl2-x10.google.com ([2607:f8b0:4864:38::10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3nk-0007ls-Vb for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:21:23 -0400 Received: by mail-dl2-x10.google.com with SMTP id a92af1059eb24-142dd04f7f2so1565937c88.0 for ; Sun, 27 Sep 2026 22:21:20 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.21.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:21:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572880; x=1791177680; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Q9Wafx0aXX2Ni1bBJzRLIBOxNOLdNJdd9ggXabMSVEY=; b=BnV6i6kFt8Y+JqHVKVHuMvivV4ql/mOt78oHBBtf3DNHyGfbm8UoTjoTd8MYIU4wuF PLs5kI6BTnEGKgK+9uuqzu5El39S5OUUw2C4VYYipTEpvaWnk8svqnS+UvFXXB8TTldB +2k7H07vkixAlSemFjmRSt+gxgh+QoCmHuNWyLIr5HpneghpJ4kPWYkEq7nHxXo4xxOX J4Fk3Ly47pG5Vd/AgoDDgtC9ePWNSiGsTjQoYiABQSSXmIfkpngno0foMLi5comdOofl dzqeKdvcPg3H4koo21L8U6AaQbLkuf44zdkNJVQuPe4nRhNsRjVmn715CcALCh704+8u 6GXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572880; x=1791177680; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Q9Wafx0aXX2Ni1bBJzRLIBOxNOLdNJdd9ggXabMSVEY=; b=WLSoIt0K00hLu2kzEIwaRpLoJz3wfUS1l/6G/GeVXO/EzOMg2wBJvGlTpY9S4Ye5v0 dV6AyFc8x2DvfD6x+GzrOyHnzlrG5CTnmJFV7pfgkCMHr8A1RrfjFFDVg9LPpLr1O4tb wB2DaNhHdfywUHTO+HkqpQ/Gr8csE551wOlHiaHE+7W8Dy5FCi8NPNP7hXFK5CUIgSyu z4TE1xIOn3hu10s2atCeekMBBKwNAe8GaUObdvvcdmIjpo0lzS6QY9D8gXOcfbsw23tG xhrBDoSjZS3XQXVL3HnNRo4z5t1U1m7bbl1rCFfnwNT05b96QioCsDLHkVtuuz9yR+LU tkfw== X-Gm-Message-State: AFuF++kiC3KbVFzQu9t/nkVlpQReyFXuD/LafDfrGGz4YTX4jNwbx/Fh 5oskivO33apuGmR3NylPk/dEW9nMtcx673HlW8JY5H7W97gId0kuPNLPUZkkblpspDE= X-Gm-Gg: AYBFou0hXSGNVbys+Z29UM7Vr2OaRVQIuTNPt8QVBBezWgyLYqDBWQtMDmD8o1+n5H9 glKOl9jwydOdSqrECNY+nopv9r2d4abdW61uFyMy6//LlKWwRYAb1RgYyO0QSwuYRI5pK7tCgGM e7AXMcwt2W0HQyTAYVD9JpGNRNEjiIV8U3ZU+jTzz/2wgzms08KVzQAftvBixmOKtQQDVDty/os e6XRUTk2mx8JOMC1Rfn0z3DoI337dKZkcG5bVswvkYmQ59euhEV9DZAlLHSpdnLl8YFbgA9VgU1 15EDALblAyga3/JjmOi8Y1WuVFF2OQejqDwzixYi7U8XtN0FYB1RdygG3LWqWbaKOA/Xw6Vp7Su InYyW/OtVh9c5ZClxZnqcnK76AroK2IansRSZD+7dyP+wsVJRGP/jWdZOjKXVR7q2tbmseqhqdT gln6VLU+riB2IhQLzFUViDCIPKHQ/n99hqJkxixnb83689tloB7A88Gh2RQupJLMPVPIUhQNYkv 7zMiF3LGWMVKbLYI+CtWS5gUvWRWeE= X-Received: by 2002:a05:7022:1588:b0:147:5149:d108 with SMTP id a92af1059eb24-1475149db52mr8939208c88.43.1790572879456; Sun, 27 Sep 2026 22:21:19 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 02/24] accel/tcg: add cpu_loop_exit_excp Date: Mon, 28 Sep 2026 13:20:28 +0800 Message-ID: <20260928052051.251-3-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::10; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x10.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, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790572907570158500 Content-Type: text/plain; charset="utf-8" Add cpu_loop_exit_excp next to cpu_loop_exit_restore. Set cpu->exception_index, then restore and exit the current TB the same way as cpu_loop_exit_restore. Signed-off-by: Yonggang Luo --- accel/tcg/cpu-exec-common.c | 6 ++++++ include/accel/tcg/cpu-loop.h | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index d20cece1c5f..31fed8e497f 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -118,6 +118,12 @@ void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc) cpu_loop_exit(cpu); } =20 +void cpu_loop_exit_excp(CPUState *cpu, int exception_index, uintptr_t pc) +{ + cpu->exception_index =3D exception_index; + cpu_loop_exit_restore(cpu, pc); +} + void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc) { /* Prevent looping if already executing in a serial context. */ diff --git a/include/accel/tcg/cpu-loop.h b/include/accel/tcg/cpu-loop.h index f4d38bc2bca..856091020f2 100644 --- a/include/accel/tcg/cpu-loop.h +++ b/include/accel/tcg/cpu-loop.h @@ -65,6 +65,18 @@ G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu); G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t host_pc); G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t host_pc); =20 +/** + * cpu_loop_exit_excp: + * @cpu: the cpu context + * @exception_index: EXCP_* or target trap number + * @host_pc: the host pc within the translation + * + * Set cpu->exception_index and exit the current TB, restoring + * guest state from @host_pc the same way as cpu_loop_exit_restore. + */ +G_NORETURN void cpu_loop_exit_excp(CPUState *cpu, int exception_index, + uintptr_t host_pc); + /** * cpu_loop_exit: * @cpu: the cpu context --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790572935; cv=none; d=zohomail.com; s=zohoarc; b=ejU2GKPhRHofs4g7E93W/MBZO782NmOmlpt11pTdQ78O7gVHCp2y6sSZpAVCZHGFBBDkmMI+OadGqJwDkfwfcvVjDHprj8cvGBMipjzYINY/ZXJdysuzjuL/NcPIoqEwBtjrg2zCdYXMkZzGI60UqIlC5xKLquCXwjZr5mFLiaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790572935; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=E/2Qp3nCn4UZKuGzVzJjcMz1KmS7snLXtD06CwxIVUc=; b=S/bxBD5kHDCYG6gJ2EHnpryhD5Pget9saJRNtic5E3fn2hLsWBmylVhIP34h3Vc7+mJwzDI5lhLUWRKJBe1LzlckrJspE1uc04cjX5sgb3zb6XdQTiz3TZuv10vpzhewRk9mM97ZnYDYEk81Igh9AUR0CYZukvYIm/mK6UG3sqM= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790572935939677.1568629236384; Sun, 27 Sep 2026 22:22:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3o6-0003RP-6N; Mon, 28 Sep 2026 01:21:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3nu-0003LH-4z for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:21:30 -0400 Received: from mail-dl2-x0f.google.com ([2607:f8b0:4864:38::f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3ns-0007mf-Le for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:21:29 -0400 Received: by mail-dl2-x0f.google.com with SMTP id a92af1059eb24-1438e88300cso2224653c88.0 for ; Sun, 27 Sep 2026 22:21:28 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.21.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572887; x=1791177687; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=E/2Qp3nCn4UZKuGzVzJjcMz1KmS7snLXtD06CwxIVUc=; b=CgJj+hy+NEc8JIgWgQZ/+dy0+3Bpth85UMd3EqGU+RUNAJUt4Cs4OvoMhTKB+jVOgt IAik/bCgfOvTl7YgJ2ECuDN9J5CAyNu6/2t7W1r/v7a79YF9S1S5H+0nglcgJZjhMCMu XsBwx4PH/B3UYp/HGSv/42KepKovy+jTqw4gUUsnWDxGb+N2aY+r5elv5i7fESFt+Qmy 1goKcscvWd+zh8OC3df7kcEll/gV1NQbrNxykFgt1AaaUa4FhsO5EB8jzimeshcLxkpj gnPnFIaaJMUZAgoVsPRrH6f6js+YhDgL+5lInTXcMk/TrsM+PWZFdvM4IiBLS7hYZWIl giPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572887; x=1791177687; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=E/2Qp3nCn4UZKuGzVzJjcMz1KmS7snLXtD06CwxIVUc=; b=mzcZbGDNFyYn8g5Uy+/aXxfrIndTPUYlMXYbcRmGS2qyg57nqmONz8oEUH5gubJdEm bes/90TjdKyGSdG3JV9cAnMl2dopCFUrh5HZZbV78EntaNWz6Zy0D04htFoG2hXeUSTz sau4ohCx50rMtZEELCfpe9X5EDct5QnCcO2a3VEgOwsuly0+wpHHyI58QLc1VghJxL63 4WW3FRDgiwc72RoWka9Imga+1NKzE2rYlLwQG/JIEq+zSjPMMlwnPCu0S0Q9jjbuhR9D 3Cf4WEBqJhUzifZToQl+qC9phXaKBfCO0PLTWNkFpIPvaF9D3u0rjasJDceTdXaXcRRd 5yow== X-Gm-Message-State: AFuF++llgZPo558Nb3YrpnMwZcXJhIqNeRrt+mggExqLxzatZ5qBL/Zp x9pMX/uLEN6WKx4tgBbPTAuOzhIPAnDN4fchXIlCKiFCye+3GASKc/XSAZ6J9E3glXY= X-Gm-Gg: AYBFou2VTDpeSN3XcdnwAzT1kCkiLt+SQAYWWDfJEIuetqG5Fqz8T4IabsSDWjS3SlH Zfumj8HlN8p+sf5UUA3pqYXiWLYSQYTEtMf5xsJWW/wFBiGMOvHRqbSGVtXHQlGGQyOnSa4QNDX 7MKYK6yVy263WloKyIucq9WKXEvNsHLWHrzKp4QSEuQGo9B7KR/wFiu0I3ag2a+mM6AVEywVSn4 XIfKlNw2HNEfFBwJ+x6WhVJAjgj0cPxJ0Eb67OwzXAmFmIWlkXhqW4ng3Ni+xlLS/2yYIbiEIUQ gpsiT4+ZLqvxmqfPQaoWC/NoLNCkVwjQn8nK3NonPXXRFiBauFYnCLOGfq4ruyDajxd/0NiDAAw PTLQrE2IBWuDPOuhHfLGb7xy54UsbAlte8KHUEE+K3bcKH9fH8LL7ja0uJ2o2+/93ajkQzdqZYS nczX8VHJVVRcHeYGZu+RjT9gDQm5grBxoR6yNp4KwSmothhfcB3QXMKomlWmaNBSgDnZewFr886 PG7IqoAHN7P5cvT+GRWaAnabJr1lE4= X-Received: by 2002:a05:701b:2086:10b0:144:eaa7:2763 with SMTP id a92af1059eb24-146ce492bfamr8820295c88.16.1790572887188; Sun, 27 Sep 2026 22:21:27 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 03/24] accel/tcg: add raise_excp and raise_excp_restore helpers Date: Mon, 28 Sep 2026 13:20:29 +0800 Message-ID: <20260928052051.251-4-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::f; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x0f.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790572937419158500 Content-Type: text/plain; charset="utf-8" Add two TCG helpers next to cpu_loop_exit_excp. raise_excp exits with host_pc 0. raise_excp_restore exits with GETPC(). Declare both with DEF_HELPER in cpu-exec-common.h. Signed-off-by: Yonggang Luo --- accel/tcg/cpu-exec-common.c | 12 ++++++++++++ accel/tcg/cpu-exec-common.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index 31fed8e497f..d6277b7d917 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -124,6 +124,18 @@ void cpu_loop_exit_excp(CPUState *cpu, int exception_i= ndex, uintptr_t pc) cpu_loop_exit_restore(cpu, pc); } =20 +/* Raise exception and exit the TB without restoring guest state. */ +void HELPER(raise_excp)(CPUArchState *env, uint32_t exception) +{ + cpu_loop_exit_excp(env_cpu(env), exception, 0); +} + +/* Raise exception and exit the TB, restoring state from GETPC(). */ +void HELPER(raise_excp_restore)(CPUArchState *env, uint32_t exception) +{ + cpu_loop_exit_excp(env_cpu(env), exception, GETPC()); +} + void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc) { /* Prevent looping if already executing in a serial context. */ diff --git a/accel/tcg/cpu-exec-common.h b/accel/tcg/cpu-exec-common.h index 19359a97bae..1e82f3b14d3 100644 --- a/accel/tcg/cpu-exec-common.h +++ b/accel/tcg/cpu-exec-common.h @@ -1,2 +1,4 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ DEF_HELPER_FLAGS_1(exit_atomic, TCG_CALL_NO_WG, noreturn, env) +DEF_HELPER_FLAGS_2(raise_excp, TCG_CALL_NO_WG, noreturn, env, i32) +DEF_HELPER_FLAGS_2(raise_excp_restore, TCG_CALL_NO_WG, noreturn, env, i32) --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573078; cv=none; d=zohomail.com; s=zohoarc; b=hoyCxlkqrg4q/BtYi1X9TByi4e4ksb78dQaxFB4LaJ95Aksdf+yyOEBd5hnPeMsLLkxrXc6dBikmjXATkyL3ApNMcoV3RmA0UVTUxd9ORNczDW4jtkxXd9ZPlkQQWgJh3BGnDW4CTdiM96hTBK9K7TiA/mmLw5+OkwWCVqvsn3c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573078; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=73rQMz/FeeOV5ziS5/l0PWsSUPqi0F5RY6316YoaJz4=; b=iCnyK1XM3BB6nDdy1KMHk0QE6r4FujwEenUjR82tqMTnljkxsFyRIPmxeEunFgeYMLJQRpQ6R0yvQChPirlJDoZhP/Tfd57uqO6xOeAgoukr9lCm5gPQX36Yt8JNoJ//EhsZzQN4CE4dBKrY473GT0+AC806xGW56/QA+HScGpw= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573078456917.8429521409809; Sun, 27 Sep 2026 22:24:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3o6-0003RY-EK; Mon, 28 Sep 2026 01:21:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3o3-0003P5-Sz for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:21:39 -0400 Received: from mail-dl2-x0f.google.com ([2607:f8b0:4864:38::f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3o1-0007o6-AZ for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:21:39 -0400 Received: by mail-dl2-x0f.google.com with SMTP id a92af1059eb24-144f7915355so2184871c88.3 for ; Sun, 27 Sep 2026 22:21:36 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.21.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:21:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572895; x=1791177695; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=73rQMz/FeeOV5ziS5/l0PWsSUPqi0F5RY6316YoaJz4=; b=XTRyUEZtJkkFGHJJWQxBZCEPMBo9W9naAdkz4onDQoaQkGPO7Yvf9XdOXCUHMx23f6 hB53moVK1gZM2pj/QzUg8AbtZgfYSvKa3bi71BvqB2wJwKFbCrvLEFIZ5rXdJGfZZ24f i/EP9IKMUagKvO98DnTt+EmTxSNmVInB4dQJDJtA+i2kTa5YjVWcZP8CJFoLd2tgHOzs AJbTwH2N8MRkOByUdjhOxU6z1mnaE0b/DS1q9/A2Q7qFO2h8avuhj2YBab9t3SzYJxtG j19/OxK49KlDPSKPZBisZjCsslmO19a9shwjGBCZW/rcbPXDADgZ/cjSPNtg3UhLPdkL WgEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572895; x=1791177695; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=73rQMz/FeeOV5ziS5/l0PWsSUPqi0F5RY6316YoaJz4=; b=QXgtwRxquz2Kd5REO7Q7WmlHmG+fb+9ekHEjMCyM6gNU3GJ23Naztvqv9HJ+qaeiVL tGlt4SImpR+5vzOxsqQJQ/kFeTsS6oNeoiPxxJQWPGMULZt5TfL0VNzUNf4mMp15aBqg SzRav4cPlC8jvhPJCI6cPwztum7iDnqNBOEHhGXGusYHRNCYyQiqX2xu2dVBVAIMSVgU YlCED5renR8DNS4iY6akOabjQ66vVpLyyAo/WlRPe/qnisMEs97xJrv396VH+IH0H6QQ g0GY5uKWq5Nbc2XqsPEaty14CRWaqQcn6F93T6LCkjlKuaPTTX3h+YgNWqoGKGeXuavS X0EA== X-Gm-Message-State: AFuF++lwLRuPhZcbS4VZ1H/qGvlSG6BhDw4KfoBWWC6bLdEcLwicPmq5 RmgiIEvrk/8bOC/pbXbz6nSuteP600SD9S0w5B523DDSOcuXOKoxsWfR2EhOxW2DxBM= X-Gm-Gg: AYBFou3/l78YDRJXntLHEgQ6LtOwhugeSIiKzppIAGIy7rnhpmJs74zY7IhE3EvKzeA ECiZMXKP53tnxnaJr/+EHpoEcvU2fsodJXNzXa8g6CKIkwEq6e6mV3PaMji+RbpJDmRRxSMr3/C lP0nwNB1UTKIe+J/D1ULnoW92Pr6P/3kSRUhUKo3E3v++Uby6aoTBOu5M05IRVYNQhQXIbaj7gb 0SyNHKk6aQWgfQQsHucA170E5ZOp+T89lGetSq+RM5mowaBy0WwL/z6cZMGtw0YrURf/kXxqCUU bbDGNysBqXsc2BZrBDDHWcq7FXerX/ISnImoLhEHPqdmLyfurk2LC12ldY5Mw8AC5OAtxIDOK1m ymuFbQ2Op0+LvhLNvOuLzJzpwGl2TmTusPh+4er9yfByovFmMacFS684PUahrlXm5zTMcm5OShf +n8KoSLlcWG3WMPOZ8AcuhyXjfeqA/DVjcH1qbODpGFXzZDgj6mwgl4Q6MyhTBuXsFoMNPW+/tf Al3tdEW5Hytm4s2gVfzwVHZswPyxvk= X-Received: by 2002:a05:7022:f515:b0:143:26cf:8615 with SMTP id a92af1059eb24-146cfec8423mr8557002c88.25.1790572894929; Sun, 27 Sep 2026 22:21:34 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 04/24] target/rx: name guest trap numbers RX_EXCP_* Date: Mon, 28 Sep 2026 13:20:30 +0800 Message-ID: <20260928052051.251-5-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::f; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x0f.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573079736158500 Content-Type: text/plain; charset="utf-8" Add RX_EXCP_* in cpu.h for the guest trap numbers stored in cs->exception_index. Signed-off-by: Yonggang Luo --- target/rx/cpu.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/target/rx/cpu.h b/target/rx/cpu.h index 64ba48a7329..521e494172e 100644 --- a/target/rx/cpu.h +++ b/target/rx/cpu.h @@ -71,6 +71,16 @@ enum { NUM_REGS =3D 16, }; =20 +/* Guest trap numbers. */ +enum { + RX_EXCP_PRIVILEGE_VIOLATION =3D 20, + RX_EXCP_ACCESS =3D 21, + RX_EXCP_ILLEGAL_INSTRUCTION =3D 23, + RX_EXCP_FPU =3D 25, + RX_EXCP_NMI =3D 30, + RX_EXCP_INT =3D 0x100, +}; + typedef struct CPUArchState { /* CPU registers */ uint32_t regs[NUM_REGS]; /* general registers */ --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790572971; cv=none; d=zohomail.com; s=zohoarc; b=VKkQteC1Hcepc9p0fHCEVc2qrd58xxQ+HB1zfcBlfpeiuaWCSIoBg33bf2WlJ4xd/VdHqMn8bPHqbYcCqR2Xce0VoSNRlUpmS5jXubZhw2w3UNxL0iIahjeen/ljPdxkgsjPEjrKll69VVZLEN7IHmTdtLyBFd/SymQfZw7OioQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790572971; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DgWmlss43hYhAX+MCcVQvB7s8zaZj6PJ12LbT80sSKA=; b=TJ+Lhr+Cvj/tPG7WDSiFhxky0c70jY93NZ+0ZxatlLkQM4MjH3TRfUJnDZPxqIHiVDqJOHmS822ujCh1d4zCdtePe1g6eNRqZ10w64Ut/IeuhnzqwJXl9BN9womF7pwpWoHlj95n9DRLdKXF485tpYFFiKuGdfXMF2fSZwjgcgQ= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179057297105829.318227139314445; Sun, 27 Sep 2026 22:22:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3oC-0003bL-Tb; Mon, 28 Sep 2026 01:21:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3oB-0003ZV-F9 for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:21:47 -0400 Received: from mail-dl2-x10.google.com ([2607:f8b0:4864:38::10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3o8-0007ox-1O for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:21:47 -0400 Received: by mail-dl2-x10.google.com with SMTP id a92af1059eb24-142dd04edb5so4395506c88.2 for ; Sun, 27 Sep 2026 22:21:43 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.21.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:21:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572903; x=1791177703; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=DgWmlss43hYhAX+MCcVQvB7s8zaZj6PJ12LbT80sSKA=; b=iFmxfMH+jupD1tVnQQTH+iM+7t+KiK4MCxqB9ja2jIgvIZFgyf+BxTytlPu8UT+D/E avl2yw3bJc0rExzoy1R9gABc+T+de1Hye2pWBYLYvjFvhIDTXPqiBjRMyrsbZnwmjuBq WFRG6Z1MobdAwMMMhd7sFA1g25fcZxWpUPayoi99Iqxqu8R2HzAeRFR0AtRW/zdYEbi+ mdvvhFb/2+MSTCtBT70GsTb2Oq9MwaoJIaCCYpz+4wabeYl8HDuKn5MAtJf7lhrofQiz T69oG04WfQ8Djlh8j+T6yiJZAetlrZSu8AlPGVyC6qZxjdfXuR7KZx49xdptJi/ouFLO S3aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572903; x=1791177703; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=DgWmlss43hYhAX+MCcVQvB7s8zaZj6PJ12LbT80sSKA=; b=CTcvzWyKDztiFSvzpZ97hyTKQUnVm9xkU/RoPhBGl6tD6fCYaaf40My78DrdOs5p4I 5YU84Q4hXrC7ay8HDW1FtXBp4c49Uk68iQbexoUBQWzcFCwmJrlCq3MNwU7c6nmwsFqh fSSRB1XXCCMtVj4xwdzf+9XKndhbHBNqaG7ZcZhMfV2ZuHAqGS6P2XWaCnIC5OPFWpI1 oePwjABY21it8X7BGmv7+auqjBmUJyHBhN/4N5zxiC/082Gv7lfPfF/TcKwmoKEnkk1b 3hEw+baOh5gzgNbwRHRaKvfSlsU+OhR7zyO/6Xd10IlN94umQskRq4OvmnUzs9o278KX 69kA== X-Gm-Message-State: AFuF++laW9oL/caVrjH9fJZvQQ+ch9m3nere6fB4yfs3SjEvL5U/DZ+o LthsIS4ozIB0h1rtZGl4lC/UBnNl5YO6XFYQOYG07+lF0ssYVJImukXQZoOAvmJwrkU= X-Gm-Gg: AYBFou1138OON0arfL7yOlPnhEgouzM96ZFiuKeJXclA3IjqqwL1f5rP2rfXL8VCRvu XhF4OBxEsdPnPV1D11kBhgJaJ3hiA8f3MdbBDf518/SNJqC2tS0c6+t9/O8hWGJwt6R0MZvG5ex ERu7IarTyNEbFizH6znjbLpbR4i2lf8q/vVrB2MA1AnLs0GhK0lbxl2i906lJqSBhEOO/ManF4w HrWXYS9jhLwxV+m4YlhoQIoQ9Rsmvh2uRd5IcBAz8i2KefIIQ/aA6D9XjKdgS5PtWEhhmJNYGm7 ak3GsKfT3csoLIR1HkjNHZlhUNU2+4Iwjw8BjtLnhCEDt5U0Rs2HE70fsSFMysU2rBCGuWHy6vM HC3M3UK+Zu6N8iR8325dQBVhXjCRVz/ia3vs7QEUrJC9wWdP9WfRCKv9CPf+XAq6GZh5CQ8+Mkd cxPisjr1QzExv0MLrG01m0DI0ToK2WiezlYjh0V2aQjRmiTzNYQ+v7JNFqqnZWKTO9mQbY6dTRz qGb3qdLZa7HUEnzLai2WIQ7BTsuXHM= X-Received: by 2002:a05:701b:21c5:b0:144:e0cd:76ad with SMTP id a92af1059eb24-146d06820d9mr8413866c88.36.1790572902572; Sun, 27 Sep 2026 22:21:42 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 05/24] target/rx: convert raises to raise_excp Date: Mon, 28 Sep 2026 13:20:31 +0800 Message-ID: <20260928052051.251-6-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::10; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x10.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, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790572973386158500 Content-Type: text/plain; charset="utf-8" Translate privilege and illegal through raise_excp_restore, and BRK and INT through raise_excp. Drop unused raise_access_fault and the one-line raise_exception wrapper. FPSW still exits with RX_EXCP_ACCESS. Signed-off-by: Yonggang Luo --- target/rx/helper.c | 16 ++++++++-------- target/rx/helper.h | 5 ----- target/rx/op_helper.c | 44 ++----------------------------------------- target/rx/translate.c | 13 ++++++------- 4 files changed, 16 insertions(+), 62 deletions(-) diff --git a/target/rx/helper.c b/target/rx/helper.c index 0f99279bbaa..2ebda733489 100644 --- a/target/rx/helper.c +++ b/target/rx/helper.c @@ -86,13 +86,13 @@ void rx_cpu_do_interrupt(CPUState *cs) env->isp -=3D 4; cpu_stl_le_data(env, env->isp, env->pc); =20 - if (vec < 0x100) { + if (vec < RX_EXCP_INT) { env->pc =3D cpu_ldl_le_data(env, 0xffffff80 + vec * 4); } else { env->pc =3D cpu_ldl_le_data(env, env->intb + (vec & 0xff) * 4); } =20 - if (vec =3D=3D 30) { + if (vec =3D=3D RX_EXCP_NMI) { /* Non-maskable interrupt */ qemu_plugin_vcpu_interrupt_cb(cs, last_pc); } else { @@ -100,22 +100,22 @@ void rx_cpu_do_interrupt(CPUState *cs) } =20 switch (vec) { - case 20: + case RX_EXCP_PRIVILEGE_VIOLATION: expname =3D "privilege violation"; break; - case 21: + case RX_EXCP_ACCESS: expname =3D "access exception"; break; - case 23: + case RX_EXCP_ILLEGAL_INSTRUCTION: expname =3D "illegal instruction"; break; - case 25: + case RX_EXCP_FPU: expname =3D "fpu exception"; break; - case 30: + case RX_EXCP_NMI: expname =3D "non-maskable interrupt"; break; - case 0x100 ... 0x1ff: + case RX_EXCP_INT ... RX_EXCP_INT + 0xff: expname =3D "unconditional trap"; } qemu_log_mask(CPU_LOG_INT, "exception 0x%02x [%s] raised\n", diff --git a/target/rx/helper.h b/target/rx/helper.h index 8cc38b0cb71..c6a85e968d9 100644 --- a/target/rx/helper.h +++ b/target/rx/helper.h @@ -1,9 +1,4 @@ -DEF_HELPER_1(raise_illegal_instruction, noreturn, env) -DEF_HELPER_1(raise_access_fault, noreturn, env) -DEF_HELPER_1(raise_privilege_violation, noreturn, env) DEF_HELPER_1(wait, noreturn, env) -DEF_HELPER_2(rxint, noreturn, env, i32) -DEF_HELPER_1(rxbrk, noreturn, env) DEF_HELPER_3(fadd, f32, env, f32, f32) DEF_HELPER_3(fsub, f32, env, f32, f32) DEF_HELPER_3(fmul, f32, env, f32, f32) diff --git a/target/rx/op_helper.c b/target/rx/op_helper.c index 36df7d377e5..f73aeae6326 100644 --- a/target/rx/op_helper.c +++ b/target/rx/op_helper.c @@ -25,10 +25,6 @@ #include "fpu/softfloat.h" #include "tcg/debug-assert.h" =20 -static inline G_NORETURN -void raise_exception(CPURXState *env, int index, - uintptr_t retaddr); - static void _set_psw(CPURXState *env, uint32_t psw, uint32_t rte) { uint32_t prev_u; @@ -115,7 +111,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); + cpu_loop_exit_excp(env_cpu(env), RX_EXCP_ACCESS, retaddr); } } } @@ -419,32 +415,6 @@ uint32_t helper_divu(CPURXState *env, uint32_t num, ui= nt32_t den) return ret; } =20 -/* exception */ -static inline G_NORETURN -void raise_exception(CPURXState *env, int index, - uintptr_t retaddr) -{ - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D index; - cpu_loop_exit_restore(cs, retaddr); -} - -G_NORETURN void helper_raise_privilege_violation(CPURXState *env) -{ - raise_exception(env, 20, GETPC()); -} - -G_NORETURN void helper_raise_access_fault(CPURXState *env) -{ - raise_exception(env, 21, GETPC()); -} - -G_NORETURN void helper_raise_illegal_instruction(CPURXState *env) -{ - raise_exception(env, 23, GETPC()); -} - G_NORETURN void helper_wait(CPURXState *env) { CPUState *cs =3D env_cpu(env); @@ -452,15 +422,5 @@ G_NORETURN void helper_wait(CPURXState *env) cs->halted =3D 1; env->in_sleep =3D 1; env->psw_i =3D 1; - raise_exception(env, EXCP_HLT, 0); -} - -G_NORETURN void helper_rxint(CPURXState *env, uint32_t vec) -{ - raise_exception(env, 0x100 + vec, 0); -} - -G_NORETURN void helper_rxbrk(CPURXState *env) -{ - raise_exception(env, 0x100, 0); + cpu_loop_exit_excp(cs, EXCP_HLT, 0); } diff --git a/target/rx/translate.c b/target/rx/translate.c index 132d495710c..43efdb6af0e 100644 --- a/target/rx/translate.c +++ b/target/rx/translate.c @@ -245,7 +245,8 @@ static int is_privileged(DisasContext *ctx, int is_exce= ption) { if (FIELD_EX32(ctx->tb_flags, PSW, PM)) { if (is_exception) { - gen_helper_raise_privilege_violation(tcg_env); + gen_helper_raise_excp_restore( + tcg_env, tcg_constant_i32(RX_EXCP_PRIVILEGE_VIOLATION)); } return 0; } else { @@ -2174,7 +2175,7 @@ static bool trans_RTE(DisasContext *ctx, arg_RTE *a) static bool trans_BRK(DisasContext *ctx, arg_BRK *a) { tcg_gen_movi_i32(cpu_pc, ctx->base.pc_next); - gen_helper_rxbrk(tcg_env); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(RX_EXCP_INT)); ctx->base.is_jmp =3D DISAS_NORETURN; return true; } @@ -2182,12 +2183,9 @@ static bool trans_BRK(DisasContext *ctx, arg_BRK *a) /* int #imm */ static bool trans_INT(DisasContext *ctx, arg_INT *a) { - TCGv_i32 vec; - tcg_debug_assert(a->imm < 0x100); - vec =3D tcg_constant_i32(a->imm); tcg_gen_movi_i32(cpu_pc, ctx->base.pc_next); - gen_helper_rxint(tcg_env, vec); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(RX_EXCP_INT + a->imm)); ctx->base.is_jmp =3D DISAS_NORETURN; return true; } @@ -2228,7 +2226,8 @@ static void rx_tr_translate_insn(DisasContextBase *dc= base, CPUState *cs) ctx->pc =3D ctx->base.pc_next; insn =3D decode_load(ctx); if (!decode(ctx, insn)) { - gen_helper_raise_illegal_instruction(tcg_env); + gen_helper_raise_excp_restore( + tcg_env, tcg_constant_i32(RX_EXCP_ILLEGAL_INSTRUCTION)); } } =20 --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573021; cv=none; d=zohomail.com; s=zohoarc; b=fJ38oDJcaCUEJxdttCMz8GgjiUsG0uf/0atlL1/VzNE83shoH/m3xAI+wU01Z9xBwDFU7VUaqZ7DhbibtT0lo8lc2sGYn3RdaxWopkDxWXe9xnom3w8K4IlNrlyMePL4nf9S3T9xKZkp3dYjU0GTwAdOYjT/yAejRnywpJaHepk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573021; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wGGpYIGUwqf5eEqjLL692CNUimMFgXlpwa4vAy3AFKs=; b=M7xC8ZkqYbV2nPPCzx0wDpTuzKor83lFGFb3dbKAiwolxO2nK/7tHF9RqYQYnxarNWZ3YxUEZDofkQ6DBUma0CqAWjiayBdqaSNcEMqZtc0l/tJnglwt4PrzpWopj1UZ3kcNlPYR+4VwZIAuN51nT+0rHnexFc0FFC9SDhxoNxs= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179057302143845.91057789237743; Sun, 27 Sep 2026 22:23:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3oK-0003iU-CN; Mon, 28 Sep 2026 01:21:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3oH-0003fP-FS for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:21:53 -0400 Received: from mail-dl2-x10.google.com ([2607:f8b0:4864:38::10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3oF-0007sT-Qw for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:21:53 -0400 Received: by mail-dl2-x10.google.com with SMTP id a92af1059eb24-142dd04edb5so4395686c88.2 for ; Sun, 27 Sep 2026 22:21:51 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.21.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:21:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572910; x=1791177710; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=wGGpYIGUwqf5eEqjLL692CNUimMFgXlpwa4vAy3AFKs=; b=f1qDJ6sDvT6RCiFBNKzW1gj+wAqdDr9eZFb8wUVkY38cOguf6fxZXPtGhpinKQNlC6 yxsmYEUOrzDhSIlCSiLzdxL/5TRBERn0T8YOUPW7BfoHXwolulyYYe7AtJ95Cl950Yo6 z0tQPmxwBsP+g9arjHVnZmt8cgqvQmnszhGdttbswGOCfp28GpOFLb8yDT4RBKIAClP1 OBliImBCa99qEMk+N2fP/TILWsvyNxkVomkL3Bvh/5bN89w+ZWM+z3kWe3Y0WqL3s+Hu U7ZgINozF+NLvXju6IRGPuR04FIVNXjhFwlBJVFFXxEOim5faoiF5pU/3jsxqvgv7Qc4 I9pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572910; x=1791177710; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=wGGpYIGUwqf5eEqjLL692CNUimMFgXlpwa4vAy3AFKs=; b=cO8xmychNlUJTju1aEcUk5fV3MuGsvpn1B8A51Vs7HtDXMcQyP29NUGNjzoDhMIIHb G/skyiNsUotIIBOMq5+/bTWJjW5YNhZz+ofD0YZ3lx5taLcWHlCgJ7fj3vfE80t/cdst 8i3ehODYsIPNHMjK+BXBJYa8znZoza2RTL+ySl5mooEQsKImfkjk09VGqdPCB9XFROWT dI1Mnk42M/lFjdhxlCACZHlgeh83xGIV8ir4/rPVreg27w9+1YXhWzq2vpkm+fgGfK1b di/jP39vJzo5yjxKTT3WaJF7DUGOPGZZkPWGyaK2ex4tfzSJaADEtOYuL5WgUk/iFPib xUaA== X-Gm-Message-State: AFuF++nunzNIOyct8Z4+ZZNKSPZ82xnYXf+IbStDQOc4WjccGGcXq159 H1Ni4uittw08NQF8JK8FwUTW015iXeO8rFSYUonIHX5ShgR4DGv/jtGgAUcZxIKjEWU= X-Gm-Gg: AYBFou2lvNkB7WRckEfR0u5j9Bn49ZdDoSOUZLMH/ZDEPeH36gtaNi9x+/vc4JU+mTh /mekpRsP6jN2eq/h+XSMdGDXxyA2hdyX5kZyVmXEsS9QSkw0ZYVvvXuADycjdMNeeB2EB+Zx4w9 UEiCuaqOfjYnBxW2kh2slWFba1HjPSuEgbiyCKznzJBmPK+RNNlLnVkiMMafSrRvcp6PsKgJKMS t2/D4KJmLwGRCjcOwGIXCATGQ2atWuPco7V6j4On57OiXMwasPQRhHzIS7u29CXw222Ln4dv2pb Sb7fB3VqAP2jh4FL19Vjn+hbLn3/r64WNjRMwcX8eBbrULy1uZwpbwVGakaWJdsUuz02XoM/KXR qSw/VlrKW/+wIHB/Ag22PTiTVNgN5m2Cw0wYOZx4kGhJ5irKVjTYYaYQ+iFXjIAmCRJJSpmmrN/ Qd6EJrAclQhyG1fOxgV3a/5Ztp3cAzktex9Ku1GYzVDdy+Z0Z47s7/ZWID4LiHPfNwaKX9cAiag v+gJ/q/F6rVWTo/Mjh/ahXPLtwgipg= X-Received: by 2002:a05:701b:281c:b0:143:7330:7fbc with SMTP id a92af1059eb24-146cee37b69mr8056469c88.21.1790572910280; Sun, 27 Sep 2026 22:21:50 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 06/24] target/sh4: name guest trap numbers SH4_EXCP_* Date: Mon, 28 Sep 2026 13:20:32 +0800 Message-ID: <20260928052051.251-7-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::10; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x10.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, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573023407158500 Content-Type: text/plain; charset="utf-8" Add SH4_EXCP_* in cpu.h for the guest trap numbers stored in cs->exception_index. Signed-off-by: Yonggang Luo --- target/sh4/cpu.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h index 6984bb462fb..a1e9049b7be 100644 --- a/target/sh4/cpu.h +++ b/target/sh4/cpu.h @@ -135,6 +135,27 @@ typedef struct memory_content { struct memory_content *next; } memory_content; =20 +/* Guest trap numbers. */ +enum { + SH4_EXCP_RESET =3D 0x000, + SH4_EXCP_MANUAL_RESET =3D 0x020, + SH4_EXCP_TLB_MISS =3D 0x040, + SH4_EXCP_DTLB_MISS_WRITE =3D 0x060, + SH4_EXCP_INITIAL_PAGE_WRITE =3D 0x080, + SH4_EXCP_TLB_VIOLATION =3D 0x0a0, + SH4_EXCP_DTLB_VIOLATION_WRITE =3D 0x0c0, + SH4_EXCP_ADDR_ERROR =3D 0x0e0, + SH4_EXCP_DATA_WRITE =3D 0x100, + SH4_EXCP_FPU =3D 0x120, + SH4_EXCP_TLB_MULTIPLE =3D 0x140, + SH4_EXCP_TRAPA =3D 0x160, + SH4_EXCP_ILLEGAL_INSTRUCTION =3D 0x180, + SH4_EXCP_SLOT_ILLEGAL_INSTRUCTION =3D 0x1a0, + SH4_EXCP_USER_BREAK =3D 0x1e0, + SH4_EXCP_FPU_DISABLE =3D 0x800, + SH4_EXCP_SLOT_FPU_DISABLE =3D 0x820, +}; + typedef struct CPUArchState { uint32_t flags; /* general execution flags */ uint32_t gregs[24]; /* general registers */ --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790572950; cv=none; d=zohomail.com; s=zohoarc; b=YSIMGdSxB6DuEMp3oRzvc6qJQewY9OkfnOiPhg9g4EQpTVyQoU6TLdje+lN2Ir7+q8cVBLeGF7gEjOJA15mpZHh0yNHd8XkhslPPBDwJ3hJvBcDwrW/P+MKImQ2S8I2lOBumHLb5YQtjGdJspPyLU80K3DSBznaLh/ZdNyDYfio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790572950; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OB8lPQA5tlyxT2OTWLHEUe/GeGeDIZ7ICpNG1y+sBIQ=; b=ECi8QK47NRuseJmiPbBkQYiALlQcEBnV/AGHNUecq98P8aLUp+TeL9+KFAwe5RaDnftdfrfOMblUPEHZiS6vjlxFNRk+IZHpwHAGv5yOIiclkqJc0/VTnGdKo/tK+VJ20VbeSBQK5oW78cHJS7cb2Qti/MKDAXBYKPfhP2IitXc= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790572950802815.3483713189262; Sun, 27 Sep 2026 22:22:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3oY-0003xI-1N; Mon, 28 Sep 2026 01:22:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3oP-0003on-SU for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:22:01 -0400 Received: from mail-dl2-x0f.google.com ([2607:f8b0:4864:38::f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3oN-0007tL-JJ for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:22:01 -0400 Received: by mail-dl2-x0f.google.com with SMTP id a92af1059eb24-1450541ab50so1033375c88.3 for ; Sun, 27 Sep 2026 22:21:59 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.21.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:21:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572918; x=1791177718; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=OB8lPQA5tlyxT2OTWLHEUe/GeGeDIZ7ICpNG1y+sBIQ=; b=bgSFiSKMEEWc+aAnN9BeVHio2sl7zp+2GeCz7ELxvQ2eWeEVcirDFEtgze6220Nu5B KuRJhw3cjL8xJaH7H2E7FaKnO6WEzsB5XDqDOgdb7GAfryTeXTjg33RcAWcJQWRhQ6fr OSW4RXbpeGdDXiJaAQIDbwOoNFUC/fiAI4dNZAOamSXcywCNDwGeZdAg6ftYBm7wyF/d n+JhIlKMCoglzdVtSK3rGnxrpJUh+sKQ/ryOZzglktjUHBzBokBegiMV0+5T2Av+VXrZ jb7jI1pJf4VIQxneueRK6VuF/esuUCG9x+1PgvnO9hhhifP0GQXXezFlZ/hYGl/kDkFJ FXsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572918; x=1791177718; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=OB8lPQA5tlyxT2OTWLHEUe/GeGeDIZ7ICpNG1y+sBIQ=; b=1H4SFtn/P0H/A3tUcwn0nC4JzRqn9UmbNazXVAn9pCFIcNIfNUIuVF9c4G3GzodnrG f5KDPZC72QGkjGTGg4dbDgol1xE35as0FBoRGpnvoXK5KfpWwBgRZovmOQuCJP2Se6aJ /4sMcH1QhR+AVrAMwNT4Zt58l5l4q99EjLo+bvzeK7S9l+I5BYFvocHfbPRoPKwHn2uU TEQB7ITWEqI9XWOHL9B+Vxdln2BKeiohFvXCUfBSQaSSGogqDro4Pgxi2ahIY3X8dF8b 9kpROQetfwRyaKU8T4/AMflHRJ6RXmKwNmALhdyHPSVC6KB4unrlk+TXlmHGMabCy4cm ObTg== X-Gm-Message-State: AFuF++lDmAH6bMdpmpJu7fivApFaftMVweMNxkOqJEipPP/F74FxTbkn 5TwCJUrpkaaWwA+F/ktsmY834qmvKr6qPXtyyv8kPPvT1uluiP+nFaBPp4tN3lJhA2k= X-Gm-Gg: AYBFou0qbTPLz/NfgtMJcUZykqcxt5LGBGN02VP2EpN6yk+rIcRIH782TayxA7JbIqj /wqVTALrPN/daE2XNCCnkgTlyYa6cdEQhTvB3iRjh8ocpJt0tpx8LzcnHkA+jdBmEr3+0QLBzBR LiJua8zOQ61uoQKdVqEP3EerdzeLsCNy6c4RN/KZ/VJRa/cR8qXNdzA7KaxqTHoi0IiwkMkkHg7 2gvrQYTxCdkks8y7Co2w1yBDI4r0sq4Mftb/dt9bXqVML8RAG64TcPwMrTFGkQiiplBlt4NuNh9 81l0a5RqZk8q6g5tqlWe+uzmeCospl0otm59cweWYPigxF/PYOwD64EsSDZGS/2f5zeJkBmKcCs DDEkW9G1cnYy4+qBpUbp20+OT9ONg+xTWfFAbldH+DPc8YH/QU/7vURQrsVnFqrwIbyxhtY/+AB TI3VAu/1MwCMEuyGHCg+9vdYMbAV5jfjYGT2rvC3z82sBeb7m1K9qoNZbf1C+bEpbzhrMSvvvDU J3dlxVwq1XSrFroFXppgPhK+rq8T2w= X-Received: by 2002:a05:7022:ba2:b0:137:fa50:a242 with SMTP id a92af1059eb24-146cdfbbbe5mr11808495c88.1.1790572918005; Sun, 27 Sep 2026 22:21:58 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 07/24] target/sh4: convert raises to raise_excp Date: Mon, 28 Sep 2026 13:20:33 +0800 Message-ID: <20260928052051.251-8-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::f; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x0f.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790572951197158500 Content-Type: text/plain; charset="utf-8" Translate illegal and FPU-disable through raise_excp. Drop unused raise_* TCG helpers and the one-line raise_exception wrapper. Keep leftover sleep, trapa, and exclusive helpers. Exit unaligned and tlb_fill through cpu_loop_exit_excp. Log reset, manual reset, TLB multiple, and user break. Signed-off-by: Yonggang Luo --- target/sh4/helper.c | 82 +++++++++++++++++++++--------------------- target/sh4/helper.h | 4 --- target/sh4/op_helper.c | 43 +++------------------- target/sh4/translate.c | 12 ++++--- 4 files changed, 55 insertions(+), 86 deletions(-) diff --git a/target/sh4/helper.c b/target/sh4/helper.c index b6b057f104b..e22f02a5647 100644 --- a/target/sh4/helper.c +++ b/target/sh4/helper.c @@ -70,7 +70,7 @@ void superh_cpu_do_interrupt(CPUState *cs) do_irq =3D do_irq && (cs->exception_index =3D=3D -1); =20 if (env->sr & (1u << SR_BL)) { - if (do_exp && cs->exception_index !=3D 0x1e0) { + if (do_exp && cs->exception_index !=3D SH4_EXCP_USER_BREAK) { /* In theory a masked exception generates a reset exception, which in turn jumps to the reset vector. However this only works when using a bootloader. When using a kernel and an @@ -97,45 +97,57 @@ void superh_cpu_do_interrupt(CPUState *cs) if (qemu_loglevel_mask(CPU_LOG_INT)) { const char *expname; switch (cs->exception_index) { - case 0x0e0: + case SH4_EXCP_RESET: + expname =3D "reset"; + break; + case SH4_EXCP_MANUAL_RESET: + expname =3D "manual_reset"; + break; + case SH4_EXCP_ADDR_ERROR: expname =3D "addr_error"; break; - case 0x040: + case SH4_EXCP_TLB_MISS: expname =3D "tlb_miss"; break; - case 0x0a0: + case SH4_EXCP_TLB_MULTIPLE: + expname =3D "tlb_multiple"; + break; + case SH4_EXCP_TLB_VIOLATION: expname =3D "tlb_violation"; break; - case 0x180: + case SH4_EXCP_ILLEGAL_INSTRUCTION: expname =3D "illegal_instruction"; break; - case 0x1a0: + case SH4_EXCP_SLOT_ILLEGAL_INSTRUCTION: expname =3D "slot_illegal_instruction"; break; - case 0x800: + case SH4_EXCP_FPU_DISABLE: expname =3D "fpu_disable"; break; - case 0x820: + case SH4_EXCP_SLOT_FPU_DISABLE: expname =3D "slot_fpu"; break; - case 0x100: + case SH4_EXCP_DATA_WRITE: expname =3D "data_write"; break; - case 0x060: + case SH4_EXCP_DTLB_MISS_WRITE: expname =3D "dtlb_miss_write"; break; - case 0x0c0: + case SH4_EXCP_DTLB_VIOLATION_WRITE: expname =3D "dtlb_violation_write"; break; - case 0x120: + case SH4_EXCP_FPU: expname =3D "fpu_exception"; break; - case 0x080: + case SH4_EXCP_INITIAL_PAGE_WRITE: expname =3D "initial_page_write"; break; - case 0x160: + case SH4_EXCP_TRAPA: expname =3D "trapa"; break; + case SH4_EXCP_USER_BREAK: + expname =3D "user_break"; + break; default: expname =3D do_irq ? "interrupt" : "???"; break; @@ -161,18 +173,18 @@ void superh_cpu_do_interrupt(CPUState *cs) if (do_exp) { env->expevt =3D cs->exception_index; switch (cs->exception_index) { - case 0x000: - case 0x020: - case 0x140: + case SH4_EXCP_RESET: + case SH4_EXCP_MANUAL_RESET: + case SH4_EXCP_TLB_MULTIPLE: env->sr &=3D ~(1u << SR_FD); env->sr |=3D 0xf << 4; /* IMASK */ env->pc =3D 0xa0000000; break; - case 0x040: - case 0x060: + case SH4_EXCP_TLB_MISS: + case SH4_EXCP_DTLB_MISS_WRITE: env->pc =3D env->vbr + 0x400; break; - case 0x160: + case SH4_EXCP_TRAPA: env->spc +=3D 2; /* special case for TRAPA */ /* fall through */ default: @@ -632,7 +644,7 @@ void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State *s, hwa= ddr addr, CPUState *cs =3D env_cpu(s); =20 /* Multiple TLB Exception */ - cs->exception_index =3D 0x140; + cs->exception_index =3D SH4_EXCP_TLB_MULTIPLE; s->tea =3D addr; break; } @@ -828,37 +840,27 @@ bool superh_cpu_tlb_fill(CPUState *cs, vaddr address,= int size, switch (ret) { case MMU_ITLB_MISS: case MMU_DTLB_MISS_READ: - cs->exception_index =3D 0x040; - break; + cpu_loop_exit_excp(cs, SH4_EXCP_TLB_MISS, retaddr); case MMU_DTLB_MULTIPLE: case MMU_ITLB_MULTIPLE: - cs->exception_index =3D 0x140; - break; + cpu_loop_exit_excp(cs, SH4_EXCP_TLB_MULTIPLE, retaddr); case MMU_ITLB_VIOLATION: - cs->exception_index =3D 0x0a0; - break; + cpu_loop_exit_excp(cs, SH4_EXCP_TLB_VIOLATION, retaddr); case MMU_DTLB_MISS_WRITE: - cs->exception_index =3D 0x060; - break; + cpu_loop_exit_excp(cs, SH4_EXCP_DTLB_MISS_WRITE, retaddr); case MMU_DTLB_INITIAL_WRITE: - cs->exception_index =3D 0x080; - break; + cpu_loop_exit_excp(cs, SH4_EXCP_INITIAL_PAGE_WRITE, retaddr); case MMU_DTLB_VIOLATION_READ: - cs->exception_index =3D 0x0a0; - break; + cpu_loop_exit_excp(cs, SH4_EXCP_TLB_VIOLATION, retaddr); case MMU_DTLB_VIOLATION_WRITE: - cs->exception_index =3D 0x0c0; - break; + cpu_loop_exit_excp(cs, SH4_EXCP_DTLB_VIOLATION_WRITE, retaddr); case MMU_IADDR_ERROR: case MMU_DADDR_ERROR_READ: - cs->exception_index =3D 0x0e0; - break; + cpu_loop_exit_excp(cs, SH4_EXCP_ADDR_ERROR, retaddr); case MMU_DADDR_ERROR_WRITE: - cs->exception_index =3D 0x100; - break; + cpu_loop_exit_excp(cs, SH4_EXCP_DATA_WRITE, retaddr); default: cpu_abort(cs, "Unhandled MMU fault"); } - cpu_loop_exit_restore(cs, retaddr); } #endif /* !CONFIG_USER_ONLY */ diff --git a/target/sh4/helper.h b/target/sh4/helper.h index 29011d3dbbb..593b20c0af2 100644 --- a/target/sh4/helper.h +++ b/target/sh4/helper.h @@ -1,8 +1,4 @@ DEF_HELPER_1(ldtlb, void, env) -DEF_HELPER_1(raise_illegal_instruction, noreturn, env) -DEF_HELPER_1(raise_slot_illegal_instruction, noreturn, env) -DEF_HELPER_1(raise_fpu_disable, noreturn, env) -DEF_HELPER_1(raise_slot_fpu_disable, noreturn, env) DEF_HELPER_1(sleep, noreturn, env) DEF_HELPER_2(trapa, noreturn, env, i32) DEF_HELPER_1(exclusive, noreturn, env) diff --git a/target/sh4/op_helper.c b/target/sh4/op_helper.c index 777380f8e40..535bffb08f1 100644 --- a/target/sh4/op_helper.c +++ b/target/sh4/op_helper.c @@ -33,15 +33,12 @@ void superh_cpu_do_unaligned_access(CPUState *cs, vaddr= addr, switch (access_type) { case MMU_INST_FETCH: case MMU_DATA_LOAD: - cs->exception_index =3D 0x0e0; - break; + cpu_loop_exit_excp(cs, SH4_EXCP_ADDR_ERROR, retaddr); case MMU_DATA_STORE: - cs->exception_index =3D 0x100; - break; + cpu_loop_exit_excp(cs, SH4_EXCP_DATA_WRITE, retaddr); default: g_assert_not_reached(); } - cpu_loop_exit_restore(cs, retaddr); } =20 #endif @@ -55,49 +52,19 @@ void helper_ldtlb(CPUSH4State *env) #endif } =20 -static inline G_NORETURN -void raise_exception(CPUSH4State *env, int index, - uintptr_t retaddr) -{ - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D index; - cpu_loop_exit_restore(cs, retaddr); -} - -void helper_raise_illegal_instruction(CPUSH4State *env) -{ - raise_exception(env, 0x180, 0); -} - -void helper_raise_slot_illegal_instruction(CPUSH4State *env) -{ - raise_exception(env, 0x1a0, 0); -} - -void helper_raise_fpu_disable(CPUSH4State *env) -{ - raise_exception(env, 0x800, 0); -} - -void helper_raise_slot_fpu_disable(CPUSH4State *env) -{ - raise_exception(env, 0x820, 0); -} - void helper_sleep(CPUSH4State *env) { CPUState *cs =3D env_cpu(env); =20 cs->halted =3D 1; env->in_sleep =3D 1; - raise_exception(env, EXCP_HLT, 0); + cpu_loop_exit_excp(cs, EXCP_HLT, 0); } =20 void helper_trapa(CPUSH4State *env, uint32_t tra) { env->tra =3D tra << 2; - raise_exception(env, 0x160, 0); + cpu_loop_exit_excp(env_cpu(env), SH4_EXCP_TRAPA, 0); } =20 void helper_exclusive(CPUSH4State *env) @@ -255,7 +222,7 @@ static void update_fpscr(CPUSH4State *env, uintptr_t re= taddr) cause =3D (env->fpscr & FPSCR_CAUSE_MASK) >> FPSCR_CAUSE_SHIFT; enable =3D (env->fpscr & FPSCR_ENABLE_MASK) >> FPSCR_ENABLE_SHIFT; if (cause & enable) { - raise_exception(env, 0x120, retaddr); + cpu_loop_exit_excp(env_cpu(env), SH4_EXCP_FPU, retaddr); } } } diff --git a/target/sh4/translate.c b/target/sh4/translate.c index 5729a757f19..590b62ba3c1 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -1756,10 +1756,13 @@ static void _decode_opc(DisasContext * ctx) if (ctx->envflags & TB_FLAG_DELAY_SLOT_MASK) { do_illegal_slot: gen_save_cpu_state(ctx, true); - gen_helper_raise_slot_illegal_instruction(tcg_env); + gen_helper_raise_excp(tcg_env, + tcg_constant_i32( + SH4_EXCP_SLOT_ILLEGAL_INSTRUCTION)); } else { gen_save_cpu_state(ctx, true); - gen_helper_raise_illegal_instruction(tcg_env); + gen_helper_raise_excp(tcg_env, + tcg_constant_i32(SH4_EXCP_ILLEGAL_INSTRUCTIO= N)); } ctx->base.is_jmp =3D DISAS_NORETURN; return; @@ -1767,9 +1770,10 @@ static void _decode_opc(DisasContext * ctx) do_fpu_disabled: gen_save_cpu_state(ctx, true); if (ctx->envflags & TB_FLAG_DELAY_SLOT_MASK) { - gen_helper_raise_slot_fpu_disable(tcg_env); + gen_helper_raise_excp(tcg_env, + tcg_constant_i32(SH4_EXCP_SLOT_FPU_DISABLE)); } else { - gen_helper_raise_fpu_disable(tcg_env); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(SH4_EXCP_FPU_DISAB= LE)); } ctx->base.is_jmp =3D DISAS_NORETURN; } --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573310; cv=none; d=zohomail.com; s=zohoarc; b=NQZrE4z21d6IIZz62lSFOI9C2sNhCh58J4Wnk/ONvL2cEvDqwwZ29PzgyEfq6OES9HtR3apSVGR+FtbHqTjITtyc7Medz2oSwUDozwtXc23DO6xpj2utDXTy+g9u7AKlIAuNvUr4gtRLYvJSy8bwBeRveXCAf3z5eRZak6SPRao= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573310; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xjVMaYr3kqXJVYCxY7VYQbjUgY58Olm454tDy/V29P8=; b=Cm7O7kOgirbI7NBI5B9xlNxU8LKNgW/hOSqyfTEyshCpWuhQZ262/a+ChjyM6k8oNpRs2pirb4T2Xe2XeKtfE9xwPnjANY5I/Z2T/UONfZFg8JiD7yxXIBuGumj8GXGrRbR5MrTldGtgGlES2yqQwT49/9STHXx6coQBsMTFFV0= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573310653276.3943619843958; Sun, 27 Sep 2026 22:28:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3pA-0004NI-TC; Mon, 28 Sep 2026 01:22:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3oX-0003xJ-0H for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:22:09 -0400 Received: from mail-dl2-x0e.google.com ([2607:f8b0:4864:38::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3oV-0007uM-A5 for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:22:08 -0400 Received: by mail-dl2-x0e.google.com with SMTP id a92af1059eb24-144f47a9b57so2310860c88.2 for ; Sun, 27 Sep 2026 22:22:06 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572926; x=1791177726; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=xjVMaYr3kqXJVYCxY7VYQbjUgY58Olm454tDy/V29P8=; b=SJhS9+CiSDo+Zq/cmcA18DOl6MifkeEU0zjgha0YeJRXXvnODvbEiBLRbLpKceKGK1 VaCODKhqjNaDPdaYSBfEiGxAJ1RGIlLfR3UF27OyYSB2b/JydvDtvx6A3vXCukQxPTkk CCX/h7cVKLARman6P5nWzFmWLJPMdQcANB85MaEewl3J3IwOAGuOSTWRpg04TGERzXZL peDbugWCrPSE4s8fbL9M1DzISS7DJuSdbRULCiRp1knMxy1hbItHGDYk9ZHXNcMEqgIK r2wEGguIvsrcLpI0FaOEDxrhG6AqZ4uyDPQbrtZ0jFllqRwB8+TDYypEJUoSXr42QL/Y HrQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572926; x=1791177726; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=xjVMaYr3kqXJVYCxY7VYQbjUgY58Olm454tDy/V29P8=; b=yvXDCyt0my4w+MBxYnwhgz2zgxqkAHRqbqSRvkpF6LJD2fAHWZSBtVLhipTqaH6uvC EqHsGo2Jt22swg6cOMIRMDLBE1JoSALqgosfHQ6A5Q0UXzBTfJ8o9wO6JWAYN884kp6w edywRGKzP5ueOy2G+JJ5iS+LHeZA9dK8xVHGc7MXLNvryvgSpWlR2RnhBxRCp92w6mDI qZhpUHWmGZL79exg3oS3BbmFvOpaoEIBY4NwkplirQkq4Ax4YCdiNVoHv0dr2uCr4zVQ BHny7CU0q7bUQsHMo6U7IR1vAMl3JIoGX9XnNyUuuTY7DHmYyYbr7UgWxPkOFwjSXQov rBVg== X-Gm-Message-State: AFuF++nGPDc9WX+MzRa3AqVccLi6K53ZWb3huHx9uO50Nh62XPcXOyHG WTzlDWzlNcBZfPI6VPbdpi9DoudgAZgJ+n+vXc0nSNtgGFLD0BR48lbdoVsUIpirBOc= X-Gm-Gg: AYBFou0f5go2jdxAitaxrPacsLWgcHW/qgOeE/s9oEMBuAcGEVBMYWwTCgPX+igIVPK 9GMr7WKzfveQgNoPioPvtAuZpRlPW+61syvGunHZszrIFlxGflTYLN9ZI97M8V0ck5ittEqjxAb ZbsBRc6v/DFpPWfvxKAYnk6xP6lUMcqvjfDbtAfYEq39VKETj+j3KcCWiuqO9KoXE/wYQL3XpAH elD9CCy34xzicJTOKGIlXtNeSnVsL4aYCrI/23+QaE2A1FD7jGKcohPFWzpu1/ctAyBd8oR5qus h1PpBmVaA8Ev40a0qkcswRv5acqdqld4LeH7Ufs7bT2NkMK9i5rvCHZ3gy58B1HyhvNZ9lp9MIQ OMStx8z6XlMBQ39pfvOCrE06Bys8ZEhGTPZ623IB6awieYnCrwE7yEf0GYaik6wBB18xKTfUEov br2W8G/WclJohK5fBce59hCtIvrpmL5ac/r/8HLeX8lDKsgs5sy36glea2m2CR9RH7rYUYobA/2 fQrt8XOQL81Yr5pxX2Uv/5o0BToSji/QSdea21PbQ== X-Received: by 2002:a05:701b:20ce:20b0:143:33de:978f with SMTP id a92af1059eb24-146d077c01cmr8389566c88.43.1790572925881; Sun, 27 Sep 2026 22:22:05 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 08/24] target/m68k: convert raises to raise_excp Date: Mon, 28 Sep 2026 13:20:34 +0800 Message-ID: <20260928052051.251-9-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::e; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x0e.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573312648158500 Content-Type: text/plain; charset="utf-8" Translate through raise_excp. Drop TCG raise_exception and the one-line raise_exception_ra wrappers. Keep leftover raise_exception_format2. Signed-off-by: Yonggang Luo --- target/m68k/helper.c | 12 ++---------- target/m68k/helper.h | 1 - target/m68k/op_helper.c | 19 ------------------- target/m68k/translate.c | 2 +- 4 files changed, 3 insertions(+), 31 deletions(-) diff --git a/target/m68k/helper.c b/target/m68k/helper.c index 5f91d206f59..3c62e15735d 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -162,14 +162,6 @@ void HELPER(cf_movec_to)(CPUM68KState *env, uint32_t r= eg, uint32_t val) } } =20 -static void raise_exception_ra(CPUM68KState *env, int tt, uintptr_t raddr) -{ - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D tt; - cpu_loop_exit_restore(cs, raddr); -} - void HELPER(m68k_movec_to)(CPUM68KState *env, uint32_t reg, uint32_t val) { switch (reg) { @@ -291,7 +283,7 @@ void HELPER(m68k_movec_to)(CPUM68KState *env, uint32_t = reg, uint32_t val) } =20 /* Invalid control registers will generate an exception. */ - raise_exception_ra(env, EXCP_ILLEGAL, 0); + cpu_loop_exit_excp(env_cpu(env), EXCP_ILLEGAL, 0); } =20 uint32_t HELPER(m68k_movec_from)(CPUM68KState *env, uint32_t reg) @@ -394,7 +386,7 @@ uint32_t HELPER(m68k_movec_from)(CPUM68KState *env, uin= t32_t reg) } =20 /* Invalid control registers will generate an exception. */ - raise_exception_ra(env, EXCP_ILLEGAL, 0); + cpu_loop_exit_excp(env_cpu(env), EXCP_ILLEGAL, 0); =20 return 0; } diff --git a/target/m68k/helper.h b/target/m68k/helper.h index 0bda8f8152d..a6ca811ebe2 100644 --- a/target/m68k/helper.h +++ b/target/m68k/helper.h @@ -111,7 +111,6 @@ DEF_HELPER_3(set_mac_extu, void, env, i32, i32) DEF_HELPER_2(flush_flags, void, env, i32) DEF_HELPER_2(set_ccr, void, env, i32) DEF_HELPER_FLAGS_1(get_ccr, TCG_CALL_NO_WG_SE, i32, env) -DEF_HELPER_2(raise_exception, noreturn, env, i32) =20 DEF_HELPER_FLAGS_3(bfffo_reg, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) =20 diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 38f7a689814..5f539f8fd75 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -539,25 +539,6 @@ bool m68k_cpu_exec_interrupt(CPUState *cs, int interru= pt_request) =20 #endif /* !CONFIG_USER_ONLY */ =20 -G_NORETURN static void -raise_exception_ra(CPUM68KState *env, int tt, uintptr_t raddr) -{ - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D tt; - cpu_loop_exit_restore(cs, raddr); -} - -G_NORETURN static void raise_exception(CPUM68KState *env, int tt) -{ - raise_exception_ra(env, tt, 0); -} - -void HELPER(raise_exception)(CPUM68KState *env, uint32_t tt) -{ - raise_exception(env, tt); -} - G_NORETURN static void raise_exception_format2(CPUM68KState *env, int tt, int ilen, uintptr_t rad= dr) { diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 138c89d3e53..b5ce0ee6ccd 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -252,7 +252,7 @@ static void gen_jmp(DisasContext *s, TCGv dest) =20 static void gen_raise_exception(int nr) { - gen_helper_raise_exception(tcg_env, tcg_constant_i32(nr)); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(nr)); } =20 static void gen_raise_exception_format2(DisasContext *s, int nr, --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573339; cv=none; d=zohomail.com; s=zohoarc; b=XmqENWNs/qp5kqLe00Be/AoFzpQ3L9tvhpJifYnw+6yhakJYzhu9ASnqAe0KeLePlLmDj1SbQAGml1S/NgY/i0ksohGg2oQy3ZxUh7XEJ8O/o7x9rmyCoorxDT51W7xqt5M6kc1FXa/NW6HtV18ZkoarGMJfaHKqEmOii0ACRng= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573339; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bMDxaGcKixUkP0LFDlmb0jsz4Zjglb9CdYFmLn1wMt4=; b=afVlrqsaUIBLZof2EX+cY170p88tiJCd6i9TBYgyKSKvD7iIWqFxqO+Xk7DPV6VbRHkCueUVacqO2J4vLxbSlAQ5NhRxikL9EkmDgubhjE2/6dGCJ/YvPfodc0uACLQ9L8oCyf/C5Y6IVHCxK2UsNzI5ZYg9gGASL4QsQ9fLKNs= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573339012755.1045910473372; Sun, 27 Sep 2026 22:28:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3pp-0005K4-R0; Mon, 28 Sep 2026 01:23:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3ok-00045z-Jq for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:22:24 -0400 Received: from mail-dl2-x25.google.com ([2607:f8b0:4864:38::25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3oe-0007vZ-RZ for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:22:20 -0400 Received: by mail-dl2-x25.google.com with SMTP id a92af1059eb24-1438e88300cso2225252c88.0 for ; Sun, 27 Sep 2026 22:22:15 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:22:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572935; x=1791177735; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=bMDxaGcKixUkP0LFDlmb0jsz4Zjglb9CdYFmLn1wMt4=; b=Cc3f3iOCME+yDjkDSVjRSxnNxqRWsPy1ycRuqqBqfUW2zIsGAo80OOfL+LXaoHvMuh RPOwaA5zcMJFOG37Nk9sqsQ2uzepvSU/q0j+IrKu64h32MwLdKkxPHUsZQHOJPCQU+rU WGNdPSL5WzzSu9sEPLokMU/T0v77kgnVAd91spP2gN65bms27XJbciK3Wamcy6zRxBtx mV4f6AOPbSR0WpxxAp0/Q7XdO7YH6JXISp0WB1bP+ZmWsymjoZ+YvgP/5GAsaQUwy+Ee F2vFZJvg9sBgWi2Jw6Kh/Bzr4F19s2yrPhcjofQ5Cu0oyVfp+CDTZ/ETp5oxCB1A0Myc tz4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572935; x=1791177735; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=bMDxaGcKixUkP0LFDlmb0jsz4Zjglb9CdYFmLn1wMt4=; b=AEaVLo6fyt1kBQpGouHD9wqz2mGOr9OV9sAwYMpB24Vlg6flajebWiYMgyfoAhwYYZ 3Sg9V8RWRU5kTF5DWaqqLA8+6mimGHqDqqRG8Ae/IRCOJSpiNOPu++c273CBMx0AXM0L dwXQt/vGIHqbrqq3V+0xhMGbcCJ+r409bci+Qqzo0IhxrRa410rDJc7IqWmgmt9CSgSd o6WXsZBlPiXuOCcKKmr4GZrOOx9yEi/MxLh9FTPaabt3s+hyeRf/dKUf81E/QFuBvcQ+ Jk+ya04jzQcHoIeZnnoOdOfBnydURB7cxYeKpkSSAtVeuaEgo2Sz4JyhemzOEDtytNg2 LbsA== X-Gm-Message-State: AFuF++kYpCGyJYu5DlgPa8DMKgbhZx4iJyY0pCsNJEZp5NKup3seYISL RoKo0fX5h0HqpmIOcir/+z3+cX5MFC4qahO8M+Q8kkcYb3Kplw9CV3kc8WMdqePfp7Q= X-Gm-Gg: AYBFou2QOyYbBQyrd+YoBPP8JCaUv3+Vq39vv/SD5h/N/ruMBvTsIX2e3X7aJGpTPgL 65icE3tknuu8GnxFAxU9kH0T07p6yG/yeiB9Ht4kxByyPP6cS0Zx3D6elv2vh14jroGjrzrbD9S 49PPOAMlNPDzldn81O5sfyZ3Z1uTimp5qfhQWdeF6qz81ZcXeq4qcT3fA1yKRCkHa9F+7lo/VIg ibKm1iqzRrI9onAhwnsdoTBg/BrAc+CWIX6PEam2Nk0A4v9cQ0bxGvZYhKdQ5eCkEoqJvfC93vu o6UUg+7ArS1xrTdJCropmCn+TLotYVCt2QlW2/IL4CzZ4a+Uw9doh2N/2YfiTfPx4OoAePhA2uU LyKCEJHUhiEGn3Uui2mMfukvdsPSr/IEljUyNsgh+0cDGHx1RvuJbab9Ldht2ifjcbMWmF45jDf z5arhD5rDuVDya5ewk7DdzbVsxyzmYAIf1pQ3EPwiWWk4xcGnQCy1/Om8j8204DwHfb9of//+dm VYthCffOArsk9pRGPBoWlSAJ/GADhA= X-Received: by 2002:a05:7022:1584:b0:145:152:b547 with SMTP id a92af1059eb24-146ce1aab23mr9290140c88.1.1790572933639; Sun, 27 Sep 2026 22:22:13 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 09/24] target/or1k: convert exception to raise_excp Date: Mon, 28 Sep 2026 13:20:35 +0800 Message-ID: <20260928052051.251-10-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::25; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x25.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573340832158500 Content-Type: text/plain; charset="utf-8" Translate through raise_excp. Drop the TCG exception helper and exception.c. Keep C raise_exception as a static inline in exception.h. Exit RANGE overflow through cpu_loop_exit_excp. Signed-off-by: Yonggang Luo --- target/or1k/exception.c | 31 ------------------------------- target/or1k/exception.h | 7 ++++++- target/or1k/exception_helper.c | 13 +------------ target/or1k/helper.h | 1 - target/or1k/meson.build | 1 - target/or1k/translate.c | 2 +- 6 files changed, 8 insertions(+), 47 deletions(-) delete mode 100644 target/or1k/exception.c diff --git a/target/or1k/exception.c b/target/or1k/exception.c deleted file mode 100644 index 0479a069592..00000000000 --- a/target/or1k/exception.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * OpenRISC exception. - * - * Copyright (c) 2011-2012 Jia Liu - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -#include "qemu/osdep.h" -#include "accel/tcg/cpu-loop.h" -#include "cpu.h" -#include "exception.h" - -G_NORETURN void raise_exception(OpenRISCCPU *cpu, uint32_t excp) -{ - CPUState *cs =3D CPU(cpu); - - cs->exception_index =3D excp; - cpu_loop_exit(cs); -} diff --git a/target/or1k/exception.h b/target/or1k/exception.h index f62fc314c1f..a49a6c90f0d 100644 --- a/target/or1k/exception.h +++ b/target/or1k/exception.h @@ -21,7 +21,12 @@ #define TARGET_OPENRISC_EXCEPTION_H =20 #include "cpu.h" +#include "accel/tcg/cpu-loop.h" =20 -G_NORETURN void raise_exception(OpenRISCCPU *cpu, uint32_t excp); +static inline G_NORETURN +void raise_exception(OpenRISCCPU *cpu, uint32_t excp) +{ + cpu_loop_exit_excp(CPU(cpu), excp, 0); +} =20 #endif /* TARGET_OPENRISC_EXCEPTION_H */ diff --git a/target/or1k/exception_helper.c b/target/or1k/exception_helper.c index 3bd82b29719..c9b80093b25 100644 --- a/target/or1k/exception_helper.c +++ b/target/or1k/exception_helper.c @@ -21,22 +21,11 @@ #include "cpu.h" #include "accel/tcg/cpu-loop.h" #include "exec/helper-proto.h" -#include "exception.h" - -void HELPER(exception)(CPUOpenRISCState *env, uint32_t excp) -{ - OpenRISCCPU *cpu =3D env_archcpu(env); - - raise_exception(cpu, excp); -} =20 static G_NORETURN void do_range(CPUOpenRISCState *env, uintptr_t pc) { - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D EXCP_RANGE; - cpu_loop_exit_restore(cs, pc); + cpu_loop_exit_excp(env_cpu(env), EXCP_RANGE, pc); } =20 void HELPER(ove_cy)(CPUOpenRISCState *env) diff --git a/target/or1k/helper.h b/target/or1k/helper.h index e0a8d402271..d6e6bd4ffbc 100644 --- a/target/or1k/helper.h +++ b/target/or1k/helper.h @@ -18,7 +18,6 @@ */ =20 /* exception */ -DEF_HELPER_FLAGS_2(exception, TCG_CALL_NO_WG, void, env, i32) DEF_HELPER_FLAGS_1(ove_cy, TCG_CALL_NO_WG, void, env) DEF_HELPER_FLAGS_1(ove_ov, TCG_CALL_NO_WG, void, env) DEF_HELPER_FLAGS_1(ove_cyov, TCG_CALL_NO_WG, void, env) diff --git a/target/or1k/meson.build b/target/or1k/meson.build index 7cea45287a2..dba5044b655 100644 --- a/target/or1k/meson.build +++ b/target/or1k/meson.build @@ -5,7 +5,6 @@ or1k_ss.add(gen) or1k_ss.add(files( 'cpu.c', 'disas.c', - 'exception.c', 'exception_helper.c', 'fpu_helper.c', 'interrupt_helper.c', diff --git a/target/or1k/translate.c b/target/or1k/translate.c index e00ef45b9b7..243a8eede23 100644 --- a/target/or1k/translate.c +++ b/target/or1k/translate.c @@ -140,7 +140,7 @@ void openrisc_translate_init(void) =20 static void gen_exception(DisasContext *dc, unsigned int excp) { - gen_helper_exception(tcg_env, tcg_constant_i32(excp)); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(excp)); } =20 static void gen_illegal_exception(DisasContext *dc) --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573295; cv=none; d=zohomail.com; s=zohoarc; b=ARRbzg1QmjBHILrVgbVOhdutUph8qv4/Dqwzc9sZxSLe6FfGggCJaWZi1X99ajtbzjf+diyeP81FLz2eMG0Ft1V7mLBb8K2NC+KwvT/d8p1v9daUzGYyRA0zPyis2hCQUw7D72ahLkZGB1KGDfcUloTDqWIGNF3FBRv4/XZcppY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573295; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=pHUfebcALl+NSUvlVWHJuhBPOFBFdzvvL9KgudQ/rlU=; b=hyR7zfYkKgpxo0LtYtKTW7ViQK6o3VqgP/kNw9c+WKxg5RxKwFgHLZzpORPJXUyVhZRMkpVdQC3suKdXY4Jd90H74fXeU5kVzHsmUbUWssGVkjFQvHGpSN69nAM6BLlL52Kx8on+Mt0g7DYQ4Dtk1cO8JmE7b1hpvOwkm3A+UcQ= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573295685497.6147710596341; Sun, 27 Sep 2026 22:28:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3pP-0004kf-Sz; Mon, 28 Sep 2026 01:23:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3oq-00048g-1A for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:22:31 -0400 Received: from mail-dl2-x0e.google.com ([2607:f8b0:4864:38::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3om-0007w1-3F for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:22:27 -0400 Received: by mail-dl2-x0e.google.com with SMTP id a92af1059eb24-1438cb9b3a3so1409425c88.2 for ; Sun, 27 Sep 2026 22:22:22 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.22.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:22:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572941; x=1791177741; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=pHUfebcALl+NSUvlVWHJuhBPOFBFdzvvL9KgudQ/rlU=; b=hQ321XUtkBeBQJBRymcvO6MAXlFUpHGwHWg7bJH3s7Mmgex15x2gfAoUVpMc/RY7OC VMZCLPYh/eAy1bW5zvdAKomo7Upgk0WI4LU1j408REY4qOuIZKeQYwy9XYnIN22laVKY d6piyI4b7ZhmeP4FnI6zZJWkulpqQnhK/kBD958n5Ur//uu8y1YAwh+QSZSig1LqhtlO 03qLyxEse9LS1H1Y0o1rzNxxSy3ToqFliHti3XZLZMcPBh7c/cjSj4rR0XnfJ/LKeTz5 o41UaQ507tZsm21gAKzB+p4P8jiIuI3FHm5cB8X3jnbb2zl1T45DmC7mCIl4h8H/m7N+ V9XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572941; x=1791177741; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=pHUfebcALl+NSUvlVWHJuhBPOFBFdzvvL9KgudQ/rlU=; b=vGMBR+1Xzfch5QLRtHlmtSkhK5kUkCnEWjyn8DWi2shhgcss9rJloGf2SArpLn61nQ /utUNI9fiwZJSgzV0tiMYi4OuJSddiJQLlXkruljHbuFvR/8R/TwUsSOGeMbXtu6d04i gjwGMDGuJy0kyQHDVprd7KoyZWtSj9i3Lgm5MAOYNxlCy28TzlM4FGM/6vOVHnHeNdqy 55Hw1X6al6qWO+HA87tXiW+0CkG8aEn7jnwEFuTgUoup6OY82Lja9Nu7/A7D7Jhfq1UY vZqZB+Bts3RdyRJXbi9EqLO665FQoRobO95OQJ2XcpcuC57pXJ8IewAAnEq6z1mMrjN/ Nvxw== X-Gm-Message-State: AFuF++nA3eewfBHzNXGB2wpHG0qZe+Ph7rOBXANt9rz8dQr9+OyU2X3+ Rs609aNGUAJtP2bS5sanvcOD1oNdf7eqSxaMQwORO2QJNJzDb4KjSAx4PXMKmIdijlo= X-Gm-Gg: AYBFou0eFFH+dwmiPsVuya/CBCIS5GrCszeDKprF5U6m0O4iyQwXOpCHm0GCmmL1NIB BM6kjwR7zco3mVUz29PxBEjvpho6Xf1TvVTTsMpcu4w+52bd9ix6zZM+vjdJRzG8asj6Jy9nXgc z/H3GpFBoz2u0wY+LLWD7OeuUZJB6ngK8An7TIUTTn1ysvKn5uEsyVGZodlP8AP7F9AXPGALCcB eedlJMyXFQk81QmWoo+Ofo87WxP/D1asdAHToNduhzDoB5Ob70GIBkOKfrZDBbIYxVj3bht/0w1 o36khDvF0wuL+C33j+4eE72Lzhi84xYKh9UA+qqKTdpvI77OSYoMoK5Y0DnbwdlXOojvU6gbsGI DOC6gWFIs/7DjmmbDKpVFUg81aY7CtrtQV1hW/tAfO/ykVL4XIfia/yNMjjG1weG88nW6EeEUdU AQL0XShze1BSnui2vK4gvFrjjVIcPkI/22pbaEAMQzTbQGbD9yroNjrsvZYSZ+JsJDXE343RZT5 ToKV+t+wO/lcrnmeXk1VJtJs8JzhiU= X-Received: by 2002:a05:7022:1588:b0:147:5149:d108 with SMTP id a92af1059eb24-1475149db52mr8942727c88.43.1790572941343; Sun, 27 Sep 2026 22:22:21 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 10/24] target/microblaze: convert raise_exception to raise_excp Date: Mon, 28 Sep 2026 13:20:36 +0800 Message-ID: <20260928052051.251-11-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::e; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x0e.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573296563158500 Content-Type: text/plain; charset="utf-8" Translate through raise_excp after syncing PC. Drop TCG raise_exception. Exit HW_EXCP and MMU through cpu_loop_exit_excp. Signed-off-by: Yonggang Luo --- target/microblaze/helper.c | 3 +-- target/microblaze/helper.h | 2 -- target/microblaze/op_helper.c | 22 ++++------------------ target/microblaze/translate.c | 2 +- 4 files changed, 6 insertions(+), 23 deletions(-) diff --git a/target/microblaze/helper.c b/target/microblaze/helper.c index 05a90f5ecb2..d092e916db4 100644 --- a/target/microblaze/helper.c +++ b/target/microblaze/helper.c @@ -146,8 +146,7 @@ bool mb_cpu_tlb_fill(CPUState *cs, vaddr address, int s= ize, } =20 /* TLB miss. */ - cs->exception_index =3D EXCP_MMU; - cpu_loop_exit_restore(cs, retaddr); + cpu_loop_exit_excp(cs, EXCP_MMU, retaddr); } =20 void mb_cpu_do_interrupt(CPUState *cs) diff --git a/target/microblaze/helper.h b/target/microblaze/helper.h index 1429c1727ef..ad9c22ed5b7 100644 --- a/target/microblaze/helper.h +++ b/target/microblaze/helper.h @@ -1,5 +1,3 @@ -DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_WG, noreturn, env, i32) - DEF_HELPER_FLAGS_3(divs, TCG_CALL_NO_WG, i32, env, i32, i32) DEF_HELPER_FLAGS_3(divu, TCG_CALL_NO_WG, i32, env, i32, i32) =20 diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c index 3da0c68da39..f3dc42d5bdd 100644 --- a/target/microblaze/op_helper.c +++ b/target/microblaze/op_helper.c @@ -62,25 +62,14 @@ uint32_t helper_get(uint32_t id, uint32_t ctrl) return 0xdead0000 | id; } =20 -void helper_raise_exception(CPUMBState *env, uint32_t index) -{ - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D index; - cpu_loop_exit(cs); -} - /* Raises ESR_EC_DIVZERO if exceptions are enabled. */ static void raise_divzero(CPUMBState *env, uint32_t esr, uintptr_t unwind_= pc) { env->msr |=3D MSR_DZ; =20 if ((env->msr & MSR_EE) && env_archcpu(env)->cfg.div_zero_exception) { - CPUState *cs =3D env_cpu(env); - env->esr =3D esr; - cs->exception_index =3D EXCP_HW_EXCP; - cpu_loop_exit_restore(cs, unwind_pc); + cpu_loop_exit_excp(env_cpu(env), EXCP_HW_EXCP, unwind_pc); } } =20 @@ -123,8 +112,7 @@ static void raise_fpu_exception(CPUMBState *env, uintpt= r_t ra) CPUState *cs =3D env_cpu(env); =20 env->esr =3D ESR_EC_FPU; - cs->exception_index =3D EXCP_HW_EXCP; - cpu_loop_exit_restore(cs, ra); + cpu_loop_exit_excp(cs, EXCP_HW_EXCP, ra); } =20 static void update_fpu_flags(CPUMBState *env, int flags, uintptr_t ra) @@ -390,8 +378,7 @@ void helper_stackprot(CPUMBState *env, uint32_t addr) =20 env->ear =3D addr; env->esr =3D ESR_EC_STACKPROT; - cs->exception_index =3D EXCP_HW_EXCP; - cpu_loop_exit_restore(cs, GETPC()); + cpu_loop_exit_excp(cs, EXCP_HW_EXCP, GETPC()); } } =20 @@ -444,8 +431,7 @@ static void mb_transaction_failed_internal(CPUState *cs= , hwaddr physaddr, if (take) { env->esr =3D esr; env->ear =3D addr; - cs->exception_index =3D EXCP_HW_EXCP; - cpu_loop_exit_restore(cs, retaddr); + cpu_loop_exit_excp(cs, EXCP_HW_EXCP, retaddr); } } =20 diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 8b219afb5dd..9424208a04b 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -100,7 +100,7 @@ static void t_sync_flags(DisasContext *dc) =20 static void gen_raise_exception(DisasContext *dc, uint32_t index) { - gen_helper_raise_exception(tcg_env, tcg_constant_i32(index)); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(index)); dc->base.is_jmp =3D DISAS_NORETURN; } =20 --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573085; cv=none; d=zohomail.com; s=zohoarc; b=d8f8SA+OI1eHfo4RHQ7awrG11Wu0l2uKtyqgHymZZqRpDwN9oSzK1apGHioCI8rXy4abUgHuK+EXWIM27EhyjiBySQvgiLral0P18xt5Nvb40JFfl4JoqP7OBUf2gIFnRLdHuZLIlDa9u85FnDbil45wXXrEa7x4JsZWkZif8os= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573085; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8pmxoMbXEOAbY5ho9GIQBnFCO5MxHEqBgNN23qjbjmk=; b=nrOfI/ZII8U7vwcaejIY9vsRT4oTEDgvUwX0kYWJ/yrTCBsSx/S8tGApXKsr0/2GUVmPncu3iiPp+FJNglRBdaTKSH7CCyCmAsMiFFA2g5ceRDHUWZeGTRsbo34loQUkVnQEsiXyVFsk6EMXl1Ef9huBx1p8KH1VGlJfQIiY188= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573085285878.4493893572065; Sun, 27 Sep 2026 22:24:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3q9-000640-Sp; Mon, 28 Sep 2026 01:23:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3p2-0004Jd-Qf for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:22:42 -0400 Received: from mail-dl1-x122d.google.com ([2607:f8b0:4864:20::122d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3ox-0007xV-8T for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:22:40 -0400 Received: by mail-dl1-x122d.google.com with SMTP id a92af1059eb24-13fc403e373so3618893c88.1 for ; Sun, 27 Sep 2026 22:22:31 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.22.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:22:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572950; x=1791177750; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=8pmxoMbXEOAbY5ho9GIQBnFCO5MxHEqBgNN23qjbjmk=; b=P/XaW1pY+KIX0db2BIKsDlpYN1Az7r50VMuaz4/tIj1rZ1srUp39mt1K3VKevI327O S+fF885NNKw/t1RglnUXr5MYXzTq0KccvFoLHuip05obqIGiwxFCDUzy9XqnTlyaXag0 VIdz1ilTUwNMklmnQ++etO3a2fItwyM3tH/WrDX7VES1laTGIdR/MC0dUSfPXafEwjqs DVASbTfMFm87mD0mcoOOKvJBsF/zpL1xeZNniydwzg0MmYJVG01wvGuA7tlcscfCMfbN 0OqBu768GFL4OJUTDc+v9aHue7N0EiSlxcJLTZqackEK+DSwKyG8YspC7F0k2MCQtJtQ N3LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572950; x=1791177750; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=8pmxoMbXEOAbY5ho9GIQBnFCO5MxHEqBgNN23qjbjmk=; b=LrD8IAPET2mBDarAkYWoU5ZYUs98t+ofdchRUIdh0t6NzeCLRFjU6uIvF6itEASCQf s9wPOIjfsTAxs2QuRAYzwB4GwnNdTBU9EwDDc1WdB0IHTOu1m/lp2sHNJsF/9cmV+jCA FGlfFxKMFrPejHzbOPvo6H7VvnyjkHCRI7k0uCWskk3sDiBwpSqZwA3WUDaAGVzkan3T NrlK7XmMty3dmI5pkncUReh95H09Kt1HNmknTtTwHgvtqgIGVIL9XLH6s76MefMTWUUi 5bEB1cX6//LwF8UBQY/EYjYJetBXlmp/rxD8P7vadkqzrXbuEcHbh7KiZ3u3T/4jNJPa yV8g== X-Gm-Message-State: AFuF++kBZEZCJc/4hHl7msjy9e9pcRxqE0PXqIbZoZyOv3osyoJ+9EjW MZKuIGEoTPXdFP0rJRX/29L0nZJlIHBC/pQruTPJXZlmwdDCjjhvBn6WvmjjPdxTJi8= X-Gm-Gg: AYBFou0ofNhCTx6aI9h3U8giiYP/o5HcliNNomwJoATjv/VPfofnp3uNgyvtwkH9Wy6 95LtHQ7XgryQKE0N2VCZ3v7XovrCPuzvGtnm5blKMUs/JQPopT8JW/C6YtwiV+ystq4ipFyBOLH 5gZbPHD1/qEEDUSpxqJ3xP3kWDk9D0QTkKMM9jx49fCexjYGuqO7Kc+KcHugX9zucTEPe2k3vWZ BNZusc1DFzJDRqGQbb3fyD3RAzdfdbGaG0BdmDwc3LfnjSUIV2guNwFtX1NwxOAM91SKTzNoJ+D 29EtY8jnGJvK/OeLaAE4cMmIsO+CVhnNyc28BvuyH/1GFLBPRFeLTAYZOlZZlezqzKf2GAuoFkM UALtr7upFkNDJqeAJZYQ0q4d0BiURHwJvAnrAaRTCQCcFGFnWT3z09rEIlo6NXtW1M0OMpBwhFy RtOree0PJEqaUZkhwhe2i9o4IVVTRGaTKUdkG3nZ+FMVziRZlCZx7iF3dtdaOHUJ/3PxSz7JNb/ 1kujhj5Z2chWo1FgpkioF32UziNuwU= X-Received: by 2002:a05:701b:454e:20b0:148:bce6:429b with SMTP id a92af1059eb24-148bce64402mr4049554c88.8.1790572948987; Sun, 27 Sep 2026 22:22:28 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 11/24] target/sparc: convert raise_exception to raise_excp Date: Mon, 28 Sep 2026 13:20:37 +0800 Message-ID: <20260928052051.251-12-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::122d; envelope-from=luoyonggang@gmail.com; helo=mail-dl1-x122d.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573085951158500 Content-Type: text/plain; charset="utf-8" Translate through raise_excp after save_state. Drop TCG raise_exception. Keep C cpu_raise_exception_ra. Exit DEBUG and HLT through cpu_loop_exit_excp. Signed-off-by: Yonggang Luo --- target/sparc/helper.c | 21 +++------------------ target/sparc/helper.h | 2 -- target/sparc/translate.c | 6 +++--- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/target/sparc/helper.c b/target/sparc/helper.c index 8de261b0e30..411a8dfe359 100644 --- a/target/sparc/helper.c +++ b/target/sparc/helper.c @@ -27,26 +27,12 @@ =20 void cpu_raise_exception_ra(CPUSPARCState *env, int tt, uintptr_t ra) { - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D tt; - cpu_loop_exit_restore(cs, ra); -} - -void helper_raise_exception(CPUSPARCState *env, int tt) -{ - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D tt; - cpu_loop_exit(cs); + cpu_loop_exit_excp(env_cpu(env), tt, ra); } =20 void helper_debug(CPUSPARCState *env) { - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D EXCP_DEBUG; - cpu_loop_exit(cs); + cpu_loop_exit_excp(env_cpu(env), EXCP_DEBUG, 0); } =20 #ifdef TARGET_SPARC64 @@ -208,10 +194,9 @@ void helper_power_down(CPUSPARCState *env) CPUState *cs =3D env_cpu(env); =20 cs->halted =3D 1; - cs->exception_index =3D EXCP_HLT; env->pc =3D env->npc; env->npc =3D env->pc + 4; - cpu_loop_exit(cs); + cpu_loop_exit_excp(cs, EXCP_HLT, 0); } =20 target_ulong helper_rdasr17(CPUSPARCState *env) diff --git a/target/sparc/helper.h b/target/sparc/helper.h index 3a7f7dc1296..9fc38f5706a 100644 --- a/target/sparc/helper.h +++ b/target/sparc/helper.h @@ -53,8 +53,6 @@ DEF_HELPER_FLAGS_3(fcmpq, TCG_CALL_NO_WG, i32, env, i128,= i128) DEF_HELPER_FLAGS_3(fcmpeq, TCG_CALL_NO_WG, i32, env, i128, i128) DEF_HELPER_FLAGS_3(flcmps, TCG_CALL_NO_RWG_SE, i32, env, f32, f32) DEF_HELPER_FLAGS_3(flcmpd, TCG_CALL_NO_RWG_SE, i32, env, f64, f64) -DEF_HELPER_2(raise_exception, noreturn, env, int) - DEF_HELPER_FLAGS_3(faddd, TCG_CALL_NO_WG, f64, env, f64, f64) DEF_HELPER_FLAGS_3(fsubd, TCG_CALL_NO_WG, f64, env, f64, f64) DEF_HELPER_FLAGS_3(fmuld, TCG_CALL_NO_WG, f64, env, f64, f64) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 3156be6a94c..6dae5da7157 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1048,7 +1048,7 @@ static void gen_exception(DisasContext *dc, int which) { finishing_insn(dc); save_state(dc); - gen_helper_raise_exception(tcg_env, tcg_constant_i32(which)); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(which)); dc->base.is_jmp =3D DISAS_NORETURN; } =20 @@ -2811,7 +2811,7 @@ static bool do_tcc(DisasContext *dc, int cond, int cc, /* Trap always. */ if (cond =3D=3D 8) { save_state(dc); - gen_helper_raise_exception(tcg_env, trap); + gen_helper_raise_excp(tcg_env, trap); dc->base.is_jmp =3D DISAS_NORETURN; return true; } @@ -5833,7 +5833,7 @@ static void sparc_tr_tb_stop(DisasContextBase *dcbase= , CPUState *cs) if (e->npc % 4 =3D=3D 0) { tcg_gen_movi_tl(cpu_npc, e->npc); } - gen_helper_raise_exception(tcg_env, e->excp); + gen_helper_raise_excp(tcg_env, e->excp); =20 e_next =3D e->next; g_free(e); --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573021; cv=none; d=zohomail.com; s=zohoarc; b=nBfTyWxrhlIO+pYZlyrgIblmT/RttHi4sy3vvGSnBRG58sJkwxfStz+/U70i+cSFrEX3pRqrVmDdx/mLCMIwFUbh0K1FbOgMe9eHbeiX1r+BarfrN221hBlL2HxXWxlTkg2tIhNLp1SeUdWzbQ8rHwHWwDMaCkhuuCchCqnsDUU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573021; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=V7+TSeCs1OkWi/fweWHWaqMKw8c/A0ZiNHA+KMl1mwg=; b=dI26FN7JIxrqbRfCzjhEE32o/pQO9UC23VS35V8JW+3KWgCS4gP9ApoVbFjFvK4zJcWl3H/yvQ+W9sKjry9oAfmFEmQ6J57vpqFCVmck2eBm2CxTzRe49bj94cayDKW/J9MRrDPelLv7OqL5vDDsxWa5BUn6DjXWCqtxzUQCEPA= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573021782585.0575424643288; Sun, 27 Sep 2026 22:23:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3pg-0004zu-1K; Mon, 28 Sep 2026 01:23:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3p3-0004Jf-1I for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:22:42 -0400 Received: from mail-dl1-x1235.google.com ([2607:f8b0:4864:20::1235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3p0-0007y6-Vv for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:22:40 -0400 Received: by mail-dl1-x1235.google.com with SMTP id a92af1059eb24-144f79153f5so1389303c88.0 for ; Sun, 27 Sep 2026 22:22:37 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:22:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572957; x=1791177757; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=V7+TSeCs1OkWi/fweWHWaqMKw8c/A0ZiNHA+KMl1mwg=; b=Vn0NeLPBMnSS52QqrhG38ARaNza6N1yPkj1WMQHKQTb9dQDAotGMCOW+iYv6Utq+al ebmdFjKPZ5vtZpEhm50fHFUF5wH9fLrqBi5cRiIkLhjA2m2V3owLvI6lzvjLqNHKMSDy XiteJ/NAHUQyhhLgVk1cPIHTEvr54LyJDpTu3U2elDfQDtyO7hmFhKc4AXhOCp/y6NA0 5rwb+niHzcrfQMvvsrwhUhPu43XYqfkT1lAjZrM+f/otkaWffmnk9uA5xv7fZrVIscZM O7eUbVS+PKlMLisk0M5q12D12+GN8r3jkXhw6kaQchCSrmk1g25Rdi8LnsyOmHthBCoO Gb7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572957; x=1791177757; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=V7+TSeCs1OkWi/fweWHWaqMKw8c/A0ZiNHA+KMl1mwg=; b=kIQF96+1YST4ypyzD5wj5tlGIHgJ6SAjbJY2mj+C5opc9PGD+wPUp0UhWFQGTdqziT e+ze62zw17TOkIrpfIYuiXwcp/y0Rn5efu5Qd6Qj/ACfHEVHtDZCOKIylkZNt9HtJk6o +kTlJp5Ae2UwVzmbnB5A169lnIK00WLkDrO7fP0ewtorVPtE4QZr7yTGnR43QS4Mqo4x mZ+lY87TS+gwT8RiAOt1ynlBt+BwfoGuKbkhkQWFIe3SdvMuVPSOKQdezrdnQtnJ8+fn XvZisD8GEbsJbZlajEWuOpr2ZYFwBEscLCGnzyGFHlxgFFNPol4gleAzG2A4Ws+NbMMP 7ffA== X-Gm-Message-State: AFuF++mr9YAp7+HQPuFmrPhypWo1yhj2BFdPmJaOvymg+Sd06dkyRCHc OiJkvuv8rzY2vEtx+Kq0N6g3ytgG6PJEeE+qvcJb2z+JpkVTnNi1osskwTjWQcPGxLA= X-Gm-Gg: AYBFou13s+mbv+1tZhl8So2EUvYyR8jf70HFlcauq/KdDni5j3LIDfSBi/HK7oYEsqm wjZ4fYXvlo1Y64KKjrxFGIgYk9PC4ZHlDQM7ovkiRpjdywycZAS8FeEFQj+rC9axdQ7MkOOk3Hf DVKpPqLMbp5HG4WEgnVtZT4ghQGEykxTr+wdJJ/hQiHMWJJQdH9/32F1Fmq279PGZeZHI3ijVfH yBD4jP64lCh+r/NJAZqWylReYtrV0/4Gxjpy168hDJclTZkXJy7Bjt5aHjZ70ae77qskJPcocGQ Jot0bJhueX4ttG0dTZrW1Z+jHBn0QOaJn75pSGkQNLmTkjNyyS3kmveXAK9ASpQiVvMbjNBQ/XU nTghH4wv3vHwqW3DFnJQ1ZgSFaGCRyCt07r9edGc1lhtDrvQygn4emJc8HisnabCdbJRrP/Yfab +G70Q/QVc8L7sN1qkGnwK2r2K+B6Gxtfo/2j8QM6gMCjxKzryyAPUE96P5V52Tn/y2ZXZtkgR2l lnIryrmL2zguMQkOBJOeLfYFS92h4E= X-Received: by 2002:a05:7022:f508:b0:143:3769:c680 with SMTP id a92af1059eb24-146d0d46e43mr6412033c88.25.1790572956658; Sun, 27 Sep 2026 22:22:36 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 12/24] target/loongarch: convert raise_exception to raise_excp Date: Mon, 28 Sep 2026 13:20:38 +0800 Message-ID: <20260928052051.251-13-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1235; envelope-from=luoyonggang@gmail.com; helo=mail-dl1-x1235.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573023513158500 Content-Type: text/plain; charset="utf-8" Translate through raise_excp_restore after storing PC. Drop TCG raise_exception. Keep C do_raise_exception and use cpu_loop_exit_excp. Signed-off-by: Yonggang Luo --- target/loongarch/tcg/helper.h | 2 -- target/loongarch/tcg/op_helper.c | 6 ------ target/loongarch/tcg/tcg_cpu.c | 4 +--- target/loongarch/tcg/translate.c | 2 +- 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/target/loongarch/tcg/helper.h b/target/loongarch/tcg/helper.h index e76c73c7755..e3a7bc9e9da 100644 --- a/target/loongarch/tcg/helper.h +++ b/target/loongarch/tcg/helper.h @@ -3,8 +3,6 @@ * Copyright (c) 2021 Loongson Technology Corporation Limited */ =20 -DEF_HELPER_2(raise_exception, noreturn, env, i32) - DEF_HELPER_FLAGS_3(asrtle_d, TCG_CALL_NO_WG, void, env, tl, tl) DEF_HELPER_FLAGS_3(asrtgt_d, TCG_CALL_NO_WG, void, env, tl, tl) =20 diff --git a/target/loongarch/tcg/op_helper.c b/target/loongarch/tcg/op_hel= per.c index f98fe4d4a16..109417b7503 100644 --- a/target/loongarch/tcg/op_helper.c +++ b/target/loongarch/tcg/op_helper.c @@ -16,12 +16,6 @@ #include /* for crc32 */ #include "cpu-csr.h" =20 -/* Exceptions helpers */ -void helper_raise_exception(CPULoongArchState *env, uint32_t exception) -{ - do_raise_exception(env, exception, GETPC()); -} - /* loongarch assert op */ void helper_asrtle_d(CPULoongArchState *env, target_ulong rj, target_ulong= rk) { diff --git a/target/loongarch/tcg/tcg_cpu.c b/target/loongarch/tcg/tcg_cpu.c index 4b1d44a1644..56ef0d912cc 100644 --- a/target/loongarch/tcg/tcg_cpu.c +++ b/target/loongarch/tcg/tcg_cpu.c @@ -69,9 +69,7 @@ void G_NORETURN do_raise_exception(CPULoongArchState *env, __func__, exception, loongarch_exception_name(exception)); - cs->exception_index =3D exception; - - cpu_loop_exit_restore(cs, pc); + cpu_loop_exit_excp(cs, exception, pc); } =20 #ifndef CONFIG_USER_ONLY diff --git a/target/loongarch/tcg/translate.c b/target/loongarch/tcg/transl= ate.c index 124dce62695..b7e8ce8a653 100644 --- a/target/loongarch/tcg/translate.c +++ b/target/loongarch/tcg/translate.c @@ -95,7 +95,7 @@ static void gen_nanbox_s(TCGv_i64 out, TCGv_i64 in) void generate_exception(DisasContext *ctx, int excp) { tcg_gen_movi_tl(cpu_pc, ctx->base.pc_next); - gen_helper_raise_exception(tcg_env, tcg_constant_i32(excp)); + gen_helper_raise_excp_restore(tcg_env, tcg_constant_i32(excp)); ctx->base.is_jmp =3D DISAS_NORETURN; } =20 --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573331; cv=none; d=zohomail.com; s=zohoarc; b=TTxWGOGklYc+XgXXPzzg+hz9NW/m7bE5knV7uHdY3UGhM07Y+iDV6KlfwVt+DoRGhsCl6sB4OkEucL9kCbK/1N/tvMBV9A7NgS/iyzyZGs569KNACK/gplk07+aKaRVvzVFYvr9IBEELbJfnYbsx6R18qAUtfuZji1HFR3XK/Sg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573331; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ids5FxiCP1WVUY4p2e0+a3JG0y7cRkgnrvmrK4lA6nA=; b=LZlKN8uf/7nOUZqzC/EiVQzKwE990jg/Ac5GRUFqT+tbDFyIClgqKiSzlGtqFWEEKkGbDfh6xl5m6eL6xcCLkcylYbgXM3eX02GZzzDMVTaiphwXrmmPI40kl1Cw8N+wzOnJjUGz0IIs2sTotcvntL9jji2Uyl5n6hSDWEe9zFk= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573331287947.719448665579; Sun, 27 Sep 2026 22:28:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3qI-0006sj-0q; Mon, 28 Sep 2026 01:23:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3pB-0004TR-Sv for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:22:51 -0400 Received: from mail-dl2-x0e.google.com ([2607:f8b0:4864:38::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3p8-0007zj-6q for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:22:49 -0400 Received: by mail-dl2-x0e.google.com with SMTP id a92af1059eb24-144efd1ea76so1368930c88.1 for ; Sun, 27 Sep 2026 22:22:45 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.22.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:22:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572964; x=1791177764; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ids5FxiCP1WVUY4p2e0+a3JG0y7cRkgnrvmrK4lA6nA=; b=dPBn48TPPmgbvA6/XmvyWooHWLaCTiRBU/RYiNLA6pmbI48GfPN84sDEyXizAcxr52 aYrVqtv0yJTtUaI+s9ld4QckAlIGU/C9X2NfPK/OjnEQwhGmGOQ630vGas6udjQvEVeg EGUxf2DlUH9GxeAE1KWjc3yfdd+kIupB7avuzfN7W8CFJxbr9rMc2brOR8ZfgjM/fwYh Im03k282qx79CNBZsluVj07Re0GBvbdnQErh3nZhBuyN6Nthdnz+H/iS+7N2Tn2Y0nXt Byrrcza52Bk6R/ICSouCJq/afYdQglnT+/1XQ3Sx8aPWTXNijIduBY57xvGBpYhomWre aZcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572964; x=1791177764; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ids5FxiCP1WVUY4p2e0+a3JG0y7cRkgnrvmrK4lA6nA=; b=axDuG3oFbnAy8tPrcw3kauD99nLm0yL/l5c7fsPpX4isod/iL/549tb6mUTtb3AuWT rwspSBSr0SP2LY8eBICK4zixepBN7clIgfBOXQk8gf2IjwmI669J9XVbu758wLb9xCI7 kXmEI3FG5wvoRWKtdfipgjZxsZLwZ1eRt0ep+44MIpy9I6lIelv7NLuqf1KIUI5ySlto lIM8EYyBPyWhDevT1rmKelKOPAw+8igmmPLO1mKcW9yuYQ89I+xBs7R4ANOSdwlIYz2y j9lmT12hc2feuH3wFkXMzLYhs94nVYjWjizUxoc5eiJcnrZHyx1oW9DQgN4VYP2d7H1W /sOA== X-Gm-Message-State: AFuF++l5vFpa9Te+go6d00exSTaZewZq25zvW6ev6vRao6HaCDB7RSVB utqWctnBW4kxWTnl+4m8xfyZdz7ZxaNdHv7fYiWLZcMbBdTospESSgzfz1aG7ncqPks= X-Gm-Gg: AYBFou1oCiWZMmx4emiF3LpWkkh+WDdaTgqN2QDhaag9Lcf5UD5UPsgANvAiyJqbUM1 RRDAwSw6m1E+iprKUAEaCg6tYkqV07rY6RIyHWWFCz/AjdmXCReRPJUPUqghMEIW9NxgAWOQqzX zcFXGWR5RNpDhkAgL77P5izh7NVHF7Oeq8xhmJ4VNFpDepVJ7Voc5PhkVGK+PWd5ijua840mG3o mfNqqSDP5VUluDew/83Ew26tnaadhWodNdjbN7Ivr0UeF/yX4VwmDZzcSGh6tzVWmwIjFLEn6tb z3GhdKyBrhuyoUy5NKSkNK+5f8l4Wa9btVmhQIKtv0QD4iaZ/cQKaDB1iiiYBo6v6MfRR+IIHli vhaifXhqTceBSCutlf9ApcbEwiG5kjeOyw8UxcXyc6gPoDsqoADyvLvlqiVAcDq3oMAE3N1/S9J SGJ7uW5XEkJz4E3u7ak4aNSijGsVDOJE6rMdYqrbtUkej1qg/CiSrPosY8Q8VNv4Z4J2eCfUHmQ 97jrEFEs6Rzg/tKenzXMCIpDFAeY4A= X-Received: by 2002:a05:7022:f902:10b0:144:eab0:9cbc with SMTP id a92af1059eb24-146d0495644mr8711535c88.37.1790572964367; Sun, 27 Sep 2026 22:22:44 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 13/24] target/hexagon: convert raise_exception to hexagon_raise_exception Date: Mon, 28 Sep 2026 13:20:39 +0800 Message-ID: <20260928052051.251-14-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::e; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x0e.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573332747158500 Content-Type: text/plain; charset="utf-8" Fold C do_raise_exception into hexagon_raise_exception_err with vaddr pc and a retaddr parameter, and exit via cpu_loop_exit_excp. Prefix leftover TCG raise_exception to hexagon_raise_exception so translate keeps the CPU_LOG_INT log and ASSERT_DIRECT_TO_GUEST_UNSET. Reviewed-by: Brian Cain Signed-off-by: Yonggang Luo --- target/hexagon/cpu.c | 13 +++++++------ target/hexagon/cpu.h | 2 +- target/hexagon/helper.h | 3 ++- target/hexagon/internal.h | 5 ----- target/hexagon/macros.h | 2 +- target/hexagon/op_helper.c | 29 +++++++++++------------------ target/hexagon/translate.c | 11 ++++++----- 7 files changed, 28 insertions(+), 37 deletions(-) diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 1f7d8a8df70..3739f3f4561 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -342,7 +342,7 @@ static TCGTBCPUState hexagon_get_tb_cpu_state(CPUState = *cs) } if (pc & PCALIGN_MASK) { env->cause_code =3D HEX_CAUSE_PC_NOT_ALIGNED; - hexagon_raise_exception_err(env, HEX_EVENT_PRECISE, pc); + hexagon_raise_exception_err(env, HEX_EVENT_PRECISE, pc, 0); } =20 #ifndef CONFIG_USER_ONLY @@ -734,14 +734,15 @@ static bool hexagon_tlb_fill(CPUState *cs, vaddr addr= ess, int size, return false; } raise_perm_exception(cs, address, slot, access_type, excp); - do_raise_exception(env, cs->exception_index, env->gpr[HEX_REG_PC], - retaddr); + hexagon_raise_exception_err(env, cs->exception_index, + env->gpr[HEX_REG_PC], retaddr); } if (probe) { return false; } raise_tlbmiss_exception(cs, address, slot, access_type); - do_raise_exception(env, cs->exception_index, env->gpr[HEX_REG_PC], ret= addr); + hexagon_raise_exception_err(env, cs->exception_index, + env->gpr[HEX_REG_PC], retaddr); } =20 #include "hw/core/sysemu-cpu-ops.h" @@ -784,8 +785,8 @@ void hexagon_cpu_do_unaligned_access(CPUState *cs, vadd= r addr, CPUHexagonState *env =3D cpu_env(cs); =20 raise_misaligned_exception(cs, addr, 0, access_type); - do_raise_exception(env, cs->exception_index, env->gpr[HEX_REG_PC], - retaddr); + hexagon_raise_exception_err(env, cs->exception_index, + env->gpr[HEX_REG_PC], retaddr); } =20 #endif diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index df4c0182247..1edcc3ef6c3 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -232,7 +232,7 @@ FIELD(TB_FLAGS, HVX_COPROC_ENABLED, 5, 1) =20 G_NORETURN void hexagon_raise_exception_err(CPUHexagonState *env, uint32_t exception, - uintptr_t pc); + vaddr pc, uintptr_t retaddr); =20 #ifndef CONFIG_USER_ONLY /* diff --git a/target/hexagon/helper.h b/target/hexagon/helper.h index 71c8da4c46d..6cd63f631b7 100644 --- a/target/hexagon/helper.h +++ b/target/hexagon/helper.h @@ -18,7 +18,8 @@ #include "internal.h" #include "helper_protos_generated.h.inc" =20 -DEF_HELPER_FLAGS_3(raise_exception, TCG_CALL_NO_RETURN, noreturn, env, i32= , i32) +DEF_HELPER_FLAGS_3(hexagon_raise_exception, TCG_CALL_NO_RETURN, noreturn, + env, i32, vaddr) DEF_HELPER_2(commit_store, void, env, int) DEF_HELPER_3(gather_store, void, env, i32, int) DEF_HELPER_1(commit_hvx_stores, void, env) diff --git a/target/hexagon/internal.h b/target/hexagon/internal.h index 05d1129916e..4b7a784fbc7 100644 --- a/target/hexagon/internal.h +++ b/target/hexagon/internal.h @@ -36,11 +36,6 @@ extern const char * const hexagon_sregnames[]; extern const char * const hexagon_gregnames[]; #endif =20 -void G_NORETURN do_raise_exception(CPUHexagonState *env, - uint32_t exception, - uint32_t PC, - uintptr_t retaddr); - #define hexagon_cpu_mmu_enabled(env) ({ \ HexagonCPU *cpu =3D env_archcpu(env); \ cpu->globalregs ? \ diff --git a/target/hexagon/macros.h b/target/hexagon/macros.h index a5b9c24c6bb..4a87f6d72f1 100644 --- a/target/hexagon/macros.h +++ b/target/hexagon/macros.h @@ -637,7 +637,7 @@ static inline TCGv gen_read_ireg(TCGv result, TCGv val,= int shift) #ifdef CONFIG_USER_ONLY #define fTRAP(TRAPTYPE, IMM) \ do { \ - hexagon_raise_exception_err(env, HEX_EVENT_TRAP0, PC); \ + hexagon_raise_exception_err(env, HEX_EVENT_TRAP0, PC, 0); \ } while (0) #endif =20 diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 4f00ca773f3..dfdb597f3fc 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -72,31 +72,24 @@ uint64_t HELPER(utimer)(void) #define SF_MANTBITS 23 =20 /* Exceptions processing helpers */ -G_NORETURN -void do_raise_exception(CPUHexagonState *env, uint32_t exception, - uint32_t PC, uintptr_t retaddr) +G_NORETURN void hexagon_raise_exception_err(CPUHexagonState *env, + uint32_t exception, + vaddr pc, uintptr_t retaddr) { CPUState *cs =3D env_cpu(env); - qemu_log_mask(CPU_LOG_INT, "%s: 0x%08" PRIx32 ", @ %08" PRIx32 "\n", - __func__, exception, PC); + qemu_log_mask(CPU_LOG_INT, "%s: 0x%08" PRIx32 ", @ %08" VADDR_PRIx "\n= ", + __func__, exception, pc); ASSERT_DIRECT_TO_GUEST_UNSET(env, exception); =20 - env->gpr[HEX_REG_PC] =3D PC; - cs->exception_index =3D exception; - cpu_loop_exit_restore(cs, retaddr); -} - -G_NORETURN void hexagon_raise_exception_err(CPUHexagonState *env, - uint32_t exception, - uintptr_t pc) -{ - do_raise_exception(env, exception, pc, 0); + env->gpr[HEX_REG_PC] =3D pc; + cpu_loop_exit_excp(cs, exception, retaddr); } =20 -G_NORETURN void HELPER(raise_exception)(CPUHexagonState *env, uint32_t exc= p, - uint32_t PC) +G_NORETURN void HELPER(hexagon_raise_exception)(CPUHexagonState *env, + uint32_t exception, + vaddr pc) { - hexagon_raise_exception_err(env, excp, PC); + hexagon_raise_exception_err(env, exception, pc, 0); } =20 void log_store32(CPUHexagonState *env, target_ulong addr, diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 827859e052c..3bef721d7d8 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -138,11 +138,12 @@ intptr_t ctx_tmp_vreg_off(DisasContext *ctx, int regn= um, return offset; } =20 -static void gen_precise_exception(int cause, uint32_t PC) +static void gen_precise_exception(int cause, vaddr pc) { tcg_gen_movi_i32(hex_cause_code, cause); - gen_helper_raise_exception(tcg_env, tcg_constant_i32(HEX_EVENT_PRECISE= ), - tcg_constant_i32(PC)); + gen_helper_hexagon_raise_exception(tcg_env, + tcg_constant_i32(HEX_EVENT_PRECISE), + tcg_constant_vaddr(pc)); } =20 #ifndef CONFIG_USER_ONLY @@ -1139,11 +1140,11 @@ static void update_exec_counters(DisasContext *ctx) */ static void check_imprecise_exception(DisasContext *ctx) { - TCGv PC =3D tcg_constant_tl(ctx->pkt.pc); TCGLabel *label =3D gen_new_label(); =20 tcg_gen_brcondi_tl(TCG_COND_EQ, hex_imprecise_exception, 0, label); - gen_helper_raise_exception(tcg_env, hex_imprecise_exception, PC); + gen_helper_hexagon_raise_exception(tcg_env, hex_imprecise_exception, + tcg_constant_vaddr(ctx->pkt.pc)); gen_set_label(label); } #endif --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573173; cv=none; d=zohomail.com; s=zohoarc; b=kRV+XuVcCRlSPryY42v/Y4QNNQuTu1Zs/mJVM589bOmslRBPtMssEaGOXhTS4WL5mK3GNPJhXtGYUx93SyMjpZ5E/qtIeCE5Essntczx861YonaSGCCfeT9ISRlV1+SYGbDxWUjyQuzHfWm5MiXToyq5J3cLa5nrdoE+Xc8fscM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573173; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jpkLTvTgBgGnWurAPOow78Me06rebiMfwPT2zkt0F0A=; b=I/rDqoUdc74X3LvXwYSapnc9nSICz492NnGUvTzIsVIeYzNMzKC4hVq9XkIi6T6IyXIQXb+vW0sU78IbCp9dXhHlqSWMBA6rkUnUhhdDwAb+Q3YlsE2MgcbOm6gOYZWI1ZwiCKy6jC9pP6tfaXMCLUKS+LAHaew3AK7S3JYuDtE= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573173084185.54058062981744; Sun, 27 Sep 2026 22:26:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3qF-0006cQ-1A; Mon, 28 Sep 2026 01:23:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3pI-0004dp-J2 for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:22:59 -0400 Received: from mail-dl1-x122b.google.com ([2607:f8b0:4864:20::122b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3pF-00080o-Pk for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:22:56 -0400 Received: by mail-dl1-x122b.google.com with SMTP id a92af1059eb24-13fc403e373so3619153c88.1 for ; Sun, 27 Sep 2026 22:22:53 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.22.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572972; x=1791177772; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=jpkLTvTgBgGnWurAPOow78Me06rebiMfwPT2zkt0F0A=; b=JLvSY6tCoLsc54aCegAqWDzdlH8bSpMMEiS6AyMY7hJZgWpik+fAP1cawYYnoII+VN 9PeicaeqShJf3WXcuqQ1mqIVY6Pk39Vuo9T2NDqA2H8HQEo4DoFKVZfD7c4MGI3nIyaK gUS99RcJ4PVYJTrggI3T33RjZCdjOymJJ4wsyCd06Y4z2lMuQooPX3NcM4n7UziwPYW+ h+jmzuhW2NqetSPf6SMoMmmQb+KkVTrliddrj0mOA5ymV2bYXrm+2vS2adWtylZPzZjG xZWpAW/prD6LTqQr28AbHCcu//qhlZOBdrvaerSFWy8ZIBI2FN9Kx9qIbRIjAv55hMPD GDtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572972; x=1791177772; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=jpkLTvTgBgGnWurAPOow78Me06rebiMfwPT2zkt0F0A=; b=kn8Cih8eoQNukiSACsbgr/4UGf0nXtugk3ZrwB5oCxLu7u0WEu9d9rBD01UB3CM+Gn WIXIFo9yEOou0cAnVT5WaTIkc8t5lLajw4vfOtMnMyd6C0CST7HDt/snz5EVAR8686cL iwLRYkbEwRUZr6CI4H3/9ewuJTIWP9MVjSw8SZlbWdNKWKmyvNBHa+FgdnrU8WthiChK vZTQ3AkYf9qFGs7LHkv0HDjh4Xb+cTL3CF+EMmlTKAahN0K6TiHxVyyvrhdxMbSpF8S+ mnYOv3if3jQTZorplV6+lKmqBcCrVErbt4NqecwJdDgYa403NFjU2iHbmM3K6y0Jo514 +XbA== X-Gm-Message-State: AFuF++laKz27hwz2BzbZ1aNU9mDykqvStJlBfzVnwwkmmBfI1GgmbeyR nfMvRpUFeo1FogXYLz2fgMTIZTttr/FucGqYi67Qg5ZA79rwsCCiISpLoRrvWFHyk1M= X-Gm-Gg: AYBFou1bDdx6lPUO3rNjuM+Oscb7UKk8dCJzsuV1FBMSRPMKksJujlWKSLp2aJEOeqI MJnINJuMWQgRbdE2rCkglIx2GJrl32YZCcYb2Rs51ff3+2/vhw3ga5unV86TNsQ75LW44ZlJDPX 3LHxCwN6yb1z2b3uC9z9+DdlAERGxkAcnHQlJ+/zFzZtrrcprQEY7P4RwkXvHrvb/YOtoVvzRIn cHEVYAuZzU3wCnge4WLlMgfU0rq/eoepbay74msT5f7J4aqamNr9n7Cj2jEihOCzwdVrxhpYWCl 5Oc65ZXh6iS9baJFwZ0Okdx4Wa3VRR1Ck5qHl5dtOfwvurw1a+M4Oh7tczSG/RcKbEx1SvQzP+K pNaks65kNpmb49Yxbop2YM7lIICVfrGKUgrcCOmJjC2Zlw9w8ZwrisM0I2seZYtNmHcuG82+pGv AXwzY6jf5DtMgOlVIuLML0vbhuCf3j9BPpXRRL4ok3jaCgvlQBFJT1UiwfafObvhuvqxIbwR6H7 rzt3abu9CE4/voHNJDIu0C5i75BNQc= X-Received: by 2002:a05:7022:504:b0:143:1bb1:3300 with SMTP id a92af1059eb24-146d02a9edbmr12364539c88.17.1790572972013; Sun, 27 Sep 2026 22:22:52 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 14/24] target/hppa: convert excp to raise_excp Date: Mon, 28 Sep 2026 13:20:40 +0800 Message-ID: <20260928052051.251-15-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::122b; envelope-from=luoyonggang@gmail.com; helo=mail-dl1-x122b.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573174150158500 Content-Type: text/plain; charset="utf-8" Drop TCG excp and call raise_excp. Keep C hppa_dynamic_excp and use cpu_loop_exit_excp. Route leftover C callers through hppa_dynamic_excp instead of helper_excp. Signed-off-by: Yonggang Luo --- target/hppa/helper.h | 2 -- target/hppa/op_helper.c | 15 ++------------- target/hppa/sys_helper.c | 4 ++-- target/hppa/translate.c | 2 +- 4 files changed, 5 insertions(+), 18 deletions(-) diff --git a/target/hppa/helper.h b/target/hppa/helper.h index 8369855d78e..5ed39e01e31 100644 --- a/target/hppa/helper.h +++ b/target/hppa/helper.h @@ -1,5 +1,3 @@ -DEF_HELPER_2(excp, noreturn, env, int) - DEF_HELPER_FLAGS_3(stby_b, TCG_CALL_NO_WG, void, env, tl, tl) DEF_HELPER_FLAGS_3(stby_b_parallel, TCG_CALL_NO_WG, void, env, tl, tl) DEF_HELPER_FLAGS_3(stby_e, TCG_CALL_NO_WG, void, env, tl, tl) diff --git a/target/hppa/op_helper.c b/target/hppa/op_helper.c index 76a8d8a0d34..c4651f0d85a 100644 --- a/target/hppa/op_helper.c +++ b/target/hppa/op_helper.c @@ -30,20 +30,9 @@ #include "user/page-protection.h" #endif =20 -G_NORETURN void HELPER(excp)(CPUHPPAState *env, int excp) -{ - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D excp; - cpu_loop_exit(cs); -} - G_NORETURN void hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t r= a) { - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D excp; - cpu_loop_exit_restore(cs, ra); + cpu_loop_exit_excp(env_cpu(env), excp, ra); } =20 static void atomic_store_mask32(CPUHPPAState *env, target_ulong addr, @@ -341,7 +330,7 @@ target_ulong HELPER(probe)(CPUHPPAState *env, target_ul= ong addr, if (excp =3D=3D EXCP_DTLB_MISS) { excp =3D EXCP_NA_DTLB_MISS; } - helper_excp(env, excp); + hppa_dynamic_excp(env, excp, 0); } return (want & prot) !=3D 0; #endif diff --git a/target/hppa/sys_helper.c b/target/hppa/sys_helper.c index 88109f0181a..dd3be1bfc90 100644 --- a/target/hppa/sys_helper.c +++ b/target/hppa/sys_helper.c @@ -51,13 +51,13 @@ void HELPER(write_interval_timer)(CPUHPPAState *env, ta= rget_ulong val) void HELPER(halt)(CPUHPPAState *env) { qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); - helper_excp(env, EXCP_HLT); + hppa_dynamic_excp(env, EXCP_HLT, 0); } =20 void HELPER(reset)(CPUHPPAState *env) { qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); - helper_excp(env, EXCP_HLT); + hppa_dynamic_excp(env, EXCP_HLT, 0); } =20 target_ulong HELPER(swap_system_mask)(CPUHPPAState *env, target_ulong nsm) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 41300c0dd73..35766e6ee06 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -726,7 +726,7 @@ static void install_link(DisasContext *ctx, unsigned li= nk, bool with_sr0) =20 static void gen_excp_1(int exception) { - gen_helper_excp(tcg_env, tcg_constant_i32(exception)); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(exception)); } =20 static void gen_excp(DisasContext *ctx, int exception) --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573244; cv=none; d=zohomail.com; s=zohoarc; b=c80vSUnRmAS57yThyMMSvnX0IVlWig2A54ozxD5Vfleqqkvg+FSSG/2NJFCVGpTq92sCtCVcx2rugHGpu+54cBlYglj/DXMIVieZQXuZ+SsuztzSrIDljln9aUMcRXXNV4tHe24pvqghGsMJgjAgipqB9huTTz2ZyA7ty2NLOkw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573244; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6BAn3e898xbc3rDUsn8jFYdwVTPtq1IAOzdpRZ1Zvbc=; b=gTteOo5zU8Q4bPDbsQQjqPSn6nadL4aRUpXJa7SZzE0Jt6uFeSqBgsFTNOd0pwbBsTWvyU1GBPXXqNONvAiOg5lOX0V7r7wdvaooEGYphpQE+dFon8K6IoArdaNEz5rk3qaUfmBOsZV6gIpa4AjtG0cYSNmKilAAbynpr8Vdj2U= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573244329146.69045143387643; Sun, 27 Sep 2026 22:27:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3sC-0008Em-EW; Mon, 28 Sep 2026 01:25:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3pS-0004ql-9f for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:23:06 -0400 Received: from mail-dl2-x0e.google.com ([2607:f8b0:4864:38::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3pO-00082L-T5 for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:23:05 -0400 Received: by mail-dl2-x0e.google.com with SMTP id a92af1059eb24-144d60be6b0so1440236c88.0 for ; Sun, 27 Sep 2026 22:23:01 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.22.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572980; x=1791177780; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=6BAn3e898xbc3rDUsn8jFYdwVTPtq1IAOzdpRZ1Zvbc=; b=LRYXpddysGpapTSQO9GR+N19Qy5L5fXH3U088x3o+5rdPaVqmusYHG4RnK5jgGmGKM qZIL+iIW+9rcWyvgC74tcBdZ7RTycOi6/mVwi+Rmvx8HIlC0mFf0ngB99ETzdtXmIrYo xP+lSvOvRMD3b3/FK0EJ9BJ//E65uuI1xJC9NGG1Jdm6nazg1CdDtq/BsZws1U7QOAt/ tkV8lvFt79GywDbpGAX+WbityabWNSWKhXVpFIhJvE0Udg5k4Or/XcabbqW+5n5xXTvC aBuAWMOxdXfK05urMst/it9m/dqnEQbW6fG4JT3ONWwh9H/4OiYORkwuby4DBtkscPAw 1X/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572980; x=1791177780; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=6BAn3e898xbc3rDUsn8jFYdwVTPtq1IAOzdpRZ1Zvbc=; b=O7qJA3kVYEzLar92EqpaApIDLSTPfPIDDo7ma6yJuXfQ5Bq4KeY/8LoMcBHW1UDuWi 3jhWNBngRtWs+67BMv6qEYr7OyPe1HPq/qG3KaqJameOFCyNfzOOqYmnvGCYkW7qu4DO 7Kbjtev4E49GoKjn/wSeFJ/5YM5exVpgH1ymBdJH0tTfRGq2ZdkY0Nb/ivIk3Bpft+zC m/X/7jH8G8fuHueLHdSWZkmVeptNaPT47Futl8EWf/POvwe2se0bJl9clM/Wkiee6Vuw QKDS0QChoCg4jW0LNCuljt2+ZuFHYDBPOLtKZ3tjvkqI2R+FAJ4sBqvMsBv1i4asXPZ4 wpeg== X-Gm-Message-State: AFuF++lyi21XRK6oYTCfqoiMDRiQABJZ7+O68Byqi06eE3kdOHfQTTQD OnB63xMFrlaYVvn0oYfeWw1SenZ34lthqcAG+Pi2O/RmOIa5Q6RmZqnEh1ysPs2K7bk= X-Gm-Gg: AYBFou2YosLEf2vHLOasuKQPlvqHWkfv6QO8+Bkb/4U3OVwfJ7mWwulPc3V3/Xl2XTJ jJT1SkkEWEkBLs7aGnjejbRX2ZLsxXuxXtuH7ea3ELJSohiYbukykNEwMI1nxzYYTfkzdQTB+C2 a5F5jPV76VrhLUQZ6LYh4HaNYGjvGMi84o28GVSah5cGs2zF5aNLuVs0v8SfJ23OC4lr3S01fdT 5ppzerG/CIMu9hVaC8yEiwOEpeDaolGWSwv1+L9S1qwIccPo6vOWOgX8v3+ouBSAymykGai6g00 W0d+zUAJFYpQ5oNq2kaU2C81qDz2cto6ITTQmGoejgxEyL0C2bk6YL2H/QJW7d3pJU5BuD256nO PQV8EKy2MbVLU93RECGnwg0MmIyPHTohbcAUKx/zYpp2B+58oL8g3A2BhRjWIUhtx9QhFP2tjKI 9ztruv1/NQOw+snaxnPr8mm2dA9hVx9kJq4UL9yKd6EZr4LkPRMXmkKZjdrTLgoME4qYfz18Mh/ UEIywT6MnNIAO+sMgt4VZYEyGGTuEE= X-Received: by 2002:a05:7022:7f11:b0:149:49c:234 with SMTP id a92af1059eb24-149049c046bmr3963937c88.24.1790572979615; Sun, 27 Sep 2026 22:22:59 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 15/24] target/alpha: convert excp to raise_excp Date: Mon, 28 Sep 2026 13:20:41 +0800 Message-ID: <20260928052051.251-16-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::e; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x0e.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573246556158500 Content-Type: text/plain; charset="utf-8" Store error_code in translate, then call raise_excp. Drop TCG excp. Keep C dynamic_excp and arith_excp. Signed-off-by: Yonggang Luo --- target/alpha/helper.c | 11 ----------- target/alpha/helper.h | 1 - target/alpha/translate.c | 8 +++----- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/target/alpha/helper.c b/target/alpha/helper.c index c3614ecafda..d1497547181 100644 --- a/target/alpha/helper.c +++ b/target/alpha/helper.c @@ -533,17 +533,6 @@ void alpha_cpu_dump_state(CPUState *cs, FILE *f, int f= lags) qemu_fprintf(f, "\n"); } =20 -/* This should only be called from translate, via gen_excp. - We expect that ENV->PC has already been updated. */ -G_NORETURN void helper_excp(CPUAlphaState *env, int excp, int error) -{ - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D excp; - env->error_code =3D error; - cpu_loop_exit(cs); -} - /* This may be called from any of the helpers to set up EXCEPTION_INDEX. = */ G_NORETURN void dynamic_excp(CPUAlphaState *env, uintptr_t retaddr, int excp, int error) diff --git a/target/alpha/helper.h b/target/alpha/helper.h index 954a5c8294c..cdb36384a7b 100644 --- a/target/alpha/helper.h +++ b/target/alpha/helper.h @@ -1,4 +1,3 @@ -DEF_HELPER_3(excp, noreturn, env, int, int) DEF_HELPER_FLAGS_1(load_pcc, TCG_CALL_NO_RWG_SE, i64, env) =20 DEF_HELPER_FLAGS_3(check_overflow, TCG_CALL_NO_WG, void, env, i64, i64) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index c66e3f9c146..91941e5be8f 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -264,11 +264,9 @@ static void gen_pc_disp(DisasContext *ctx, TCGv_i64 de= st, int32_t disp) =20 static void gen_excp_1(int exception, int error_code) { - TCGv_i32 tmp1, tmp2; - - tmp1 =3D tcg_constant_i32(exception); - tmp2 =3D tcg_constant_i32(error_code); - gen_helper_excp(tcg_env, tmp1, tmp2); + tcg_gen_st_i32(tcg_constant_i32(error_code), tcg_env, + offsetof(CPUAlphaState, error_code)); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(exception)); } =20 static DisasJumpType gen_excp(DisasContext *ctx, int exception, int error_= code) --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573301; cv=none; d=zohomail.com; s=zohoarc; b=iSCp9JlLijAWLTKHxk6yycedcaWXe4kXQrit7ADLk4Ob6hj5oevwmKvjtAbZX72ACqtPOWjlrCFTS6BoGXPwAYz0ss9zo2GVhS5rmNhUSnFTUgzjTbKvGS7e3x7xAGnGqD/Qk26B7nB8rMdmgoJoWuGIKaaJskThMZJawYjR97M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573301; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=X7b/dJOQ8n/cIrrEJW6O4TLysukMn1IvMkhhR/OEoxQ=; b=lR8hAjLAY4jY1iE/y62DUA3pVTkGu1+CrXdxmbNGhOe2pEw429/J+D0I89ldkvFyx1HREBgBm/kc/t09rgMbsKLsyYlNdEMFdxSUgYQpm7ZzAiJTyXNn8/ABtx6abUKQ7SixB+iCcPgJYirgpjeFfq6OlyQ7gcuo4iG6d/KHn7c= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573301836410.65094801452585; Sun, 27 Sep 2026 22:28:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3s7-00089l-OF; Mon, 28 Sep 2026 01:25:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3pZ-000521-IE for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:23:16 -0400 Received: from mail-dy2-x0d.google.com ([2607:f8b0:4864:36::d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3pV-00084D-5d for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:23:11 -0400 Received: by mail-dy2-x0d.google.com with SMTP id 5a478bee46e88-3468ec309afso490218eec.3 for ; Sun, 27 Sep 2026 22:23:08 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:23:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572987; x=1791177787; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=X7b/dJOQ8n/cIrrEJW6O4TLysukMn1IvMkhhR/OEoxQ=; b=lfiLcw5UZ/T7HoYu1TtdOUTAZIjz9/0cW/lXa2/uuu3x1WOh+Z0wDczEZIyViy+j64 sZ2b/bqlau8grh3ri2Ffb4Xyi4vvuPpIpLPsUGPr/dQ4fYYnEKg0Vj6FHMhDFJn56Kzi IpsuzvI+E94Pgul2zzz1wgY3fdxbF+C2OiljE20TDIAPlKxN+fQn4Dbihns5H+aZN0ik 8oQZobtdoeTzmJQi++68lgKAF6s8IcHgyfC5u2mKsB89FqZZeT7jIWi5KTHLnlpGo3U5 oGx4HNXcilJwdmoN+yxWxO9LZGadodPvVbSvmEspxMMvPBK0ytK2yTv2NgMGXiyG6pyH zHKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572987; x=1791177787; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=X7b/dJOQ8n/cIrrEJW6O4TLysukMn1IvMkhhR/OEoxQ=; b=NBC/1sUyF1Rjvn/7/oiyB7DnWIQMaaDEoglXyg/ertKtgU7FcvDHOmWaXfc3Wvc32F FJSw5tspJ5+hrUIqlTCuLVHJl0Pda7VetD8FRsetPtlsou51nkrTOOWfHct0oaHA/8JV vuoHkqxC/wcbzBBQIYamhPBhB7BBbCcdLyWVyAbJrDGQkTL05/wjsQjwbCdzsdFYq9mf vtWtS5T9uabwPlJKS21IyJleFMybEO1Cc6jqdnNJWiRw7LvTSAQbv/dyQhGK0R/1mjzc W6QiPszbkOCI0fjFcB3uPXY4YqPVBCnsoSwhVUk4dE5NZ9qMZRQrVyDlpU/qCfrP68AM Rohw== X-Gm-Message-State: AFuF++kU1nweNfUU5NJj8/fz4fzKoej6Fa0W0fA9uqPOkSPyfh2NmAoA TnJUWKd6uP9TYsYbgtQUXzRnRZvSLybN4UG23OY76IF3zHEfsXQFbRlN7Ou1krFSfis= X-Gm-Gg: AYBFou1QecbljvyN8wjeCZSQ/pkooUTUN6CaOeMP8n96wRRL/xJXZe8PtvYzuY5nc/j gKUJmzlLpVDMc6N4SOHDslYFCl19AEkuH32zd+1+Lxel+MR/SnTCPkg1S9nAWGbPQ6LuWt2dIVD iTvtf+KQu9L0WjQCNlI8F2FRlnGpFPtqy74Lbz8GxogJjGWmMdIl6dXbYCDPJMkRhdQEmFFsZNm uXTN/x1LWSBlZxOywUnTkiUaprBTHF3odyMcSvIKs8IgrpoOCBvvOIB07igQwVv7RdRZc+OFuEb kconjPnOdRjY3/76xyCCN9DKHWM9p3Xl3iHRcRCVihCtyU5o1GUT1xx5GHIBc+p00MMwGWd3uE9 2LJvROyLuDVqlIQOPY/NOJDfTwsdMgmtcdL+i+6K7ks6FEcURI0rDgYisjAxsw8fgJAEUmBkUeR xoGyoVS1cITs/Jw23KvEtoiR3hYyB6xSMR0xhZvJsf13oxRjtv14oQrZs6w+7lgyg1DFIQLfAAs FSKEwpLKHxYPr5/+T4Of56Fl7wgRoA= X-Received: by 2002:a05:701b:281b:b0:144:f4b9:9be4 with SMTP id a92af1059eb24-146ce492cb6mr7528924c88.15.1790572987367; Sun, 27 Sep 2026 22:23:07 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 16/24] target/s390x: convert exception to raise_excp Date: Mon, 28 Sep 2026 13:20:42 +0800 Message-ID: <20260928052051.251-17-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:36::d; envelope-from=luoyonggang@gmail.com; helo=mail-dy2-x0d.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, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573302689158500 Content-Type: text/plain; charset="utf-8" Drop TCG exception and call raise_excp. Keep data_exception. Route leftover C SVC execute through cpu_loop_exit_excp. Signed-off-by: Yonggang Luo Reviewed-by: Ilya Leoshkevich --- target/s390x/helper.h | 1 - target/s390x/tcg/mem_helper.c | 2 +- target/s390x/tcg/misc_helper.c | 10 ---------- target/s390x/tcg/translate.c | 2 +- 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 6a7426fdac7..ec27ef104f2 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -1,4 +1,3 @@ -DEF_HELPER_2(exception, noreturn, env, i32) DEF_HELPER_2(data_exception, noreturn, env, i32) DEF_HELPER_FLAGS_4(nc, TCG_CALL_NO_WG, i32, env, i32, i64, i64) DEF_HELPER_FLAGS_4(oc, TCG_CALL_NO_WG, i32, env, i32, i64, i64) diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c index 414e6838c87..3f754dac00f 100644 --- a/target/s390x/tcg/mem_helper.c +++ b/target/s390x/tcg/mem_helper.c @@ -2488,7 +2488,7 @@ void HELPER(ex)(CPUS390XState *env, uint32_t ilen, ui= nt64_t r1, uint64_t addr) } else if (opc =3D=3D 0x0a) { env->int_svc_code =3D extract64(insn, 48, 8); env->int_svc_ilen =3D ilen; - helper_exception(env, EXCP_SVC); + cpu_loop_exit_excp(env_cpu(env), EXCP_SVC, 0); g_assert_not_reached(); } =20 diff --git a/target/s390x/tcg/misc_helper.c b/target/s390x/tcg/misc_helper.c index f1c8563af00..f5e31419268 100644 --- a/target/s390x/tcg/misc_helper.c +++ b/target/s390x/tcg/misc_helper.c @@ -56,16 +56,6 @@ #define HELPER_LOG(x...) #endif =20 -/* Raise an exception statically from a TB. */ -void HELPER(exception)(CPUS390XState *env, uint32_t excp) -{ - CPUState *cs =3D env_cpu(env); - - HELPER_LOG("%s: exception %d\n", __func__, excp); - cs->exception_index =3D excp; - cpu_loop_exit(cs); -} - /* Store CPU Timer (also used for EXTRACT CPU TIME) */ uint64_t HELPER(stpt)(CPUS390XState *env) { diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 474d604ed17..d2bf1422b1f 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -400,7 +400,7 @@ static int get_mem_index(DisasContext *s) =20 static void gen_exception(int excp) { - gen_helper_exception(tcg_env, tcg_constant_i32(excp)); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(excp)); } =20 static void gen_program_exception(DisasContext *s, int code) --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573354; cv=none; d=zohomail.com; s=zohoarc; b=USgPT4yPttfemgI7Izpp7o1c6X6GBZej3/7bRJe8lk62m6TDwcCdsbBvjqTQ+6SHHBCNtcjdOZhgCcZjwTnX2Ero++OZMnrtVYWJhmJf/P3LoUSsgyRu+hc6na//SnpbDjhQBMA1sbjTfuyulVkh4ak/aeMLc92WFER4b7SumC8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573354; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BWMlA1NXCzJLFH2JlbJbQuxfT3OYvSZI8xbaoVuKaUQ=; b=iZ+b7oC4aP+IvH4xW07MjCQ0kKMuY59pvaBQw9yhcqHcZdM01woXCcdMd4h0na1HETmib0UgNkKSDJD74NritJlp0xinVVSTJr/9HiCFmomKVsIWczdOxzQZaSmwnPSao/WMLIep4rr7KBFpvW5BQfRO4E8NAZK95NMZKemL27I= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573354621641.6696691260474; Sun, 27 Sep 2026 22:29:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3tr-0002Re-6x; Mon, 28 Sep 2026 01:27:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3pf-00059p-Fq for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:23:25 -0400 Received: from mail-dy2-x10.google.com ([2607:f8b0:4864:36::10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3pc-00085M-TY for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:23:19 -0400 Received: by mail-dy2-x10.google.com with SMTP id 5a478bee46e88-33be7dfcfc1so3781403eec.1 for ; Sun, 27 Sep 2026 22:23:16 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.23.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790572995; x=1791177795; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=BWMlA1NXCzJLFH2JlbJbQuxfT3OYvSZI8xbaoVuKaUQ=; b=doSKapxJUHDXm7Sc7ktjtIyKeynFK5wuFqCueqtSy5CS0ZPHghZinwqMB1C27m5W0E k4WVLsu8uSoJV0uG1xbbIWPHBetNjW5SeXExLrXRhlh8IN5uUX6vTfyX+I2YUO0zkGSd 9bgPYiAMKAjI0tsxnVKbiNZfTsoLry/SYPl5fKxzqEP7yyTQcTiaVQCKlIol2Y5LhZQt MqavsF5HZ8I8VhouVHjdPPWXgiJ+W05e5za2IXw5/iNZ0OGaV31XhV8B2bLkFbqdBnDi Fs5ZDBH6nPcXhltx7NoPAXiOaHMxrEPi6CqmMt1eglAeOwlCotTIgkrP4OOdQzZXQdE8 LHKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790572995; x=1791177795; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=BWMlA1NXCzJLFH2JlbJbQuxfT3OYvSZI8xbaoVuKaUQ=; b=WVMC1UXXeKDc+1qG8zMZ9HFqmICoRPtZP3FLxLebx8R38mrRBQXGqMVAyHt2h1kY/C 8J7ad2PZpl3RnWLJF9JZJPI/F4KGhRpDzOhItrfSb92fMMog9OfKidpWosBV9bREGGSX bYpMAzS5KzX2peHcZ8DyU1c8DCIEKkYa8yjp5naPTeSadGY63xkIY+B0aAha6J84ouHr jAk58oJ4VmixgQFwngqKmuRuxYdQGwSTbodiC/ySYGJDoG/BA9Q/eEU2UAtHU5D0eAB1 iIFfweLSXKu3QThFYCiKN+SibKzybqhxUxP0xkAsaw6u66Dw4GrT8Y0nZhNSTXBBbO0s L3aQ== X-Gm-Message-State: AFuF++m4AajPP2+qnejJsFwXUh1rv0MiwRBSlNs+f2aD4e4twuN9489k fNZ/26LDNALme7lT0eG9/bfvwCAV7JIUQJ+jdNlDNCZg2kwSRbAHBURblCpKy8tT2B0= X-Gm-Gg: AYBFou2g2lUVyLm9VoMOCoAfPkifNfzwdjww6/FroHx84blC5dYQuxOnwJg2Ipzo+9P RRwjdF0CQaTMZL0mKrkZd0XpYHDvCs/vIXiWgmCh/SH2P6UxaTW/2ogvBA5p7bwjx05Rr287gvA V1fGsXm4dYEvKxf3JSvDnfpBlVAI4lA9iB4RZY4GtN4oWV4UCvm59dGz3et+bqWBzXsvmJVNa8Y pRU5tdgYZ2XN+UbKM+Lh1XpXCmhhNNwtrNKk1Jf5XDGLHRJ8+QzUhvq4V3nR+mSb+VFey1Ug1TR ljQRQjrEE0u9xVm2OgT++iIPvcM7lgNQs+ncGeTp5HtgObeRwYruWvMqan2f2IUR+kPucD4XgSc as351FVS+R4agfLrGImVtHcxYzpzxf8nhG2QyrLpUWJm9eLYKBr++BXXBnryj4MkWErB8ziHXnV awf+pgwDT/FMUuSPcgOcbzULy7Ys42En2RZEL/sJ/JN7Sn9AsgsQlUeVfYFlEaprGzWkgX8w8EC VKevKb+HICvkJub5P1DBnGNqEJy174= X-Received: by 2002:a05:7022:b04b:20b0:144:c127:dd19 with SMTP id a92af1059eb24-146d01afcb2mr8924541c88.37.1790572995057; Sun, 27 Sep 2026 22:23:15 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 17/24] target/xtensa: add gen_yield for EXCP_YIELD Date: Mon, 28 Sep 2026 13:20:43 +0800 Message-ID: <20260928052051.251-18-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:36::10; envelope-from=luoyonggang@gmail.com; helo=mail-dy2-x10.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573354843158500 Content-Type: text/plain; charset="utf-8" gen_exception has one caller, and that caller always passes EXCP_YIELD. Rename the path to gen_yield and clear yield_needed there. Signed-off-by: Yonggang Luo --- target/xtensa/translate.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 175fd4b5cfc..db48f0c562a 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -303,9 +303,11 @@ static void gen_left_shift_sar(DisasContext *dc, TCGv_= i32 sa) dc->sar_m32_5bit =3D true; } =20 -static void gen_exception(DisasContext *dc, int excp) +static void gen_yield(DisasContext *dc) { - gen_helper_exception(tcg_env, tcg_constant_i32(excp)); + tcg_gen_st_i32(tcg_constant_i32(0), tcg_env, + offsetof(CPUXtensaState, yield_needed)); + gen_helper_exception(tcg_env, tcg_constant_i32(EXCP_YIELD)); } =20 static void gen_exception_cause(DisasContext *dc, uint32_t cause) @@ -1167,7 +1169,7 @@ static void xtensa_tr_translate_insn(DisasContextBase= *dcbase, CPUState *cpu) but this is the first TranslateOps hook that allows exiting. */ if ((tb_cflags(dc->base.tb) & CF_USE_ICOUNT) && (dc->base.tb->flags & XTENSA_TBFLAG_YIELD)) { - gen_exception(dc, EXCP_YIELD); + gen_yield(dc); dc->base.pc_next =3D dc->pc + 1; dc->base.is_jmp =3D DISAS_NORETURN; return; --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573305; cv=none; d=zohomail.com; s=zohoarc; b=WPDKao2mP5SNL9O43k0Bj279YdW+hafixJ+x+1yhmb8KEbi8jQtdr9GhcQMM2ZCEQcjNldizkTV+LuDQJM+COScuraRVNeZ41CMI2U+pbQ2ycIBCNkJe7sz9PxtSF6MnVd6N6+zbghWVqfIZDZF3LavoS7I5COiyKTgMKgCuMy8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573305; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TNgf6mzQru6X+FsQqbFclqifhFUVJmTnFVxLl9vYDCg=; b=YUq6HeRMpeGiynDSbuDxlMp+lCmj1sKqwnJ66R1Xf/Dw0hxKToXxqSVPwjWwGbr5vo1/eegm2sS4UWYKubvtqX0VRP2BYHVtm7ADWsxrg7/pgimwE1FZdOu4uNI8fFS2leDPloycXcoDzdZa6Nb/4dYPd6bkYFapWm/hhv4gU8U= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573305053480.42720783066716; Sun, 27 Sep 2026 22:28:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3tX-0001Iy-FK; Mon, 28 Sep 2026 01:27:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3pn-0005IP-MZ for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:23:29 -0400 Received: from mail-dy2-x0e.google.com ([2607:f8b0:4864:36::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3pk-00086h-92 for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:23:27 -0400 Received: by mail-dy2-x0e.google.com with SMTP id 5a478bee46e88-3428f70d7e7so1367865eec.3 for ; Sun, 27 Sep 2026 22:23:23 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.23.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:23:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790573003; x=1791177803; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=TNgf6mzQru6X+FsQqbFclqifhFUVJmTnFVxLl9vYDCg=; b=gFukZtxy4CH/DikcjcJiyof1Eh4++SwyhHaoCfbQfdxgZK/Ab/k4qp7bmKPVGaUbdE NZaS+9U2TVhmH7odhy0RmA56JwpTCcRrvsBsKTgEmYslshtXrImrNl8hd1UC0pOROs1z r3nJedjvVQeY5PEQtcDaAgOx5m4KXr/dYKoOi7nAwY2kMpI677393hT/EocTT93xf5EP 2jbitzGFkDijX66cZTY0eK/rZXPGc/x7C81Td0cupWETNuURcCo+5LhrVNYBxqb3prA8 QZgFrBqELzxzhghnuX7Nky4WVntzeq8q+3neaPrCVjwuaOFCoiTzrEOcFixDJOUIZ9pO hJHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790573003; x=1791177803; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=TNgf6mzQru6X+FsQqbFclqifhFUVJmTnFVxLl9vYDCg=; b=YazcrM/YryBWMHPlyRpdPR2bWcLUr4WXV9YBAs4q4cE29vz+AuOTicvZqp8+CHkKXb A08PLyiD0ctLvFPwiKfi4QbRuxjrxIgE5GfAi0OmygswsX7UkxK+dZD71ZkmoGo15rGD 5m/cYvyOicQuEZM+OyIckPVqe/nH7UoIC1c9lm069rY+M6AZvfc7NIjXsWRY2fy8fzaO ABCLPa2dYuDBjBui66Dq4iKLyFfJ0KItzf2mt8stY+MlR2+vE+5mUwqpMPLWSeZ/ysaq K2nkCKzKTSdX3uYKkj0Ae+zBNattiSi/Fga2UyWDAa705nlCANR97Nl6cR9Z3VNEfNsV v0DA== X-Gm-Message-State: AFuF++nZScqN/WSlFUyKL4daUCfSFpSjUlOQOfd89D4QWmqPYcHNzCAA sGJJqzdd8HMtRLYFK6WoOXbp5QjWsNZpVFCitqwkHBRl3e9Pv/uZ25bAQ8QAXhobvvI= X-Gm-Gg: AYBFou0bBsh1T3Prv4cJSmpdamLZZ/2bdGQqOP/TgoczkLzB4OE2WIgfjE1SugtFSfA gsJAQDKgQcWS8f18omaIazTt1iJL6NJ9ybk6KTheKlO5+/KxMsJE+Vmvd11eoyv0cvAXvqy08lD 2Vog0FSBUnkUOFmlIRnbkSBP/I7E8kRKVrqY2v93fzELNnf9DNV1JIafRbU4oZ7F/9MHFDY0wUq qvMo5u/p394PyG0VxZXCv9tlFXmZMuMVDmJunOkDzDNJEaN6Xya6auRntM7mrTsFHRsxot4QIJu AQAmHYOoZ3pNGrGVp6EHsUnZRrfv2zMG7p46xd4kJgOUFhTl7qn7EL6hHhymJpPhyovengK7YBg vSOokCki2VLjpxdHfqbDBC/bxpfAde1qW8S26EAoay3b4lsdGUGa1d/T5EZwxn0o+o3mBFXCUGh n/WUx8z1SH1QylhZWGnAhAW7dX5BE/bFzlNfxQG/HUV4ZTcQE8/sIkmHYwI78DNXusnJ8ytPS0E 3Pk7ozvXBj50tN8uLsEixooX6rPyDE= X-Received: by 2002:a05:7022:7e85:b0:143:3242:6301 with SMTP id a92af1059eb24-146ce29fde5mr9588471c88.4.1790573002756; Sun, 27 Sep 2026 22:23:22 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 18/24] target/xtensa: convert exception to raise_excp Date: Mon, 28 Sep 2026 13:20:44 +0800 Message-ID: <20260928052051.251-19-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:36::e; envelope-from=luoyonggang@gmail.com; helo=mail-dy2-x0e.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573306620158500 Content-Type: text/plain; charset="utf-8" Call raise_excp from gen_yield. Drop TCG exception. Keep exception_cause helpers. C callers use xtensa_exception for the old helper_exception body. Signed-off-by: Yonggang Luo --- target/xtensa/cpu.h | 1 + target/xtensa/exc_helper.c | 13 +++++-------- target/xtensa/helper.h | 1 - target/xtensa/translate.c | 2 +- target/xtensa/win_helper.c | 12 ++++++------ 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index 49d6ad9083d..0b2cb5a250d 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -601,6 +601,7 @@ int xtensa_cpu_gdb_write_register(CPUState *cpu, uint8_= t *buf, int reg); G_NORETURN void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, MMUAccessType access_type, = int mmu_idx, uintptr_t retaddr); +G_NORETURN void xtensa_exception(CPUXtensaState *env, uint32_t excp); =20 #define CPU_RESOLVING_TYPE TYPE_XTENSA_CPU =20 diff --git a/target/xtensa/exc_helper.c b/target/xtensa/exc_helper.c index 7cb67d179a8..3049432f4c4 100644 --- a/target/xtensa/exc_helper.c +++ b/target/xtensa/exc_helper.c @@ -35,15 +35,12 @@ #include "qemu/atomic.h" #include "qemu/plugin.h" =20 -void HELPER(exception)(CPUXtensaState *env, uint32_t excp) +void xtensa_exception(CPUXtensaState *env, uint32_t excp) { - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D excp; if (excp =3D=3D EXCP_YIELD) { env->yield_needed =3D 0; } - cpu_loop_exit(cs); + cpu_loop_exit_excp(env_cpu(env), excp, 0); } =20 void HELPER(exception_cause)(CPUXtensaState *env, uint32_t pc, uint32_t ca= use) @@ -66,7 +63,7 @@ void HELPER(exception_cause)(CPUXtensaState *env, uint32_= t pc, uint32_t cause) env->sregs[EXCCAUSE] =3D cause; env->sregs[PS] |=3D PS_EXCM; =20 - HELPER(exception)(env, vector); + xtensa_exception(env, vector); } =20 void HELPER(exception_cause_vaddr)(CPUXtensaState *env, @@ -93,7 +90,7 @@ void HELPER(debug_exception)(CPUXtensaState *env, uint32_= t pc, uint32_t cause) env->sregs[EPS2 + level - 2] =3D env->sregs[PS]; env->sregs[PS] =3D (env->sregs[PS] & ~PS_INTLEVEL) | PS_EXCM | (level << PS_INTLEVEL_SHIFT); - HELPER(exception)(env, EXC_DEBUG); + xtensa_exception(env, EXC_DEBUG); } =20 #ifndef CONFIG_USER_ONLY @@ -116,7 +113,7 @@ void HELPER(waiti)(CPUXtensaState *env, uint32_t pc, ui= nt32_t intlevel) } =20 cpu->halted =3D 1; - HELPER(exception)(env, EXCP_HLT); + xtensa_exception(env, EXCP_HLT); } =20 void HELPER(check_interrupts)(CPUXtensaState *env) diff --git a/target/xtensa/helper.h b/target/xtensa/helper.h index ae938ceedb8..4640d0da59a 100644 --- a/target/xtensa/helper.h +++ b/target/xtensa/helper.h @@ -1,4 +1,3 @@ -DEF_HELPER_2(exception, noreturn, env, i32) DEF_HELPER_3(exception_cause, noreturn, env, i32, i32) DEF_HELPER_4(exception_cause_vaddr, noreturn, env, i32, i32, i32) DEF_HELPER_3(debug_exception, noreturn, env, i32, i32) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index db48f0c562a..05c73bef99d 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -307,7 +307,7 @@ static void gen_yield(DisasContext *dc) { tcg_gen_st_i32(tcg_constant_i32(0), tcg_env, offsetof(CPUXtensaState, yield_needed)); - gen_helper_exception(tcg_env, tcg_constant_i32(EXCP_YIELD)); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(EXCP_YIELD)); } =20 static void gen_exception_cause(DisasContext *dc, uint32_t cause) diff --git a/target/xtensa/win_helper.c b/target/xtensa/win_helper.c index 4b25f8f4de7..3e4d7c0f768 100644 --- a/target/xtensa/win_helper.c +++ b/target/xtensa/win_helper.c @@ -125,13 +125,13 @@ void HELPER(window_check)(CPUXtensaState *env, uint32= _t pc, uint32_t w) =20 switch (ctz32(windowstart >> n)) { case 0: - HELPER(exception)(env, EXC_WINDOW_OVERFLOW4); + xtensa_exception(env, EXC_WINDOW_OVERFLOW4); break; case 1: - HELPER(exception)(env, EXC_WINDOW_OVERFLOW8); + xtensa_exception(env, EXC_WINDOW_OVERFLOW8); break; default: - HELPER(exception)(env, EXC_WINDOW_OVERFLOW12); + xtensa_exception(env, EXC_WINDOW_OVERFLOW12); break; } } @@ -174,11 +174,11 @@ void HELPER(test_underflow_retw)(CPUXtensaState *env,= uint32_t pc) env->sregs[EPC1] =3D env->pc =3D pc; =20 if (n =3D=3D 1) { - HELPER(exception)(env, EXC_WINDOW_UNDERFLOW4); + xtensa_exception(env, EXC_WINDOW_UNDERFLOW4); } else if (n =3D=3D 2) { - HELPER(exception)(env, EXC_WINDOW_UNDERFLOW8); + xtensa_exception(env, EXC_WINDOW_UNDERFLOW8); } else if (n =3D=3D 3) { - HELPER(exception)(env, EXC_WINDOW_UNDERFLOW12); + xtensa_exception(env, EXC_WINDOW_UNDERFLOW12); } } } --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573257; cv=none; d=zohomail.com; s=zohoarc; b=KCayvUI2LCTilG3yJaOv2BFPgvs0kbkbLJjMuAb/JYCGvcPRoRjg4UXHUiWIOFrLTqle0e/qPhtONMNoi5CUDGIeNTbZh0qBY2Qnr+04wacOlmaa0Y45mTOpFObRfDeZNAEc9myhXKpNWVRhdAgEUvI9J3LVTNK3tB3qAu9W/Ag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573257; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wW97M9h5uz6Wpe5eAT7kR3We6DeGskL6XRa4AtfhML4=; b=dVT/DLNxy48Uwee2IMPngEhsGfR4pVlEyqHcJTkuEqHeGI7UxuY30I1Ykj6xJRrK3dXYW6pdMX8P6S4Quo8of7sVE4faAnjo7uJYGtABCDEivEtPA2unLxc8ADWG4L/ha/0lmVNFWut0mL1jbYL9YRMy6gMZp09wvUY3Xx4+EpU= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573257464891.8052133401802; Sun, 27 Sep 2026 22:27:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3tO-0000v2-0i; Mon, 28 Sep 2026 01:27:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3pz-0005YL-Ew for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:23:40 -0400 Received: from mail-dl2-x10.google.com ([2607:f8b0:4864:38::10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3pw-000885-JD for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:23:39 -0400 Received: by mail-dl2-x10.google.com with SMTP id a92af1059eb24-142dd025d07so2146948c88.2 for ; Sun, 27 Sep 2026 22:23:31 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.23.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:23:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790573011; x=1791177811; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=wW97M9h5uz6Wpe5eAT7kR3We6DeGskL6XRa4AtfhML4=; b=p7QbhaA5KeRC/mzPg9AeZucPL8s5wx0aKswd4ysrfOImxUpmpWr0Ls12xB2UVKxjx0 BPxZnId8ZMeGqMjRsbfEgyVySLhimnfQgciqeqvyspyhf3mOyohKs4s1cK9U/IBz863k 3Y1A3rcCsQ1gNnjf2hiWN32UCI+oqNcrlr2dRRLabzJC5Rj6XXThDHx4tIRuyzAAk23y XUMgBAn3jO1FiwZPj2pScPurbRQfBAK/9q/DHCFVAr/+oWYFRGytauzGTFB8eUY5NptL BCcjiXPklXouSB9nEm+yXTubl7UB8khLwU+aSqUZfvxJ+ONc7Cw4HJPF9k9p45fuU/jq Ru5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790573011; x=1791177811; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=wW97M9h5uz6Wpe5eAT7kR3We6DeGskL6XRa4AtfhML4=; b=DhU8x83ZLaEPwGNKYRzeYuAr8Po8xK+SKH4sQMvnUcD8gkzqxr963lMUnxXNR/dMhI U3yTANL7gNWhp2JtZQVrvrKgVWSBPMS4ndfgYOS2+7gW3UziKmfn0JMYCZlr+T7YCjz8 4mm7mZdsIW45acR4gdfZ3Lhjf6aTDEsQvqdjBfvIjYtVc0oZcWjzmZje1d4R5RfmZWy3 BkdponAfG/Uq45rT1ZlREw4NIAGHeMP+BoguG7Xr3KvuoY4J3Vu8E390c8grzpelyyXQ w/RyC/55bR8BMoKJiXw6crS8BpYq8Im2bRjz1FAmwO3A0+V+bLpDSqeQJov7c+/3RVHi PqIw== X-Gm-Message-State: AFuF++l7NRRae8OmvS6NKxHETz4kmYJALFMw2Lfj0qQ+fyuvVcH8H24q vQVxZTp4ddMe+UzRnUwohVAK+mGo8vpeFdDB9wOLK+5RGLVZfhOeLpx8gm0xVJu8Uiw= X-Gm-Gg: AYBFou1zny3aCX+4k/XMQEnf2WF7U2Nmu/ThDMe7/Gm0p9B7UeRhxx3kj1k2+sHyc7G X1p6VlKFhMDbCbo7Hk/7Lw9ysqzeSGBHS1V9TiRKTliQWyUArvg3x04zsSaZTnrVwoIttgrSPlr 9Yta17NGB32qPmu0OHoKIIGKu61WrvV9t+0HfVFh6pfCkqak+Wh9cZ+W2CEj9/hNN/rgepiTj1F ytsm5/Zs8lprMfxURTuj7Ks2MK8OzIRMybOiGAFhFiyxmdfxmX2N/Ye/EHCr07ARRsyi4FJu2ro Ht1+IV9wdz0tVFFraClabbcruk7wXH4YDl7FY2zTGEx8FLj70XPF8aVFT5lce9PJ13HyK4HaxAr oOH9tsU5jqQTeQTiSTl/Xoin2O/wdtqAAHaF9bCxl10BQR/yBoZxmdG9/OUOHj/6t3FZ2w1pXvQ +s1uGrvPFwswN/7kbvkPKF6unXslmBX4VUyVQXHU3M0KKnn647EJm2zcNdYUjIoC+e4aIbtgx6z Ew8GpItWK19lx9qx++Khb8ZaNJfY5o= X-Received: by 2002:a05:701a:c909:b0:144:fd7d:dbdd with SMTP id a92af1059eb24-146cdfbecf3mr9671810c88.10.1790573010787; Sun, 27 Sep 2026 22:23:30 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 19/24] target/avr: convert debug/break/sleep to raise_excp Date: Mon, 28 Sep 2026 13:20:45 +0800 Message-ID: <20260928052051.251-20-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::10; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x10.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, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573258582158500 Content-Type: text/plain; charset="utf-8" Replace debug, break, and sleep TCG helpers with raise_excp. Keep unsupported. Signed-off-by: Yonggang Luo --- target/avr/helper.c | 24 ------------------------ target/avr/helper.h | 3 --- target/avr/translate.c | 4 ++-- 3 files changed, 2 insertions(+), 29 deletions(-) diff --git a/target/avr/helper.c b/target/avr/helper.c index f452c9d9040..ca58a0191fd 100644 --- a/target/avr/helper.c +++ b/target/avr/helper.c @@ -152,14 +152,6 @@ bool avr_cpu_tlb_fill(CPUState *cs, vaddr address, int= size, * helpers */ =20 -void helper_sleep(CPUAVRState *env) -{ - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D EXCP_HLT; - cpu_loop_exit(cs); -} - void helper_unsupported(CPUAVRState *env) { CPUState *cs =3D env_cpu(env); @@ -176,22 +168,6 @@ void helper_unsupported(CPUAVRState *env) cpu_loop_exit(cs); } =20 -void helper_debug(CPUAVRState *env) -{ - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D EXCP_DEBUG; - cpu_loop_exit(cs); -} - -void helper_break(CPUAVRState *env) -{ - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D EXCP_DEBUG; - cpu_loop_exit(cs); -} - void helper_wdr(CPUAVRState *env) { qemu_log_mask(LOG_UNIMP, "WDG reset (not implemented)\n"); diff --git a/target/avr/helper.h b/target/avr/helper.h index e8d13e925f4..09ce0624915 100644 --- a/target/avr/helper.h +++ b/target/avr/helper.h @@ -19,8 +19,5 @@ */ =20 DEF_HELPER_1(wdr, void, env) -DEF_HELPER_1(debug, noreturn, env) -DEF_HELPER_1(break, noreturn, env) -DEF_HELPER_1(sleep, noreturn, env) DEF_HELPER_1(unsupported, noreturn, env) DEF_HELPER_3(fullwr, void, env, i32, i32) diff --git a/target/avr/translate.c b/target/avr/translate.c index 3c576060970..477610cd349 100644 --- a/target/avr/translate.c +++ b/target/avr/translate.c @@ -2554,7 +2554,7 @@ static bool trans_BREAK(DisasContext *ctx, arg_BREAK = *a) =20 #ifdef BREAKPOINT_ON_BREAK tcg_gen_movi_tl(cpu_pc, ctx->npc - 1); - gen_helper_debug(tcg_env); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(EXCP_DEBUG)); ctx->base.is_jmp =3D DISAS_EXIT; #else /* NOP */ @@ -2580,7 +2580,7 @@ static bool trans_NOP(DisasContext *ctx, arg_NOP *a) */ static bool trans_SLEEP(DisasContext *ctx, arg_SLEEP *a) { - gen_helper_sleep(tcg_env); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(EXCP_HLT)); ctx->base.is_jmp =3D DISAS_NORETURN; return true; } --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573333; cv=none; d=zohomail.com; s=zohoarc; b=KT6ljh4PPVcaqXw0nF2jHwvcQ6O9jlNUBCLDyggVFvOyUBh7Y87w6dc86h+eY1KDpEoTixtvgmXd4YOdAdop8VGnw2qRMhq/MyhcDfSTqlGMjv1Hzc0QLi12Wjoi12m/5nDrjiB2G1vXJCzK4hM32ignQ+HT5lcnNHjn6+PmU9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573333; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=IS1UZYId12KIlinDehyorm2IQtlo8wg2V9f7wEwKC64=; b=c6DoRThCafAFfuV2fit5ShMPujFssaZvQ7oWD6K/19ZkVy4YYJPXMoT2JZFv+pctS5LtUtqGURsj8wlLKnitMS8RvsHe1j6fr2kwx8tymhIHJf9tCy8pmZduMJ0JQ2NDsXqrvL5dKy9BbwMsIwM2Z2rYxjHkFCNDGCRAu/KKHrw= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573333222831.7141695624448; Sun, 27 Sep 2026 22:28:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3tg-0001iF-Nc; Mon, 28 Sep 2026 01:27:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3q4-0005fk-6t for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:23:44 -0400 Received: from mail-dl2-x0d.google.com ([2607:f8b0:4864:38::d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3q0-000898-O9 for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:23:43 -0400 Received: by mail-dl2-x0d.google.com with SMTP id a92af1059eb24-1474c6b7742so959809c88.1 for ; Sun, 27 Sep 2026 22:23:40 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.23.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:23:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790573019; x=1791177819; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=IS1UZYId12KIlinDehyorm2IQtlo8wg2V9f7wEwKC64=; b=kAwYTXOEGInhQwXWIaiFawAZy3pwjFsYPHaJZv7fwWMMSZTyu6yEcbwynxPa4Wco+B bZuRz8tFnByIEGFfg5LCOOUIfoKhszc0GnxQk/AX5DcnnvNhRBl/JHNeTkV1XBZWO5YE 46CUAOh2MRCPnQ8reCaJMjxrKqNdXAl9iamFyjVYnT5ZOyl8maglPp2lLv3DAiMFrYWb oW5Q8FHSblG7Cdat6c+MLTdHOQfqFu/bTVDJU7d1JTXmSpmxWDzgKf1RDyPpw6nGg1zf r7KxZyYYhpnS5yU0ylIa+GvYkTesDJAKtDwfRmbYcwDMizY1bggs6mL/Twxx5YjqGZKN l4/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790573019; x=1791177819; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=IS1UZYId12KIlinDehyorm2IQtlo8wg2V9f7wEwKC64=; b=QgnybGmZ3NbPo3YQfkzVhf9I0r7jKtWNk/+3z6VorEmYkxr3p7QGfWUggvJR2JJcZH 8T/is9v0WdRfP51eE7G8s7rRr7wc57G41a5Kyd/d54utfqR1VUTZZGEm+bN9isP88Wvp 9H81+Ny6N1q7JXW+BpUpOAoJf9rDhEDUUF5AbRtrb7lJ5/18XjUYfO7+dEcpBpDiC59F QQMssf2aomiRmllGDJqDx0F0uz11jC7y5lRVAxdWAGYrbub6zedmTiFlgxdDrSM06lQP p79HBBwc3/pqyHiZhuHTeqpuFfttwwjIia8r9QdP6lpMNtDjSq/DJiZRHbawehEhCcaM wbcg== X-Gm-Message-State: AFuF++meBahDWAswx9HOY4N7kIovvOce+5Dx6taVBqcWmmhP3MStDLsW rtTNi4IzIjnPK0GL0yn+Kp5gna2iDexitjJQYT3S7cIfDF/QW/GQfG7yHUMTdvkid68= X-Gm-Gg: AYBFou28SRXZVqzcZOWzx9V2jhKe7HzueXiUkqL3t8pEtUH3+mJw+g3xl8N6PjMQHyM wSjea7uLcrgCEgHI9jBzY8TnXnKNfW0cW1d36pCNY6zAor1ak5EmPjzYJEzk24xlU8swq1nk+AF k+ihdpOwHnVjQIJdSYzc+U8F3XLdhI86fNGCgCbJqfBMbXlRzscbn93cL2EX2NuDuKdlVhaL9LN jdD3OT5wi3ZdrfkB+8LtJCB4ohVvJfsWqikiKLRSeKD21MukVx9VGArYqAfSINAH3/w5B44aFqW OdIK6mZ0sW3ihtCpEsy+rQPSmgayGEOV33tsxk5ofpgJSAflyx2FgFe5DDi2K9YnoO768fU8FjF oc5IMZZCopLDpNyiKhSpTe3dRIz7JfPKzPXVkyYAdDWKaRucm91in+I5oYLcj+KbqBcmf067LeC K49Fiyw57oD4hCnsfYXLmaNonhNLZm7N9ZUsSqz0xbyUqVU35qpy88rSW+Snr0jH3JqW6e96VMA p78oziAoTW5nHheWCzTUaHaN4QSvG4= X-Received: by 2002:a05:701b:451a:20b0:143:296a:3ed with SMTP id a92af1059eb24-146d03a0516mr8276165c88.24.1790573018472; Sun, 27 Sep 2026 22:23:38 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 20/24] target/arm: convert exception_internal to raise_excp Date: Mon, 28 Sep 2026 13:20:46 +0800 Message-ID: <20260928052051.251-21-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::d; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x0d.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, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573334815158500 Content-Type: text/plain; charset="utf-8" Switch gen_exception_internal to raise_excp, and drop TCG exception_internal. Keep syndrome helpers. Fold leftover C exits into cpu_loop_exit_excp. Keep arm_raise_exception_ra via restore then arm_raise_exception. Signed-off-by: Yonggang Luo --- target/arm/tcg/helper-defs.h | 1 - target/arm/tcg/m_helper.c | 3 ++- target/arm/tcg/op_helper.c | 33 ++++++--------------------------- target/arm/tcg/translate.c | 2 +- 4 files changed, 9 insertions(+), 30 deletions(-) diff --git a/target/arm/tcg/helper-defs.h b/target/arm/tcg/helper-defs.h index 269ac515065..14ef3120373 100644 --- a/target/arm/tcg/helper-defs.h +++ b/target/arm/tcg/helper-defs.h @@ -45,7 +45,6 @@ DEF_HELPER_FLAGS_2(usad8, TCG_CALL_NO_RWG_SE, i32, i32, i= 32) =20 DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) -DEF_HELPER_2(exception_internal, noreturn, env, i32) DEF_HELPER_3(exception_with_syndrome, noreturn, env, i32, i32) DEF_HELPER_4(exception_with_syndrome_el, noreturn, env, i32, i32, i32) DEF_HELPER_2(exception_bkpt_insn, noreturn, env, i32) diff --git a/target/arm/tcg/m_helper.c b/target/arm/tcg/m_helper.c index 33c9e7c55bc..161c5460217 100644 --- a/target/arm/tcg/m_helper.c +++ b/target/arm/tcg/m_helper.c @@ -18,6 +18,7 @@ #include "exec/page-protection.h" #ifdef CONFIG_TCG #include "accel/tcg/cpu-ldst-common.h" +#include "accel/tcg/cpu-loop.h" #include "semihosting/common-semi.h" #endif #if !defined(CONFIG_USER_ONLY) @@ -575,7 +576,7 @@ void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest) */ env->regs[15] =3D dest & ~1; env->thumb =3D dest & 1; - HELPER(exception_internal)(env, EXCP_EXCEPTION_EXIT); + cpu_loop_exit_excp(env_cpu(env), EXCP_EXCEPTION_EXIT, 0); /* notreached */ } =20 diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c index 643b1482523..2ad45b23725 100644 --- a/target/arm/tcg/op_helper.c +++ b/target/arm/tcg/op_helper.c @@ -64,10 +64,9 @@ void raise_exception(CPUARMState *env, uint32_t excp, } =20 assert(!excp_is_internal(excp)); - cs->exception_index =3D excp; env->exception.syndrome =3D syndrome; env->exception.target_el =3D target_el; - cpu_loop_exit(cs); + cpu_loop_exit_excp(cs, excp, 0); } =20 void raise_exception_ra(CPUARMState *env, uint32_t excp, uint64_t syndrome, @@ -399,9 +398,8 @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len) } =20 qatomic_set(&env->halt_reason, HALT_WFI); - cs->exception_index =3D EXCP_HLT; cs->halted =3D 1; - cpu_loop_exit(cs); + cpu_loop_exit_excp(cs, EXCP_HLT, 0); #endif } =20 @@ -461,9 +459,8 @@ void HELPER(wfit)(CPUARMState *env, uint32_t rd) timer_mod(cpu->wfxt_timer, nexttick); } qatomic_set(&env->halt_reason, HALT_WFI); - cs->exception_index =3D EXCP_HLT; cs->halted =3D 1; - cpu_loop_exit(cs); + cpu_loop_exit_excp(cs, EXCP_HLT, 0); #endif } =20 @@ -630,9 +627,8 @@ void HELPER(wfe)(CPUARMState *env, uint32_t insn_len) } =20 qatomic_set(&env->halt_reason, HALT_WFE); - cs->exception_index =3D EXCP_HLT; cs->halted =3D 1; - cpu_loop_exit(cs); + cpu_loop_exit_excp(cs, EXCP_HLT, 0); #endif } =20 @@ -724,9 +720,8 @@ void HELPER(wfet)(CPUARMState *env, uint32_t rd) } =20 qatomic_set(&env->halt_reason, HALT_WFE); - cs->exception_index =3D EXCP_HLT; cs->halted =3D 1; - cpu_loop_exit(cs); + cpu_loop_exit_excp(cs, EXCP_HLT, 0); #endif } =20 @@ -738,23 +733,7 @@ void HELPER(yield)(CPUARMState *env) * that the guest is currently busy-looping. Yield control back to the * top level loop so that a more deserving VCPU has a chance to run. */ - cs->exception_index =3D EXCP_YIELD; - cpu_loop_exit(cs); -} - -/* Raise an internal-to-QEMU exception. This is limited to only - * those EXCP values which are special cases for QEMU to interrupt - * execution and not to be used for exceptions which are passed to - * the guest (those must all have syndrome information and thus should - * use exception_with_syndrome*). - */ -void HELPER(exception_internal)(CPUARMState *env, uint32_t excp) -{ - CPUState *cs =3D env_cpu(env); - - assert(excp_is_internal(excp)); - cs->exception_index =3D excp; - cpu_loop_exit(cs); + cpu_loop_exit_excp(cs, EXCP_YIELD, 0); } =20 /* Raise an exception with the specified syndrome register value */ diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index 8c56348a665..6452888ed41 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -379,7 +379,7 @@ static void gen_rebuild_hflags(DisasContext *s, bool ne= w_el) void gen_exception_internal(int excp) { assert(excp_is_internal(excp)); - gen_helper_exception_internal(tcg_env, tcg_constant_i32(excp)); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(excp)); } =20 static void gen_singlestep_exception(DisasContext *s) --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573269; cv=none; d=zohomail.com; s=zohoarc; b=OS6aDWbhvCj7yAJe8KsoDACNJiObeeWm5kouACgaQXsUiAbz9zbXmWkGH3Bad7WS5DDbFHYszM/KYDhAmiCbkCGB2L9tAsrI4cChYt1UfWYs9v+iDO5qwWMyJBc6CBG42dBg67380dJHe3KEAm06DC4CMMQSF5LfaUM5Peg0DQg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573269; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TMiiV36GFrwyzgJ2vCGHA2UMWPnrC1dDVw1vxHvYfWc=; b=bl1EEzB+69rF4IZWnCQvQA+LpPXr7hmxP2Jw175GzeGvTG6dE7yTWCREGxmZBtnSE433nOnpxMV1dP24q5Ai6tExYhPW3O/6LZq6BtETY2m+yA4cv5os1GiJJ1oaDGttRL5/X/GlmH2+nobjAvkgJhDVd+NN/bfbHridPkBcLxg= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573269510601.4435224030008; Sun, 27 Sep 2026 22:27:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3tl-00024m-4P; Mon, 28 Sep 2026 01:27:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3qB-0006Hx-8r for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:23:51 -0400 Received: from mail-dl2-x10.google.com ([2607:f8b0:4864:38::10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3q7-0008AA-Mb for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:23:50 -0400 Received: by mail-dl2-x10.google.com with SMTP id a92af1059eb24-142dd05d97cso3040939c88.2 for ; Sun, 27 Sep 2026 22:23:47 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.23.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:23:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790573026; x=1791177826; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=TMiiV36GFrwyzgJ2vCGHA2UMWPnrC1dDVw1vxHvYfWc=; b=dASwEdAg1MzdQiD891AholRW/LTGgmLkR8OTLaNRB+XVoLQffLUs5k2zYSOVXBi4ws URq3mVUhi6WVF7kNt4+0MN88PnvvTR4tiQXr6o+Cm/OPvonHYTYOdDuQ19HIh5ofe7Bn blLrZotCRCYXO562EhuwFNMpTm31xXH1li9aOVXthj0ta1YGgKn29GChCjn98jVMvm1C Thgq8AENFTwQxf8P25dj08rySKAuT9ZtuK4qe3whD5I0HSuV22IkPbiOQJV2cXBD3PgL 3Y6kDuHL9RKYEIUbNa/nCca4OYYlGf7yOyJDTpacJBqR4w/x5uUCuj1JpDv5LbWcFwwZ Lzcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790573026; x=1791177826; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=TMiiV36GFrwyzgJ2vCGHA2UMWPnrC1dDVw1vxHvYfWc=; b=RzIU3B8pbzKw0XkwNhC3+Bw/FObkjrud8Cjjj7UDuHz5+R+Q/v1uHEm8pCYeZ5JGxX RqyHkXRxn963DHYUzD+NmRA7iTPClIzpzzHta68KrifCaNHFkLDSPXVJA5bRjp+X+4JP JtHmU5TVkbLaWxXQYA1LXf9b1rJxRmd3K9J2AhSl/maRZurAX/YZuWZtEWRlk2kSHu1U aPNF0yaZ+LwrAtgDsGxh+O7W0jpDxEJkq3E9YRJbxHgfJTjMtlIww5DlS99MTaBbJIe2 E0iz/xnGRpZPfk0xrHT1LWBTs0t/c0krrqM3VnZlsgfN172zB1aP3Cwt46PACPTIgMuV AxNA== X-Gm-Message-State: AFuF++k4BOf83kEXNokCRpxyn5Hnrt4M1+mm0/9bLiJY4ZRcAaSgHK4L Jtw0mFGpl3ylD8ZLxFLrEhtZXhf66pEFhEDfPuS/WoMmCANywwDCuwlyzBCrnDCDhUo= X-Gm-Gg: AYBFou1Fb7moNYM5FWdWAs9dh2+qx3YvEV5GJttln2MTGWHTIDUrflBXcsVF7g5rWf0 G4bZeX5NJ+ZQQh73CSplHuwIt1citsHxzIAPuyrxYhW+1NH+TI9ym94tdMvIo+k1G/2brwsDNhy kOt+MfKqzwka0a48wZyNo4BXVSj6AcAtmuNyYXQsrDLmJI+OH6lYfXgrtL+pfT7Ca/Tty1ENpvF sGurUC9ahDJj+IR5Y2wTOQerS0ePAPt05A8f7ACxiV9gegg2SUQTzZYNQ9dnfct+ASsZYAZFnVx EGc27s0mUeGTAehBHdwFl5U7WqnegaWrigLJY2Bvn54vid0M+ZQ2+KhgAM1UPeiL6MjMooI8Eyi NmiPMAeiTKvngmQ7owRXAKT1edpnBjGZ+UvtCWPg1QNJSCFd95b9Kqx1sqt8rMFSXvJl+oKW9UB +QjHy9eTsat6PJ9bBSBnm9iLVD6VG94VwSjmUvL2tQ+hruwGN+ZULmy11uRFcTO9stHgeyJec3W srSxilgz/h00QPkaNrd0I6f/yprtYA= X-Received: by 2002:a05:7022:b0c6:b0:145:4ef:e8de with SMTP id a92af1059eb24-146ce67f233mr8287670c88.6.1790573026184; Sun, 27 Sep 2026 22:23:46 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 21/24] target/riscv: convert raise_exception to riscv_raise_exception Date: Mon, 28 Sep 2026 13:20:47 +0800 Message-ID: <20260928052051.251-22-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::10; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x10.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, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573270504158500 Content-Type: text/plain; charset="utf-8" Prefix leftover TCG raise_exception to riscv_raise_exception so translate still decrements instret then exits with restore 0. Keep C riscv_raise_exception via cpu_loop_exit_excp. Signed-off-by: Yonggang Luo --- target/riscv/helper.h | 2 +- target/riscv/tcg/insn_trans/trans_rvi.c.inc | 6 ++---- target/riscv/tcg/insn_trans/trans_rvzicfiss.c.inc | 3 +-- target/riscv/tcg/op_helper.c | 5 ++--- target/riscv/tcg/translate.c | 10 +++++++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/target/riscv/helper.h b/target/riscv/helper.h index aab92bf132a..9458a5152be 100644 --- a/target/riscv/helper.h +++ b/target/riscv/helper.h @@ -1,5 +1,5 @@ /* Exceptions */ -DEF_HELPER_2(raise_exception, noreturn, env, i32) +DEF_HELPER_2(riscv_raise_exception, noreturn, env, i32) =20 /* Floating Point - rounding mode */ DEF_HELPER_FLAGS_2(set_rounding_mode, TCG_CALL_NO_WG, void, env, i32) diff --git a/target/riscv/tcg/insn_trans/trans_rvi.c.inc b/target/riscv/tcg= /insn_trans/trans_rvi.c.inc index 40b4c9aa4ab..b9b554f4e5d 100644 --- a/target/riscv/tcg/insn_trans/trans_rvi.c.inc +++ b/target/riscv/tcg/insn_trans/trans_rvi.c.inc @@ -55,8 +55,7 @@ static bool trans_lpad(DisasContext *ctx, arg_lpad *a) */ tcg_gen_st8_i32(tcg_constant_i32(RISCV_EXCP_SW_CHECK_FCFI_TVAL), tcg_env, offsetof(CPURISCVState, sw_check_code)); - gen_helper_raise_exception(tcg_env, - tcg_constant_i32(RISCV_EXCP_SW_CHECK)); + gen_raise_exception(RISCV_EXCP_SW_CHECK); return true; } =20 @@ -68,8 +67,7 @@ static bool trans_lpad(DisasContext *ctx, arg_lpad *a) tcg_gen_brcondi_tl(TCG_COND_EQ, tmp, a->label, skip); tcg_gen_st8_i32(tcg_constant_i32(RISCV_EXCP_SW_CHECK_FCFI_TVAL), tcg_env, offsetof(CPURISCVState, sw_check_code)); - gen_helper_raise_exception(tcg_env, - tcg_constant_i32(RISCV_EXCP_SW_CHECK)); + gen_raise_exception(RISCV_EXCP_SW_CHECK); gen_set_label(skip); } =20 diff --git a/target/riscv/tcg/insn_trans/trans_rvzicfiss.c.inc b/target/ris= cv/tcg/insn_trans/trans_rvzicfiss.c.inc index d47a9f9c7d2..087328a12ef 100644 --- a/target/riscv/tcg/insn_trans/trans_rvzicfiss.c.inc +++ b/target/riscv/tcg/insn_trans/trans_rvzicfiss.c.inc @@ -43,8 +43,7 @@ static bool trans_sspopchk(DisasContext *ctx, arg_sspopch= k *a) tcg_gen_brcond_tl(TCG_COND_EQ, data, rs1, skip); tcg_gen_st8_i32(tcg_constant_i32(RISCV_EXCP_SW_CHECK_BCFI_TVAL), tcg_env, offsetof(CPURISCVState, sw_check_code)); - gen_helper_raise_exception(tcg_env, - tcg_constant_i32(RISCV_EXCP_SW_CHECK)); + gen_raise_exception(RISCV_EXCP_SW_CHECK); gen_set_label(skip); tcg_gen_addi_tl(addr, addr, tmp); tcg_gen_ext_tl_i64(wide_addr, addr); diff --git a/target/riscv/tcg/op_helper.c b/target/riscv/tcg/op_helper.c index b67c7718db4..a00370a7973 100644 --- a/target/riscv/tcg/op_helper.c +++ b/target/riscv/tcg/op_helper.c @@ -47,11 +47,10 @@ G_NORETURN void riscv_raise_exception(CPURISCVState *en= v, riscv_cpu_get_trap_name(exception, false), env->pc); =20 - cs->exception_index =3D exception; - cpu_loop_exit_restore(cs, pc); + cpu_loop_exit_excp(cs, exception, pc); } =20 -void helper_raise_exception(CPURISCVState *env, uint32_t exception) +void HELPER(riscv_raise_exception)(CPURISCVState *env, uint32_t exception) { #ifndef CONFIG_USER_ONLY riscv_pmu_decr_instret(env); diff --git a/target/riscv/tcg/translate.c b/target/riscv/tcg/translate.c index cce3b6dc721..08640c4ebd1 100644 --- a/target/riscv/tcg/translate.c +++ b/target/riscv/tcg/translate.c @@ -257,10 +257,15 @@ static void gen_update_pc(DisasContext *ctx, target_l= ong diff) ctx->pc_save =3D ctx->base.pc_next + diff; } =20 +static void gen_raise_exception(uint32_t excp) +{ + gen_helper_riscv_raise_exception(tcg_env, tcg_constant_i32(excp)); +} + static void generate_exception(DisasContext *ctx, RISCVException excp) { gen_update_pc(ctx, 0); - gen_helper_raise_exception(tcg_env, tcg_constant_i32(excp)); + gen_raise_exception(excp); ctx->base.is_jmp =3D DISAS_NORETURN; } =20 @@ -1424,8 +1429,7 @@ static void riscv_tr_translate_insn(DisasContextBase = *dcbase, CPUState *cpu) tcg_ctx->emit_before_op =3D QTAILQ_NEXT(ctx->base.insn_start, link= ); tcg_gen_st8_i32(tcg_constant_i32(RISCV_EXCP_SW_CHECK_FCFI_TVAL), tcg_env, offsetof(CPURISCVState, sw_check_code)); - gen_helper_raise_exception(tcg_env, - tcg_constant_i32(RISCV_EXCP_SW_CHECK)); + gen_raise_exception(RISCV_EXCP_SW_CHECK); tcg_ctx->emit_before_op =3D NULL; ctx->base.is_jmp =3D DISAS_NORETURN; } --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573294; cv=none; d=zohomail.com; s=zohoarc; b=GnVP+gB/IEonCLoMXrVNetM9uPySGYpE/yRbAa5XupEAu2js/38Pt8mFakLo01NLnXkuykhKj2s1RFbvQwXXsO/9y7CoVUOEVbKL9B6czMNNbKBpIaqhnrmtbMVv8gms+mAI4BD37F54q2hUn4xAqvAmN8MtiKHAiQ1knidVJz8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573294; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VkcIaWxBcQKymbi824ssKTFPRZk7v2JgsUS3RTcybjU=; b=EPXvedmglNaritCtR81t9c08JhZ0O943XizrFRT2VZNMyBWY83lZlkuI9tsVXB1ltBWyynFOI0rVk4UUqelpPmgaJhKVnxWifRuFienj6gVWRKKuAFnngiM5Ak2J9GcBEmzOdClGCoDCqVGR9OM9vi9AAUSwxMZbnuatrwV57yU= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179057329493749.73416859281815; Sun, 27 Sep 2026 22:28:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3tt-0002dn-Qb; Mon, 28 Sep 2026 01:27:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3qJ-00074X-7z for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:23:59 -0400 Received: from mail-dl1-x1235.google.com ([2607:f8b0:4864:20::1235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3qF-0008B5-NM for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:23:58 -0400 Received: by mail-dl1-x1235.google.com with SMTP id a92af1059eb24-13fc403e373so3619857c88.1 for ; Sun, 27 Sep 2026 22:23:55 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.23.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:23:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790573034; x=1791177834; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VkcIaWxBcQKymbi824ssKTFPRZk7v2JgsUS3RTcybjU=; b=hr/ZccUkV3Sk6pGPRXY9F8SlbSPNCr7p3sUQGo1lZ8QqDXDGjgHzvSegOfuScSwDWz b9PA+/SDrdh+vzn6+LShTlAtBIlfb1dU2Kapkkw/WSQZsuQe5yUcX6UnnyNrl8evqy/t Sfd9TMTfEDmfbrzCl087q9nv2OXHQFOAxqFt/zkUCdw86ICE2r/yaXeu9PzG9IdmOHbf mallYYWT5UnseV6Rzhh6rVjOEphQvEBKQhjWw5H0JpTjZHe1aRzli5MMmjueiobL1r/e b8BJGDpg3Ozr4zmXq4GCMYMYfUDd+DkArdknrniKuFb9Wojwz0D1nKjd5qEJWQvTy2Ta 84+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790573034; x=1791177834; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=VkcIaWxBcQKymbi824ssKTFPRZk7v2JgsUS3RTcybjU=; b=qhFi+XrXqUZ44ZLFB09IsfGkBQL4CSZjpM0OFASYvVWif6+Jl0k1p5SVfzGTcxQDFh olxWVRZBhsYQ+1QxoaNQlJEl95+GtzNhBnnW0+d9buCOG18U13ZTuJaM6INXlUL6aWyR dSuYqyxtBQEI/rU153YmTkjO1CNsWNOk6zGhCoAGZmaINFxfITP94st9XWN40riEjq/7 dmCSFJUXT9621rsHs+1eyod/wweElaRH9HZ4aPKrPbG2uaDX+Xs0Kmrxd6MUgSyKukLt VA+edJrWVDLHIqPyas0qOuxfSZF9klpVbruWOruV3plRCHNFQmATsRb3PcWPzXipb1kr sxDg== X-Gm-Message-State: AFuF++nJc6Ua0sj+yskkx1Isu+bR5UdqHoD7M0KxIRTQwrXYg4NI64GT ycZxMG1fKEa4Eh1MmwANfxl1Ut8dz8wRYjsiaajBgpvEz4eZR07YwTSZxslVNt/AfiI= X-Gm-Gg: AYBFou0siu0a9PAZLcW3ukzIQ+JceXAdeKlw9JHKGKIC3YSeA/boqQT8DcNKsUd0JeV 1Qb/iLetxNcYH2yrfDjwgJC2WJ+L2p2VQSFCcOiRrIlP9KttOfrB2h5QIs4zS91tNNz/H6svK3Q xsuTAOUnkkRHCKz8e66Z8mSyJxjKh5/WIEStVmkiYHDcS7+cYg0KRLeZw4lkffOFSRRbVlna0Il 7GnRmajWjkz6wOVz3mUVf9ybvO7dVLUJ4d8TJuHY8SolRDSdJobxh8Hq2ZpDWqJvezoW/Cx9oBX jS2AYDZ+rYwX0GXXSksQNM2DL+/wJbMGIZBVsFfYKueYpR6jRhVCEbfpm09GKDZtQ4q7SYn4GJp 2PQyR6tND/tlMavzeeWVATc/nQodsnFPErYPpItuYBOLy3mmPUhKaFPngR1HE9tU47daQpkoHXe ADdxclTLMuvNT5tJmXn8zG1KxizpD7LPCAu6AqPz2bJQbvje1QuYMTECzNJergAmHmYWvcZYNwc xnrp0Kkm4dLrKIJD+OdtwZOhx5du6lgark+deYuOQ== X-Received: by 2002:a05:7022:fa9:b0:13c:e1e2:fc86 with SMTP id a92af1059eb24-146ce49209fmr12203557c88.4.1790573033781; Sun, 27 Sep 2026 22:23:53 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 22/24] target/mips: convert raise_exception to raise_excp Date: Mon, 28 Sep 2026 13:20:48 +0800 Message-ID: <20260928052051.251-23-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1235; envelope-from=luoyonggang@gmail.com; helo=mail-dl1-x1235.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573296563158501 Content-Type: text/plain; charset="utf-8" Store error_code, then call raise_excp for the err path and raise_excp_restore for the 2-arg path. Drop TCG raise_exception, raise_exception_err, and the unused debug DEF. Keep C do_raise_exception_err via cpu_loop_exit_excp. Signed-off-by: Yonggang Luo --- target/mips/helper.h | 4 ---- target/mips/tcg/exception.c | 20 +------------------- target/mips/tcg/fpu_helper.c | 6 +++--- target/mips/tcg/translate.c | 9 ++++++--- 4 files changed, 10 insertions(+), 29 deletions(-) diff --git a/target/mips/helper.h b/target/mips/helper.h index 779b87101db..83a6dd0b3c4 100644 --- a/target/mips/helper.h +++ b/target/mips/helper.h @@ -1,7 +1,3 @@ -DEF_HELPER_3(raise_exception_err, noreturn, env, i32, int) -DEF_HELPER_2(raise_exception, noreturn, env, i32) -DEF_HELPER_1(raise_exception_debug, noreturn, env) - #ifdef TARGET_MIPS64 DEF_HELPER_4(sdl, void, env, tl, tl, int) DEF_HELPER_4(sdr, void, env, tl, tl, int) diff --git a/target/mips/tcg/exception.c b/target/mips/tcg/exception.c index 630b8b809fa..851b74e4fde 100644 --- a/target/mips/tcg/exception.c +++ b/target/mips/tcg/exception.c @@ -44,22 +44,6 @@ target_ulong exception_resume_pc(CPUMIPSState *env) return bad_pc; } =20 -void helper_raise_exception_err(CPUMIPSState *env, uint32_t exception, - int error_code) -{ - do_raise_exception_err(env, exception, error_code, 0); -} - -void helper_raise_exception(CPUMIPSState *env, uint32_t exception) -{ - do_raise_exception(env, exception, GETPC()); -} - -void helper_raise_exception_debug(CPUMIPSState *env) -{ - do_raise_exception(env, EXCP_DEBUG, 0); -} - static void raise_exception(CPUMIPSState *env, uint32_t exception) { do_raise_exception(env, exception, 0); @@ -145,8 +129,6 @@ void do_raise_exception_err(CPUMIPSState *env, uint32_t= exception, qemu_log_mask(CPU_LOG_INT, "%s: %d (%s) %d\n", __func__, exception, mips_exception_name(exception), error_code); - cs->exception_index =3D exception; env->error_code =3D error_code; - - cpu_loop_exit_restore(cs, pc); + cpu_loop_exit_excp(cs, exception, pc); } diff --git a/target/mips/tcg/fpu_helper.c b/target/mips/tcg/fpu_helper.c index 36af9808025..ce68cda1e43 100644 --- a/target/mips/tcg/fpu_helper.c +++ b/target/mips/tcg/fpu_helper.c @@ -61,7 +61,7 @@ target_ulong helper_cfc1(CPUMIPSState *env, uint32_t reg) if (env->CP0_Config5 & (1 << CP0C5_UFE)) { arg1 =3D (env->CP0_Config5 >> CP0C5_FRE) & 1; } else { - helper_raise_exception(env, EXCP_RI); + do_raise_exception(env, EXCP_RI, GETPC()); } } break; @@ -120,7 +120,7 @@ void helper_ctc1(CPUMIPSState *env, target_ulong arg1, = uint32_t fs, uint32_t rt) env->CP0_Config5 &=3D ~(1 << CP0C5_FRE); compute_hflags(env); } else { - helper_raise_exception(env, EXCP_RI); + do_raise_exception(env, EXCP_RI, GETPC()); } break; case 6: @@ -132,7 +132,7 @@ void helper_ctc1(CPUMIPSState *env, target_ulong arg1, = uint32_t fs, uint32_t rt) env->CP0_Config5 |=3D (1 << CP0C5_FRE); compute_hflags(env); } else { - helper_raise_exception(env, EXCP_RI); + do_raise_exception(env, EXCP_RI, GETPC()); } break; case 25: diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index e3467d15251..b1b09816504 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -1316,14 +1316,17 @@ static inline void restore_cpu_state(CPUMIPSState *= env, DisasContext *ctx) void generate_exception_err(DisasContext *ctx, int excp, int err) { save_cpu_state(ctx, 1); - gen_helper_raise_exception_err(tcg_env, tcg_constant_i32(excp), - tcg_constant_i32(err)); + tcg_gen_st_i32(tcg_constant_i32(err), tcg_env, + offsetof(CPUMIPSState, error_code)); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(excp)); ctx->base.is_jmp =3D DISAS_NORETURN; } =20 void generate_exception(DisasContext *ctx, int excp) { - gen_helper_raise_exception(tcg_env, tcg_constant_i32(excp)); + tcg_gen_st_i32(tcg_constant_i32(0), tcg_env, + offsetof(CPUMIPSState, error_code)); + gen_helper_raise_excp_restore(tcg_env, tcg_constant_i32(excp)); } =20 void generate_exception_end(DisasContext *ctx, int excp) --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573310; cv=none; d=zohomail.com; s=zohoarc; b=AOoWA3gwQ2V97BOC+LBkfdWpyKu8nhCfLgKfoJ7lO5ZRGdSJ+oaNgKpzUwWZuczMofTSskLL7r9xyhIyvZ19F0O2f+WzmntTS4g1C0pc1KC2H5p+w29ezDxQt1zWTDuR/3FvLDXCDp3TVvYnsrUoBs+2T/3/Jjvs3S/eOTbgZAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573310; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xRhjFf72VMP1IXC5iIuXu+o23aKg88Zy2a17bYh8Llk=; b=VLyE6F6wsQuhUCp3DxkLztBNnuuJ5VaKsx45Op2CpORL32drUEGB1ds2kxiVpzDVbgi1I0xlLx8SXYBlJPmM+5MSEYzds6I7Lt1Kjxm/kOqQ/0nssnrlms1NjJiDWQzqwQd6kdMFtMjtuZqBKgsmn4wTbW7B8OeBOthZgOsNdnc= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573310975335.457895084387; Sun, 27 Sep 2026 22:28:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3uU-0003pM-EW; Mon, 28 Sep 2026 01:28:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3qZ-0007Nt-T8 for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:24:23 -0400 Received: from mail-dl2-x0f.google.com ([2607:f8b0:4864:38::f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3qU-0008Dh-M5 for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:24:13 -0400 Received: by mail-dl2-x0f.google.com with SMTP id a92af1059eb24-14373bcc010so2202359c88.1 for ; Sun, 27 Sep 2026 22:24:02 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.23.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:24:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790573041; x=1791177841; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=xRhjFf72VMP1IXC5iIuXu+o23aKg88Zy2a17bYh8Llk=; b=Li8b3jA6sxwpIlPlczgO+sVYm5Vsi6WsrhNV6RKfgdi3583V17RgRxbVkifPP70VSx 1azG7M6eHUfnnN+EMn7YiR+OiR/EpPjWvTdiAaHvPpyWd4qpoCqGnQZChDI83lv0ssfn +hATd6lpZUt9IY4/XIcuKhVQOQSlBavvU1W089nHwWNOxXnl1ID2I0strYoOfRN1nDtm QbPV3Ilprqr9ywnFVLUU1FRZBVPVzksJzU2P9iKAyePsVHq9YIVlJvyHczr84W1HM75S IQ3WsL79RlDNLvTn2hekXSikavsq26d/rr6xzX46itBIcyQGXjw6CBXXZuXRLpPGsUcG zWdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790573041; x=1791177841; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=xRhjFf72VMP1IXC5iIuXu+o23aKg88Zy2a17bYh8Llk=; b=Vf2A0oOwir8Mv1NT1OC6UuovO74MnlsR/o68Wj6Vz4rfJJATKK0pCKpmcHfqOTuKMc roRGlKSsLj22FzPbTw56lmycfmk8dpztpxHDy5j57HN8jkN6BIEmHdQ9m9BLxfP8xo9J YRR3hHG1kZdboO6FR1wRal7xNylGdJlGkyldeTnwHXJIv38aU4TXtyzj/dmLzuGeafZX Dy1rNoc48/zeqnmPJucoYQPRfnhKGPC2g2zmd4Ox4tPBhTvdjolq/YLdLZXNog3Q+trg e07TkUEqXNvaPEvMFxnAT/xsUip99IMWwIUexbCaWjDvmDEJ1mNuFPb9g0NNh/nBEgcl U2YA== X-Gm-Message-State: AFuF++kECpudnJJ+MSCiED4Op/7u1ShbOmkfs89yGxT24zaxNCX4hioI stKPDJQuHeYH17sVRW3/jDwaTLHB8atF3sYIGFQ8s0Gv2plUW8ooXqYMaZeNPEpqvXk= X-Gm-Gg: AYBFou18k5LjFYNttVF5Q2gtwnJiRyaBPeG5uQ/Os1VylfE8Gpz2tlHJuMrNdI/NeUi nR0a0pJehVyvAXWJFkdtgY+v1keGg50Ux7r+cPlqCT5ghr1ykzjue4LkYx58ZCfxrIW2gfnt/M6 gon9aP04qyDcBq2ONhsARNqSBTBmwZKWM8RSl8qHQbX3PU87yCls3d401lP2H3aZZNANgc5NPSd AJPeHQC0oi0RoaFIo3RsD2b2s7HegJEhOaUiJ41JSNEafcQ0zIM4XeuXqvPdIYq/Eso6gc7M/Xl GkKSmhn1i8Nial49z+x1QlE4gFF/wCXmVrFPGKNsaRx/JC+vxU3j2xEYwK1vujU4O7D9Ih787ms clOLi8icBAYZ6QAN+AyvON+rvL82RaGozf+X6gcILogzB4Cu48/BLXW16WjeqsGQAZjyD3Sp/yq 9leAiL1AfWdpEkBpxIjBUQZymLz9IC3Ne434V6Ot0IKUk7JGy/FkkaCDQvuLhx+q6sS35Ig7vEb IGsHjbMCJlat2s/jbPCJxIxmu5UDdvskPvIl2g9Yg== X-Received: by 2002:a05:701b:241a:b0:146:6755:ff08 with SMTP id a92af1059eb24-146ce1a818emr8357405c88.9.1790573041389; Sun, 27 Sep 2026 22:24:01 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 23/24] target/ppc: fold gen_exception_nip into gen_exception_err_nip Date: Mon, 28 Sep 2026 13:20:49 +0800 Message-ID: <20260928052051.251-24-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::f; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x0f.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573312660158500 Content-Type: text/plain; charset="utf-8" gen_exception_nip is gen_exception_err_nip with error_code 0. Call that function instead of raising on its own. Signed-off-by: Yonggang Luo --- target/ppc/translate.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 467b8f3d4ec..f1a7039a325 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -330,12 +330,7 @@ static inline void gen_exception_err(DisasContext *ctx= , uint32_t excp, static void gen_exception_nip(DisasContext *ctx, uint32_t excp, target_ulong nip) { - TCGv_i32 t0; - - gen_update_nip(ctx, nip); - t0 =3D tcg_constant_i32(excp); - gen_helper_raise_exception(tcg_env, t0); - ctx->base.is_jmp =3D DISAS_NORETURN; + gen_exception_err_nip(ctx, excp, 0, nip); } =20 static inline void gen_exception(DisasContext *ctx, uint32_t excp) --=20 2.52.0.windows.1 From nobody Mon Nov 23 05:10:05 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790573312; cv=none; d=zohomail.com; s=zohoarc; b=idQHZKktpBdy04LqMtUPgSA6M58KOLyq5jYzA0Ay0ovFX8XNMNkeF0nIrlLUYAw3oHBxSE62Q7OD9Fldtvgee2xzD4CbaIexHWmp5c8drOAaTKglF6P8QCnEc0uxs/z9fUYU5eCCRu1d2ywLY7o0K+robCsTA5n7nRD+BdTjTBQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790573312; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+S0nIKhoE6QFG2efccnzPtAKgBQbydSBBSG3m5haZ4Q=; b=FR2bvirWtVFURvG08lS6Desh6drNC6XJKnDwkQV/mAPAHbvv7xvSOiV36lHsScAIT5K31drMUsl7MhaDE2mTnaQXee8L8dkr29w22Divpx6wbUpl7jRFBZUb0JCgwWD8C4WBOfrdOzAyahI8LLcfESCWPYF7FfQD6TVexOdgQtk= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790573312761106.80849946939236; Sun, 27 Sep 2026 22:28:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xB3tm-00029E-Of; Mon, 28 Sep 2026 01:27:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xB3qb-0007O3-Er for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:24:24 -0400 Received: from mail-dl2-x28.google.com ([2607:f8b0:4864:38::28]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xB3qU-0008EH-Mq for qemu-devel@nongnu.org; Mon, 28 Sep 2026 01:24:15 -0400 Received: by mail-dl2-x28.google.com with SMTP id a92af1059eb24-14373bcc010so2202442c88.1 for ; Sun, 27 Sep 2026 22:24:10 -0700 (PDT) Received: from WIN-BH9M8FJACR9 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-146bb6551d9sm14726248c88.9.2026.09.27.22.24.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 22:24:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790573049; x=1791177849; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=+S0nIKhoE6QFG2efccnzPtAKgBQbydSBBSG3m5haZ4Q=; b=GatGQdh0mPNmX/8WUB7euUTxzxG5GcEkSS1HUoD9io76r0VZlNDaULaCHNZEpyww50 /Bggv9nE0uEB0yQ7NG3W61iv263+DIhtr1ui+ndI0znFtPgAwxjbGbktsVAYCgaX0S5n NNCfxlU6KgMS5lLdwkFlVeeL4zDwTHdIipPHJCK9RWUMmTA7Wg2+dXVXqNv1j4jrg7Ss w6VIIRWaRIuIVjB2ZV0vwGHqCsI+n6oysoXOjW/IQss0wSDvK5GjGebIybeXn4RUOzUE m/ZCFsheqENjiHwGYZvGr+rEPPP7zr4hIknjSvboQVOUcVAPOoRT3xlZO7Mg2c80e0/l Qq2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790573049; x=1791177849; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=+S0nIKhoE6QFG2efccnzPtAKgBQbydSBBSG3m5haZ4Q=; b=v9kfnhn3ih+uzAWEhcIPbWMxJw7O2nKLU1pTU4tHpmFUlicerX3T7GMpdDb+hyGIM+ eZazlov2LK0P7foLL7XD9aHMFgWwO85Gz70Lvr1cvkfFFRACSlJ3ZeBl9xeHnP9RlOst mbw8O9SFkzXEoCa5ln0TnKcWhwBUoW0dxyHenRZeB9mI/n1VWjX/YKSRLR837oS82ZxF Avs6hxJ5qte6gF/shD71Vfhun9Sqh7pt6nAbhDaX9iDizZsf5OU/1g3lQPpXaNc9gJ5D XNVeG7MAUovr2fOjb/VtReweZNuAMveBNmrrzkbU+VgQ/RH/8Hddwscj8uUqO+2ojVa+ 1aUQ== X-Gm-Message-State: AFuF++l+/dRDKZvS71jaSflVa/V/YrmOYU9W6zhjsMY8RxkwMbqJhE7S Mg3U2N7BH+tbqJu7dV4U+L/GqIVlx8p5ZMKdpnjNcs0gMmtIy6inbcCrmBQtNVypdFM= X-Gm-Gg: AYBFou2LfSwKkgmb1U9X7RRaD2CCzlyc6TBPWyNYY7+uN5Fn67Yl+qwkjT6JRQxtnq2 01I9gzpUBhtPuvVvTdRBcADftHL98FL96T8aWb3FtIemvHC8Stt2/3pKu3Qf26I7CI9jsVKxjP3 IG0Q2ceJ9H/PTZHPke3TMAcsHdaq55Co1UWvVZ8HoKxWkJqywmn+OrxqPKbbv+4gxeXEh7PNnTu VZzZ4RL2KrhRIWE9iVk47uSzC08FjZPu+Fhz7UEHlv3q1eE6glbArrVIJ/yDPBt9pSfGk8bVrtI le6gbhPDQuThYCtWiCHY5QzKyDrSM8CWdbKrLNaSSxvNU1BAwe+kj7/UPpoacy1LlLvXgys4t2Z M7GoHhIgf8hUrvDJrPpUbwT62/5tlNZSEG2Dg3cL9aid/+brGObQmnHNOHU1jUQg5VpBu0LhWG7 zKcYBk+esuXx4mQmJAOnMj+p5RtZnH9pZveYHTrXAuitpqR5eS9HmkTqWSNnSNHDozpGTD8GZmV ITx8Lel026dRQULxr40rP5cxsjAVds= X-Received: by 2002:a05:701b:21c5:b0:145:5c4:6500 with SMTP id a92af1059eb24-146ce1a9f0fmr9296737c88.1.1790573048970; Sun, 27 Sep 2026 22:24:08 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Helge Deller , Harsh Prateek Bora , Weiwei Li , Brian Cain , Daniel Henrique Barboza , Max Filippov , Chao Liu , Aleksandar Rikalo , Philippe Mathieu-Daude , Matthew Rosato , Ilya Leoshkevich , Alistair Francis , Stafford Horne , Chinmay Rath , Nicholas Piggin , Yoshinori Sato , Peter Maydell , Artyom Tarasenko , Laurent Vivier , Jiaxun Yang , Palmer Dabbelt , "Edgar E. Iglesias" , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Farman , qemu-riscv@nongnu.org, Richard Henderson , David Hildenbrand , Glenn Miles , Cornelia Huck , Mark Cave-Ayland , Song Gao <17746591750@163.com>, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Pierrick Bouvier , Paolo Bonzini , qemu-s390x@nongnu.org Subject: [PATCH v2 24/24] target/ppc: convert raise_exception to raise_excp Date: Mon, 28 Sep 2026 13:20:50 +0800 Message-ID: <20260928052051.251-25-luoyonggang@gmail.com> X-Mailer: git-send-email 2.52.0.windows.1 In-Reply-To: <20260928052051.251-1-luoyonggang@gmail.com> References: <20260928052051.251-1-luoyonggang@gmail.com> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:38::28; envelope-from=luoyonggang@gmail.com; helo=mail-dl2-x28.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790573314736158500 Content-Type: text/plain; charset="utf-8" Store error_code, then call raise_excp. Drop TCG raise_exception and raise_exception_err. Move C raise_exception_err_ra to static inline in internal.h, and remove the cpu.h prototype. Callers include internal.h. Signed-off-by: Yonggang Luo --- target/ppc/cpu.h | 3 --- target/ppc/helper.h | 2 -- target/ppc/internal.h | 9 +++++++++ target/ppc/misc_helper.c | 1 + target/ppc/tcg-excp_helper.c | 21 --------------------- target/ppc/timebase_helper.c | 1 + target/ppc/translate.c | 13 ++++++------- 7 files changed, 17 insertions(+), 33 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 3fb51bbeb82..217b4f334e5 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -2819,9 +2819,6 @@ void cpu_write_xer(CPUPPCState *env, target_ulong xer= ); */ #define is_book3s_arch2x(ctx) (!!((ctx)->insns_flags & PPC_SEGMENT_64B)) =20 -G_NORETURN void raise_exception_err_ra(CPUPPCState *env, uint32_t exceptio= n, - uint32_t error_code, uintptr_t radd= r); - /* PERFM EBB helper*/ #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) void raise_ebb_perfm_exception(CPUPPCState *env); diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 80d6616bab4..8a804d326ac 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -1,5 +1,3 @@ -DEF_HELPER_FLAGS_3(raise_exception_err, TCG_CALL_NO_WG, noreturn, env, i32= , i32) -DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_WG, noreturn, env, i32) DEF_HELPER_FLAGS_4(TW, TCG_CALL_NO_WG, void, env, tl, tl, i32) #if defined(TARGET_PPC64) DEF_HELPER_FLAGS_4(TD, TCG_CALL_NO_WG, void, env, tl, tl, i32) diff --git a/target/ppc/internal.h b/target/ppc/internal.h index a20a0f9f7e0..14c08c23ffc 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -320,8 +320,17 @@ static inline int ger_pack_masks(int pmsk, int ymsk, i= nt xmsk) =20 #ifdef CONFIG_TCG #include "accel/tcg/tb-cpu-state.h" +#include "accel/tcg/cpu-loop.h" =20 TCGTBCPUState ppc_get_tb_cpu_state(CPUState *cs); + +static inline G_NORETURN +void raise_exception_err_ra(CPUPPCState *env, uint32_t excp, + uint32_t err, uintptr_t ra) +{ + env->error_code =3D err; + cpu_loop_exit_excp(env_cpu(env), excp, ra); +} #endif =20 #endif /* PPC_INTERNAL_H */ diff --git a/target/ppc/misc_helper.c b/target/ppc/misc_helper.c index 0e625cbb704..527af513f92 100644 --- a/target/ppc/misc_helper.c +++ b/target/ppc/misc_helper.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu/log.h" #include "cpu.h" +#include "internal.h" #include "exec/cputlb.h" #include "exec/helper-proto.h" #include "qemu/error-report.h" diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c index 93aedb0c8e2..6289ca7dfd5 100644 --- a/target/ppc/tcg-excp_helper.c +++ b/target/ppc/tcg-excp_helper.c @@ -34,27 +34,6 @@ /*************************************************************************= ****/ /* Exceptions processing helpers */ =20 -void raise_exception_err_ra(CPUPPCState *env, uint32_t exception, - uint32_t error_code, uintptr_t raddr) -{ - CPUState *cs =3D env_cpu(env); - - cs->exception_index =3D exception; - env->error_code =3D error_code; - cpu_loop_exit_restore(cs, raddr); -} - -void helper_raise_exception_err(CPUPPCState *env, uint32_t exception, - uint32_t error_code) -{ - raise_exception_err_ra(env, exception, error_code, 0); -} - -void helper_raise_exception(CPUPPCState *env, uint32_t exception) -{ - raise_exception_err_ra(env, exception, 0, 0); -} - #ifndef CONFIG_USER_ONLY =20 static G_NORETURN void raise_exception_err(CPUPPCState *env, uint32_t exce= ption, diff --git a/target/ppc/timebase_helper.c b/target/ppc/timebase_helper.c index 7209b418fb6..d0986ff261a 100644 --- a/target/ppc/timebase_helper.c +++ b/target/ppc/timebase_helper.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "cpu.h" +#include "internal.h" #include "hw/ppc/ppc.h" #include "exec/helper-proto.h" #include "qemu/log.h" diff --git a/target/ppc/translate.c b/target/ppc/translate.c index f1a7039a325..767b8ed7697 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -308,12 +308,10 @@ static inline void gen_update_nip(DisasContext *ctx, = target_ulong nip) static void gen_exception_err_nip(DisasContext *ctx, uint32_t excp, uint32_t error, target_ulong nip) { - TCGv_i32 t0, t1; - gen_update_nip(ctx, nip); - t0 =3D tcg_constant_i32(excp); - t1 =3D tcg_constant_i32(error); - gen_helper_raise_exception_err(tcg_env, t0, t1); + tcg_gen_st_i32(tcg_constant_i32(error), tcg_env, + offsetof(CPUPPCState, error_code)); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(excp)); ctx->base.is_jmp =3D DISAS_NORETURN; } =20 @@ -372,8 +370,9 @@ static void gen_debug_exception(DisasContext *ctx, bool= rfi_type) gen_load_spr(t0, SPR_BOOKE_DBSR); tcg_gen_ori_tl(t0, t0, dbsr); gen_store_spr(SPR_BOOKE_DBSR, t0); - gen_helper_raise_exception(tcg_env, - tcg_constant_i32(POWERPC_EXCP_DEBUG)); + tcg_gen_st_i32(tcg_constant_i32(0), tcg_env, + offsetof(CPUPPCState, error_code)); + gen_helper_raise_excp(tcg_env, tcg_constant_i32(POWERPC_EXCP_DEBUG= )); ctx->base.is_jmp =3D DISAS_NORETURN; } else { if (!rfi_type) { /* BookS does not single step rfi type instructio= ns */ --=20 2.52.0.windows.1