From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K9jQE-0005iz-DR for qemu-devel@nongnu.org; Fri, 20 Jun 2008 12:25:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K9jQC-0005i8-Bh for qemu-devel@nongnu.org; Fri, 20 Jun 2008 12:25:09 -0400 Received: from [199.232.76.173] (port=37689 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K9jQC-0005i5-8N for qemu-devel@nongnu.org; Fri, 20 Jun 2008 12:25:08 -0400 Received: from savannah.gnu.org ([199.232.41.3]:56403 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 1K9jQC-00068Z-3u for qemu-devel@nongnu.org; Fri, 20 Jun 2008 12:25:08 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1K9jQB-0002gA-8L for qemu-devel@nongnu.org; Fri, 20 Jun 2008 16:25:07 +0000 Received: from blueswir1 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1K9jQA-0002g0-RO for qemu-devel@nongnu.org; Fri, 20 Jun 2008 16:25:07 +0000 MIME-Version: 1.0 Errors-To: blueswir1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Blue Swirl Message-Id: Date: Fri, 20 Jun 2008 16:25:06 +0000 Subject: [Qemu-devel] [4763] Add an opaque parameter to boot_set API, move function to monitor.c 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 Revision: 4763 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4763 Author: blueswir1 Date: 2008-06-20 16:25:06 +0000 (Fri, 20 Jun 2008) Log Message: ----------- Add an opaque parameter to boot_set API, move function to monitor.c Modified Paths: -------------- trunk/hw/hw.h trunk/hw/pc.c trunk/monitor.c trunk/vl.c Modified: trunk/hw/hw.h =================================================================== --- trunk/hw/hw.h 2008-06-20 15:29:38 UTC (rev 4762) +++ trunk/hw/hw.h 2008-06-20 16:25:06 UTC (rev 4763) @@ -94,9 +94,8 @@ /* handler to set the boot_device for a specific type of QEMUMachine */ /* return 0 if success */ -typedef int QEMUBootSetHandler(const char *boot_device); -extern QEMUBootSetHandler *qemu_boot_set_handler; -void qemu_register_boot_set(QEMUBootSetHandler *func); +typedef int QEMUBootSetHandler(void *opaque, const char *boot_device); +void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque); /* These should really be in isa.h, but are here to make pc.h happy. */ typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data); Modified: trunk/hw/pc.c =================================================================== --- trunk/hw/pc.c 2008-06-20 15:29:38 UTC (rev 4762) +++ trunk/hw/pc.c 2008-06-20 16:25:06 UTC (rev 4763) @@ -192,10 +192,10 @@ /* copy/pasted from cmos_init, should be made a general function and used there as well */ -int pc_boot_set(const char *boot_device) +static int pc_boot_set(void *opaque, const char *boot_device) { #define PC_MAX_BOOT_DEVICES 3 - RTCState *s = rtc_state; + RTCState *s = (RTCState *)opaque; int nbds, bds[3] = { 0, }; int i; @@ -741,8 +741,6 @@ below_4g_mem_size = ram_size; } - qemu_register_boot_set(pc_boot_set); - linux_boot = (kernel_filename != NULL); /* init CPUs */ @@ -917,6 +915,8 @@ rtc_state = rtc_init(0x70, i8259[8]); + qemu_register_boot_set(pc_boot_set, rtc_state); + register_ioport_read(0x92, 1, 1, ioport92_read, NULL); register_ioport_write(0x92, 1, 1, ioport92_write, NULL); Modified: trunk/monitor.c =================================================================== --- trunk/monitor.c 2008-06-20 15:29:38 UTC (rev 4762) +++ trunk/monitor.c 2008-06-20 16:25:06 UTC (rev 4763) @@ -1044,12 +1044,22 @@ suffix, addr, size * 2, val); } +/* boot_set handler */ +static QEMUBootSetHandler *qemu_boot_set_handler = NULL; +static void *boot_opaque; + +void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque) +{ + qemu_boot_set_handler = func; + boot_opaque = opaque; +} + static void do_boot_set(const char *bootdevice) { int res; if (qemu_boot_set_handler) { - res = qemu_boot_set_handler(bootdevice); + res = qemu_boot_set_handler(boot_opaque, bootdevice); if (res == 0) term_printf("boot device list now set to %s\n", bootdevice); else Modified: trunk/vl.c =================================================================== --- trunk/vl.c 2008-06-20 15:29:38 UTC (rev 4762) +++ trunk/vl.c 2008-06-20 16:25:06 UTC (rev 4763) @@ -6908,14 +6908,6 @@ cpu_interrupt(cpu_single_env, CPU_INTERRUPT_EXIT); } -/* boot_set handler */ -QEMUBootSetHandler *qemu_boot_set_handler = NULL; - -void qemu_register_boot_set(QEMUBootSetHandler *func) -{ - qemu_boot_set_handler = func; -} - void main_loop_wait(int timeout) { IOHandlerRecord *ioh;