From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KERIw-0006Tu-3N for qemu-devel@nongnu.org; Thu, 03 Jul 2008 12:05:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KERIo-0006MG-0c for qemu-devel@nongnu.org; Thu, 03 Jul 2008 12:05:02 -0400 Received: from [199.232.76.173] (port=33015 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KERIn-0006M5-Jr for qemu-devel@nongnu.org; Thu, 03 Jul 2008 12:04:57 -0400 Received: from gecko.sbs.de ([194.138.37.40]:16448) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KERIk-0002F2-SQ for qemu-devel@nongnu.org; Thu, 03 Jul 2008 12:04:57 -0400 Received: from mail2.sbs.de (localhost [127.0.0.1]) by gecko.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id m63G4nHL017234 for ; Thu, 3 Jul 2008 18:04:49 +0200 Received: from [139.25.109.167] (mchn012c.ww002.siemens.net [139.25.109.167] (may be forged)) by mail2.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id m63G4nif022037 for ; Thu, 3 Jul 2008 18:04:49 +0200 Resent-To: qemu-devel@nongnu.org Resent-Message-Id: <486CF8A1.90007@siemens.com> Message-ID: <486CF826.7090107@siemens.com> Date: Thu, 03 Jul 2008 18:02:46 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <486CF559.5090805@siemens.com> In-Reply-To: <486CF559.5090805@siemens.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH 11/13] Add debug exception hook Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 --- cpu-exec.c | 13 +++++++++++++ exec-all.h | 4 ++++ 2 files changed, 17 insertions(+) Index: b/cpu-exec.c =================================================================== --- a/cpu-exec.c +++ b/cpu-exec.c @@ -232,6 +232,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; @@ -239,6 +249,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/exec-all.h =================================================================== --- a/exec-all.h +++ b/exec-all.h @@ -418,3 +418,7 @@ static inline int kqemu_is_ok(CPUState * } #endif + +typedef void (CPUDebugExcpHandler)(CPUState *env); + +CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler);