@samitouri / QOSamiQemu / commits / d57453735f

target/hexagon: Implement do_raise_exception()

Reviewed-by: Taylor Simpson <ltaylorsimpson@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>

Brian Cain committed Jun 22, 2026 at 15:28 UTC d57453735f6d26e882486c78e6009e9c457463ae
2 files changed +19
target/hexagon/internal.h
+5
@@ -31,6 +31,11 @@ void hexagon_debug(CPUHexagonState *env);
31
32 extern const char * const hexagon_regnames[TOTAL_PER_THREAD_REGS];
33
34 +void G_NORETURN do_raise_exception(CPUHexagonState *env,
35 + uint32_t exception,
36 + uint32_t PC,
37 + uintptr_t retaddr);
38 +
39 #ifndef CONFIG_USER_ONLY
40 extern const VMStateDescription vmstate_hexagon_cpu;
41 #endif
target/hexagon/op_helper.c
+14
@@ -41,6 +41,20 @@
41 #define SF_MANTBITS 23
42
43 /* Exceptions processing helpers */
44 +G_NORETURN
45 +void do_raise_exception(CPUHexagonState *env, uint32_t exception,
46 + uint32_t PC, uintptr_t retaddr)
47 +{
48 + CPUState *cs = env_cpu(env);
49 + qemu_log_mask(CPU_LOG_INT, "%s: 0x%08" PRIx32 ", @ %08" PRIx32 "\n",
50 + __func__, exception, PC);
51 + ASSERT_DIRECT_TO_GUEST_UNSET(env, exception);
52 +
53 + env->gpr[HEX_REG_PC] = PC;
54 + cs->exception_index = exception;
55 + cpu_loop_exit_restore(cs, retaddr);
56 +}
57 +
58 G_NORETURN void hexagon_raise_exception_err(CPUHexagonState *env,
59 uint32_t exception,
60 uintptr_t pc)