qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] isapc: Fix segfault during initialization


From: Jan Kiszka
Subject: [Qemu-devel] [PATCH] isapc: Fix segfault during initialization
Date: Sat, 14 Jan 2012 14:12:41 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

From: Jan Kiszka <address@hidden>

Linking the RTC device state to the PIIX does not belong into the
common path that is shared with the isapc. QEMU crashes otherwise.

Signed-off-by: Jan Kiszka <address@hidden>
---
 hw/pc_piix.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index b70431f..3aea3cc 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -201,6 +201,17 @@ static void pc_init1(MemoryRegion *system_memory,
         }
         idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
         idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
+
+        /* FIXME there's some major spaghetti here.  Somehow we create the
+         * devices on the PIIX before we actually create it.  We create the
+         * PIIX3 deep in the recess of the i440fx creation too and then lose
+         * the DeviceState.
+         *
+         * For now, let's "fix" this by making judicious use of paths.  This
+         * is not generally the right way to do this.
+         */
+        qdev_property_add_child(qdev_resolve_path("/i440fx/piix3", NULL),
+                                "rtc", (DeviceState *)rtc_state, NULL);
     } else {
         for(i = 0; i < MAX_IDE_BUS; i++) {
             ISADevice *dev;
@@ -211,17 +222,6 @@ static void pc_init1(MemoryRegion *system_memory,
         }
     }
 
-    /* FIXME there's some major spaghetti here.  Somehow we create the devices
-     * on the PIIX before we actually create it.  We create the PIIX3 deep in
-     * the recess of the i440fx creation too and then lose the DeviceState.
-     *
-     * For now, let's "fix" this by making judicious use of paths.  This is not
-     * generally the right way to do this.
-     */
-
-    qdev_property_add_child(qdev_resolve_path("/i440fx/piix3", NULL),
-                            "rtc", (DeviceState *)rtc_state, NULL);
-
     audio_init(isa_bus, pci_enabled ? pci_bus : NULL);
 
     pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
-- 
1.7.3.4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]