From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KVpVF-0006W5-GA for qemu-devel@nongnu.org; Wed, 20 Aug 2008 11:21:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KVpVC-0006UJ-Ap for qemu-devel@nongnu.org; Wed, 20 Aug 2008 11:21:39 -0400 Received: from [199.232.76.173] (port=34695 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KVpVB-0006Tz-P2 for qemu-devel@nongnu.org; Wed, 20 Aug 2008 11:21:38 -0400 Received: from lizzard.sbs.de ([194.138.37.39]:18720) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KVpVB-0000hV-2Y for qemu-devel@nongnu.org; Wed, 20 Aug 2008 11:21:37 -0400 Received: from mail1.sbs.de (localhost [127.0.0.1]) by lizzard.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id m7KFLZah023607 for ; Wed, 20 Aug 2008 17:21:35 +0200 Received: from [139.25.109.167] (mchn012c.ww002.siemens.net [139.25.109.167] (may be forged)) by mail1.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id m7KFLZoS002299 for ; Wed, 20 Aug 2008 17:21:35 +0200 Resent-To: qemu-devel@nongnu.org Resent-Message-Id: <48AC367F.10109@siemens.com> Message-ID: <48AC31A2.9030800@siemens.com> Date: Wed, 20 Aug 2008 17:00:50 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <486CF559.5090805@siemens.com> <48AC2E09.3030405@siemens.com> In-Reply-To: <48AC2E09.3030405@siemens.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [RESEND][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 @@ -233,6 +233,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; @@ -240,6 +250,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 @@ -388,3 +388,7 @@ static inline int kqemu_is_ok(CPUState * } #endif + +typedef void (CPUDebugExcpHandler)(CPUState *env); + +CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler);