target/openrisc: 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 hooks for OpenRISC targets. We treat anything other than resets, timer and device interrupts as exceptions. Signed-off-by: Julian Ganz <neither@nut.email> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20251027110344.2289945-21-alex.bennee@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
parent
c3d7005a6c
commit
cbf0e6e3dc
1 changed files with 15 additions and 0 deletions
|
|
@ -25,11 +25,13 @@
|
|||
#ifndef CONFIG_USER_ONLY
|
||||
#include "hw/loader.h"
|
||||
#endif
|
||||
#include "qemu/plugin.h"
|
||||
|
||||
void openrisc_cpu_do_interrupt(CPUState *cs)
|
||||
{
|
||||
CPUOpenRISCState *env = cpu_env(cs);
|
||||
int exception = cs->exception_index;
|
||||
uint64_t last_pc = env->pc;
|
||||
|
||||
env->epcr = env->pc;
|
||||
|
||||
|
|
@ -98,6 +100,19 @@ void openrisc_cpu_do_interrupt(CPUState *cs)
|
|||
cpu_abort(cs, "Unhandled exception 0x%x\n", exception);
|
||||
}
|
||||
|
||||
switch (exception) {
|
||||
case EXCP_RESET:
|
||||
/* Resets are already exposed to plugins through a dedicated callback */
|
||||
break;
|
||||
case EXCP_TICK:
|
||||
case EXCP_INT:
|
||||
qemu_plugin_vcpu_interrupt_cb(cs, last_pc);
|
||||
break;
|
||||
default:
|
||||
qemu_plugin_vcpu_exception_cb(cs, last_pc);
|
||||
break;
|
||||
}
|
||||
|
||||
cs->exception_index = -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue