From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: qemu-devel@nongnu.org
Cc: "Yoshinori Sato" <yoshinori.sato@nifty.com>,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
Subject: [PATCH 1/2] target/rx: Unify BRK and INT trap handling
Date: Tue, 29 Sep 2026 08:57:49 +0200 [thread overview]
Message-ID: <20260929065750.9550-1-philmd@oss.qualcomm.com> (raw)
In-Reply-To: <CAE2XoE9VC6YfqsOQBM_KLrdaKpU-=bD9CscCDGi63EsQt-EhFg@mail.gmail.com>
BRK is equivalent to INT #0, so route both instructions
through the same translation path and trap helper.
Remove the duplicate helper declarations and implementation
used by the two instructions.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
target/rx/helper.h | 3 +--
target/rx/op_helper.c | 7 +------
target/rx/translate.c | 21 ++++++++++-----------
3 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/target/rx/helper.h b/target/rx/helper.h
index 8cc38b0cb71..f3897ce7619 100644
--- a/target/rx/helper.h
+++ b/target/rx/helper.h
@@ -2,8 +2,7 @@ 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_2(trap, noreturn, env, i32)
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..6782912247e 100644
--- a/target/rx/op_helper.c
+++ b/target/rx/op_helper.c
@@ -455,12 +455,7 @@ G_NORETURN void helper_wait(CPURXState *env)
raise_exception(env, EXCP_HLT, 0);
}
-G_NORETURN void helper_rxint(CPURXState *env, uint32_t vec)
+G_NORETURN void helper_trap(CPURXState *env, uint32_t vec)
{
raise_exception(env, 0x100 + vec, 0);
}
-
-G_NORETURN void helper_rxbrk(CPURXState *env)
-{
- raise_exception(env, 0x100, 0);
-}
diff --git a/target/rx/translate.c b/target/rx/translate.c
index 132d495710c..d0910fbf8e7 100644
--- a/target/rx/translate.c
+++ b/target/rx/translate.c
@@ -2170,26 +2170,25 @@ static bool trans_RTE(DisasContext *ctx, arg_RTE *a)
return true;
}
+static bool do_trap(DisasContext *ctx, uint8_t vec)
+{
+ tcg_gen_movi_i32(cpu_pc, ctx->base.pc_next);
+ gen_helper_trap(tcg_env, tcg_constant_i32(vec));
+ ctx->base.is_jmp = DISAS_NORETURN;
+ return true;
+}
+
/* brk */
static bool trans_BRK(DisasContext *ctx, arg_BRK *a)
{
- tcg_gen_movi_i32(cpu_pc, ctx->base.pc_next);
- gen_helper_rxbrk(tcg_env);
- ctx->base.is_jmp = DISAS_NORETURN;
- return true;
+ return do_trap(ctx, 0);
}
/* int #imm */
static bool trans_INT(DisasContext *ctx, arg_INT *a)
{
- TCGv_i32 vec;
-
tcg_debug_assert(a->imm < 0x100);
- vec = tcg_constant_i32(a->imm);
- tcg_gen_movi_i32(cpu_pc, ctx->base.pc_next);
- gen_helper_rxint(tcg_env, vec);
- ctx->base.is_jmp = DISAS_NORETURN;
- return true;
+ return do_trap(ctx, a->imm);
}
/* wait */
--
2.53.0
next prev parent reply other threads:[~2026-09-29 6:58 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 5:20 [PATCH v2 00/24] accel/tcg: share raise_excp across TCG targets Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 01/24] accel/tcg: move helper_exit_atomic next to cpu_loop_exit_atomic Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 02/24] accel/tcg: add cpu_loop_exit_excp Yonggang Luo
2026-09-29 5:23 ` Philippe Mathieu-Daudé
2026-09-29 5:27 ` Yonggang Luo
2026-09-30 7:53 ` Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 03/24] accel/tcg: add raise_excp and raise_excp_restore helpers Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 04/24] target/rx: name guest trap numbers RX_EXCP_* Yonggang Luo
2026-09-29 5:26 ` Philippe Mathieu-Daudé
2026-09-29 5:29 ` Yonggang Luo
2026-09-29 6:57 ` Philippe Mathieu-Daudé [this message]
2026-09-29 6:57 ` [PATCH 2/2] target/rx: Define exception vector constants Philippe Mathieu-Daudé
2026-09-28 5:20 ` [PATCH v2 05/24] target/rx: convert raises to raise_excp Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 06/24] target/sh4: name guest trap numbers SH4_EXCP_* Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 07/24] target/sh4: convert raises to raise_excp Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 08/24] target/m68k: " Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 09/24] target/or1k: convert exception " Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 10/24] target/microblaze: convert raise_exception " Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 11/24] target/sparc: " Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 12/24] target/loongarch: " Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 13/24] target/hexagon: convert raise_exception to hexagon_raise_exception Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 14/24] target/hppa: convert excp to raise_excp Yonggang Luo
2026-09-29 5:21 ` Philippe Mathieu-Daudé
2026-09-28 5:20 ` [PATCH v2 15/24] target/alpha: " Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 16/24] target/s390x: convert exception " Yonggang Luo
2026-09-28 17:42 ` Ilya Leoshkevich
2026-09-28 5:20 ` [PATCH v2 17/24] target/xtensa: add gen_yield for EXCP_YIELD Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 18/24] target/xtensa: convert exception to raise_excp Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 19/24] target/avr: convert debug/break/sleep " Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 20/24] target/arm: convert exception_internal " Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 21/24] target/riscv: convert raise_exception to riscv_raise_exception Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 22/24] target/mips: convert raise_exception to raise_excp Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 23/24] target/ppc: fold gen_exception_nip into gen_exception_err_nip Yonggang Luo
2026-09-28 5:20 ` [PATCH v2 24/24] target/ppc: convert raise_exception to raise_excp Yonggang Luo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260929065750.9550-1-philmd@oss.qualcomm.com \
--to=philmd@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
--cc=yoshinori.sato@nifty.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.