[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v3 08/11] target/mips: call plugin trap callbacks
From: |
Julian Ganz |
Subject: |
[RFC PATCH v3 08/11] target/mips: call plugin trap callbacks |
Date: |
Mon, 2 Dec 2024 20:26:49 +0100 |
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.
---
target/mips/tcg/sysemu/tlb_helper.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/target/mips/tcg/sysemu/tlb_helper.c
b/target/mips/tcg/sysemu/tlb_helper.c
index e98bb95951..2b19975d53 100644
--- a/target/mips/tcg/sysemu/tlb_helper.c
+++ b/target/mips/tcg/sysemu/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"
@@ -1033,6 +1034,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) {
@@ -1051,6 +1053,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, env->active_tc.PC);
return;
case EXCP_DSS:
env->CP0_Debug |= 1 << CP0DB_DSS;
@@ -1335,6 +1338,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, env->active_tc.PC);
+ break;
+ default:
+ qemu_plugin_vcpu_exception_cb(cs, last_pc, env->active_tc.PC);
+ }
cs->exception_index = EXCP_NONE;
}
--
2.45.2
- Re: [RFC PATCH v3 01/11] plugins: add types for callbacks related to certain discontinuities, (continued)
[RFC PATCH v3 06/11] target/arm: call plugin trap callbacks, Julian Ganz, 2024/12/02
[RFC PATCH v3 03/11] plugins: add hooks for new discontinuity related callbacks, Julian Ganz, 2024/12/02
[RFC PATCH v3 05/11] target/alpha: call plugin trap callbacks, Julian Ganz, 2024/12/02
[RFC PATCH v3 02/11] plugins: add API for registering discontinuity callbacks, Julian Ganz, 2024/12/02
[RFC PATCH v3 07/11] target/avr: call plugin trap callbacks, Julian Ganz, 2024/12/02
[RFC PATCH v3 08/11] target/mips: call plugin trap callbacks,
Julian Ganz <=
[RFC PATCH v3 09/11] target/riscv: call plugin trap callbacks, Julian Ganz, 2024/12/02
[RFC PATCH v3 10/11] target/sparc: call plugin trap callbacks, Julian Ganz, 2024/12/02
[RFC PATCH v3 11/11] tests: add plugin asserting correctness of discon event's to_pc, Julian Ganz, 2024/12/02
- Re: [RFC PATCH v3 11/11] tests: add plugin asserting correctness of discon event's to_pc, Pierrick Bouvier, 2024/12/04
- Re: [RFC PATCH v3 11/11] tests: add plugin asserting correctness of discon event's to_pc, Julian Ganz, 2024/12/05
- Re: [RFC PATCH v3 11/11] tests: add plugin asserting correctness of discon event's to_pc, Pierrick Bouvier, 2024/12/05
- Re: [RFC PATCH v3 11/11] tests: add plugin asserting correctness of discon event's to_pc, Julian Ganz, 2024/12/05
- Re: [RFC PATCH v3 11/11] tests: add plugin asserting correctness of discon event's to_pc, Pierrick Bouvier, 2024/12/05
- Re: [RFC PATCH v3 11/11] tests: add plugin asserting correctness of discon event's to_pc, Julian Ganz, 2024/12/06