Signed-off-by: Yonggang Luo <[email protected]>
---
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 b551c1439ec..715e3cb327c 100644
--- a/accel/tcg/cpu-exec-common.c
+++ b/accel/tcg/cpu-exec-common.c
@@ -131,6 +131,18 @@ void cpu_raise_excp_restore(CPUState *cpu, int
exception_index,
cpu_loop_exit_restore(cpu, retaddr);
}
+/* Raise exception and exit the TB without restoring guest state. */
+void HELPER(raise_excp)(CPUArchState *env, uint32_t exception)
+{
+ cpu_raise_excp(env_cpu(env), exception);
+}
+
+/* Raise exception and exit the TB, restoring state from GETPC(). */
+void HELPER(raise_excp_restore)(CPUArchState *env, uint32_t exception)
+{
+ cpu_raise_excp_restore(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)
--
2.52.0.windows.1