On 12/2/24 11:26, Julian Ganz wrote:
> 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 hooks for Alpha targets.
> ---
> target/alpha/helper.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/target/alpha/helper.c b/target/alpha/helper.c
> index 2f1000c99f..acc92402af 100644
> --- a/target/alpha/helper.c
> +++ b/target/alpha/helper.c
> @@ -25,6 +25,7 @@
> #include "fpu/softfloat-types.h"
> #include "exec/helper-proto.h"
> #include "qemu/qemu-print.h"
> +#include "qemu/plugin.h"
>
>
> #define CONVERT_BIT(X, SRC, DST) \
> @@ -326,6 +327,7 @@ void alpha_cpu_do_interrupt(CPUState *cs)
> {
> CPUAlphaState *env = cpu_env(cs);
> int i = cs->exception_index;
> + uint64_t last_pc = env->pc;
>
> if (qemu_loglevel_mask(CPU_LOG_INT)) {
> static int count;
> @@ -429,6 +431,16 @@ void alpha_cpu_do_interrupt(CPUState *cs)
>
> /* Switch to PALmode. */
> env->flags |= ENV_FLAG_PAL_MODE;
> +
> + switch (i) {
> + case EXCP_SMP_INTERRUPT:
> + case EXCP_CLK_INTERRUPT:
> + case EXCP_DEV_INTERRUPT:
> + qemu_plugin_vcpu_interrupt_cb(cs, last_pc, env->pc);
> + break;
> + qemu_plugin_vcpu_exception_cb(cs, last_pc, env->pc);
> + default:
> + }
Does not compile with clang:
../target/alpha/helper.c:442:13: error: label at end of compound
statement: expected statement
default:
^
> }
>
> bool alpha_cpu_exec_interrupt(CPUState *cs, int interrupt_request)