Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LxPk2-0004Aq-0n for qemu-devel@nongnu.org; Fri, 24 Apr 2009 14:03:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LxPk1-0004Ae-En for qemu-devel@nongnu.org; Fri, 24 Apr 2009 14:03:13 -0400 Received: from [199.232.76.173] (port=45777 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LxPk1-0004Ab-Cm for qemu-devel@nongnu.org; Fri, 24 Apr 2009 14:03:13 -0400 Received: from savannah.gnu.org ([199.232.41.3]:35151 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LxPk0-0003Bf-OJ for qemu-devel@nongnu.org; Fri, 24 Apr 2009 14:03:12 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1LxPjz-0002pO-Vs for qemu-devel@nongnu.org; Fri, 24 Apr 2009 18:03:12 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1LxPjz-0002pK-Nh for qemu-devel@nongnu.org; Fri, 24 Apr 2009 18:03:11 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Fri, 24 Apr 2009 18:03:11 +0000 Subject: [Qemu-devel] [7236] qemu: create helper for event notification (Marcelo Tosatti) List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 7236 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7236 Author: aliguori Date: 2009-04-24 18:03:11 +0000 (Fri, 24 Apr 2009) Log Message: ----------- qemu: create helper for event notification (Marcelo Tosatti) Signed-off-by: Marcelo Tosatti Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/hw/mac_dbdma.c trunk/qemu-common.h trunk/vl.c Modified: trunk/hw/mac_dbdma.c =================================================================== --- trunk/hw/mac_dbdma.c 2009-04-23 18:42:30 UTC (rev 7235) +++ trunk/hw/mac_dbdma.c 2009-04-24 18:03:11 UTC (rev 7236) @@ -651,9 +651,7 @@ void DBDMA_schedule(void) { - CPUState *env = cpu_single_env; - if (env) - cpu_exit(env); + qemu_notify_event(); } static void Modified: trunk/qemu-common.h =================================================================== --- trunk/qemu-common.h 2009-04-23 18:42:30 UTC (rev 7235) +++ trunk/qemu-common.h 2009-04-24 18:03:11 UTC (rev 7236) @@ -186,6 +186,9 @@ /* Force QEMU to stop what it's doing and service IO */ void qemu_service_io(void); +/* Force QEMU to process pending events */ +void qemu_notify_event(void); + typedef struct QEMUIOVector { struct iovec *iov; int niov; Modified: trunk/vl.c =================================================================== --- trunk/vl.c 2009-04-23 18:42:30 UTC (rev 7235) +++ trunk/vl.c 2009-04-24 18:03:11 UTC (rev 7236) @@ -1193,9 +1193,8 @@ qemu_rearm_alarm_timer(alarm_timer); } /* Interrupt execution to force deadline recalculation. */ - if (use_icount && cpu_single_env) { - cpu_exit(cpu_single_env); - } + if (use_icount) + qemu_notify_event(); } } @@ -1370,6 +1369,7 @@ #endif } event_pending = 1; + qemu_notify_event(); } } @@ -3406,15 +3406,7 @@ void qemu_service_io(void) { - CPUState *env = cpu_single_env; - if (env) { - cpu_exit(env); -#ifdef CONFIG_KQEMU - if (env->kqemu_enabled) { - kqemu_cpu_interrupt(env); - } -#endif - } + qemu_notify_event(); } /***********************************************************/ @@ -3482,15 +3474,12 @@ void qemu_bh_schedule(QEMUBH *bh) { - CPUState *env = cpu_single_env; if (bh->scheduled) return; bh->scheduled = 1; bh->idle = 0; /* stop the currently executing CPU to execute the BH ASAP */ - if (env) { - cpu_exit(env); - } + qemu_notify_event(); } void qemu_bh_cancel(QEMUBH *bh) @@ -3701,24 +3690,34 @@ } else { reset_requested = 1; } - if (cpu_single_env) - cpu_exit(cpu_single_env); + qemu_notify_event(); } void qemu_system_shutdown_request(void) { shutdown_requested = 1; - if (cpu_single_env) - cpu_exit(cpu_single_env); + qemu_notify_event(); } void qemu_system_powerdown_request(void) { powerdown_requested = 1; - if (cpu_single_env) - cpu_exit(cpu_single_env); + qemu_notify_event(); } +void qemu_notify_event(void) +{ + CPUState *env = cpu_single_env; + + if (env) { + cpu_exit(env); +#ifdef USE_KQEMU + if (env->kqemu_enabled) + kqemu_cpu_interrupt(env); +#endif + } +} + #ifdef _WIN32 static void host_main_loop_wait(int *timeout) {