aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-06-20 16:25:06 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-06-20 16:25:06 +0000
commit3b4366de399b384d715c631d32f024c2bde3a38a (patch)
tree7d06569d95945d6cea73503360fd30188677a5c5
parent3f05d3dc14a76fb62a1eda5c53dde0074ce1d1e1 (diff)
Add an opaque parameter to boot_set API, move function to monitor.c
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4763 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--hw/hw.h5
-rw-r--r--hw/pc.c8
-rw-r--r--monitor.c12
-rw-r--r--vl.c8
4 files changed, 17 insertions, 16 deletions
diff --git a/hw/hw.h b/hw/hw.h
index 2a461026e1..b84ace07fc 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -94,9 +94,8 @@ void qemu_register_reset(QEMUResetHandler *func, void *opaque);
/* 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);
diff --git a/hw/pc.c b/hw/pc.c
index 3edeb502c7..4c5e1c3437 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -192,10 +192,10 @@ static int boot_device2nibble(char boot_device)
/* 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 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
below_4g_mem_size = ram_size;
}
- qemu_register_boot_set(pc_boot_set);
-
linux_boot = (kernel_filename != NULL);
/* init CPUs */
@@ -917,6 +915,8 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
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);
diff --git a/monitor.c b/monitor.c
index 9f1013ecfd..8154898673 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1044,12 +1044,22 @@ static void do_ioport_read(int count, int format, int size, int addr, int has_in
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
diff --git a/vl.c b/vl.c
index 37301b02fd..908aa39223 100644
--- a/vl.c
+++ b/vl.c
@@ -6908,14 +6908,6 @@ void qemu_system_powerdown_request(void)
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;