[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 13/23] target/mips: call plugin trap callbacks
From: |
Julian Ganz |
Subject: |
[PATCH v4 13/23] target/mips: call plugin trap callbacks |
Date: |
Sun, 11 May 2025 15:14:05 +0200 |
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 MIPS targets. We consider the exceptions
NMI and EXT_INTERRUPT to be asynchronous interrupts rather than
exceptions.
Signed-off-by: Julian Ganz <neither@nut.email>
---
target/mips/tcg/system/tlb_helper.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/target/mips/tcg/system/tlb_helper.c
b/target/mips/tcg/system/tlb_helper.c
index eccaf3624c..abc4d9fef0 100644
--- a/target/mips/tcg/system/tlb_helper.c
+++ b/target/mips/tcg/system/tlb_helper.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
#include "qemu/bitops.h"
+#include "qemu/plugin.h"
#include "cpu.h"
#include "internal.h"
@@ -1034,6 +1035,7 @@ void mips_cpu_do_interrupt(CPUState *cs)
bool update_badinstr = 0;
target_ulong offset;
int cause = -1;
+ uint64_t last_pc = env->active_tc.PC;
if (qemu_loglevel_mask(CPU_LOG_INT)
&& cs->exception_index != EXCP_EXT_INTERRUPT) {
@@ -1052,6 +1054,7 @@ void mips_cpu_do_interrupt(CPUState *cs)
cs->exception_index = EXCP_NONE;
mips_semihosting(env);
env->active_tc.PC += env->error_code;
+ qemu_plugin_vcpu_hostcall_cb(cs, last_pc);
return;
case EXCP_DSS:
env->CP0_Debug |= 1 << CP0DB_DSS;
@@ -1336,6 +1339,14 @@ void mips_cpu_do_interrupt(CPUState *cs)
env->CP0_Status, env->CP0_Cause, env->CP0_BadVAddr,
env->CP0_DEPC);
}
+ switch (cs->exception_index) {
+ case EXCP_NMI:
+ case EXCP_EXT_INTERRUPT:
+ qemu_plugin_vcpu_interrupt_cb(cs, last_pc);
+ break;
+ default:
+ qemu_plugin_vcpu_exception_cb(cs, last_pc);
+ }
cs->exception_index = EXCP_NONE;
}
--
2.49.0
- [PATCH v4 06/23] target/arm: call plugin trap callbacks, (continued)
- [PATCH v4 06/23] target/arm: call plugin trap callbacks, Julian Ganz, 2025/05/11
- [PATCH v4 14/23] target/openrisc: call plugin trap callbacks, Julian Ganz, 2025/05/11
- [PATCH v4 09/23] target/i386: call plugin trap callbacks, Julian Ganz, 2025/05/11
- [PATCH v4 08/23] target/hppa: call plugin trap callbacks, Julian Ganz, 2025/05/11
- [PATCH v4 16/23] target/riscv: call plugin trap callbacks, Julian Ganz, 2025/05/11
- [PATCH v4 19/23] target/sparc: call plugin trap callbacks, Julian Ganz, 2025/05/11
- [PATCH v4 10/23] target/loongarch: call plugin trap callbacks, Julian Ganz, 2025/05/11
- [PATCH v4 12/23] target/microblaze: call plugin trap callbacks, Julian Ganz, 2025/05/11
- [PATCH v4 13/23] target/mips: call plugin trap callbacks,
Julian Ganz <=
- [PATCH v4 15/23] target/ppc: call plugin trap callbacks, Julian Ganz, 2025/05/11
- [PATCH v4 11/23] target/m68k: call plugin trap callbacks, Julian Ganz, 2025/05/11
- [PATCH v4 18/23] target/s390x: call plugin trap callbacks, Julian Ganz, 2025/05/11
[PATCH v4 20/23] target/xtensa: call plugin trap callbacks, Julian Ganz, 2025/05/11
[PATCH v4 17/23] target/rx: call plugin trap callbacks, Julian Ganz, 2025/05/11
[PATCH v4 21/23] tests: add plugin asserting correctness of discon event's to_pc, Julian Ganz, 2025/05/11