target/tricore: call plugin trap callbacks

We recently introduced API for registering callbacks for trap related
events as well as the corresponding hook functions. Due to differences
between architectures, the latter need to be called from target specific
code.

This change places an exception hook for TriCore targets. Interrupts are
not implemented for this target and it has no host calls.

Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Julian Ganz <neither@nut.email>
Message-ID: <20251027110344.2289945-28-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
Julian Ganz 2025-10-27 11:03:34 +00:00 committed by Alex Bennée
parent 8a315a788a
commit c4057ef38f

View file

@ -19,6 +19,7 @@
#include "qemu/host-utils.h"
#include "exec/helper-proto.h"
#include "accel/tcg/cpu-ldst.h"
#include "qemu/plugin.h"
#include <zlib.h> /* for crc32 */
@ -29,8 +30,11 @@ void raise_exception_sync_internal(CPUTriCoreState *env, uint32_t class, int tin
uintptr_t pc, uint32_t fcd_pc)
{
CPUState *cs = env_cpu(env);
uint64_t last_pc;
/* in case we come from a helper-call we need to restore the PC */
cpu_restore_state(cs, pc);
last_pc = env->PC;
/* Tin is loaded into d[15] */
env->gpr_d[15] = tin;
@ -90,6 +94,7 @@ void raise_exception_sync_internal(CPUTriCoreState *env, uint32_t class, int tin
/* Update PC using the trap vector table */
env->PC = env->BTV | (class << 5);
qemu_plugin_vcpu_exception_cb(cs, last_pc);
cpu_loop_exit(cs);
}