This patch allows to hook into the delivery of EXCP_DEBUG so that other
use beyond guest debugging becomes possible.

Signed-off-by: Jan Kiszka <[EMAIL PROTECTED]>
---
 qemu/cpu-exec.c |   13 +++++++++++++
 qemu/exec-all.h |    4 ++++
 2 files changed, 17 insertions(+)

Index: b/qemu/cpu-exec.c
===================================================================
--- a/qemu/cpu-exec.c
+++ b/qemu/cpu-exec.c
@@ -244,6 +244,16 @@ static inline TranslationBlock *tb_find_
     return tb;
 }
 
+static CPUDebugExcpHandler *debug_excp_handler;
+
+CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler)
+{
+    CPUDebugExcpHandler *old_handler = debug_excp_handler;
+
+    debug_excp_handler = handler;
+    return old_handler;
+}
+
 static void cpu_handle_debug_exception(CPUState *env)
 {
     CPUWatchpoint *wp;
@@ -251,6 +261,9 @@ static void cpu_handle_debug_exception(C
     if (!env->watchpoint_hit)
         for (wp = env->watchpoints; wp != NULL; wp = wp->next)
             wp->flags &= ~BP_WATCHPOINT_HIT;
+
+    if (debug_excp_handler)
+        debug_excp_handler(env);
 }
 
 /* main execution loop */
Index: b/qemu/exec-all.h
===================================================================
--- a/qemu/exec-all.h
+++ b/qemu/exec-all.h
@@ -385,3 +385,7 @@ static inline int kqemu_is_ok(CPUState *
 }
 
 #endif
+
+typedef void (CPUDebugExcpHandler)(CPUState *env);
+
+CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler);

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to