summary refs log tree commit diff stats
path: root/hw/r2d.c
diff options
context:
space:
mode:
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-03 06:23:17 +0000
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-03 06:23:17 +0000
commitab2da564d7f8f2a0e4e31875e1cdf87db14500e2 (patch)
treeee9eea71e3793eaa23f2ead27a552d936a7c6d51 /hw/r2d.c
parent45f4d016be0a40af247faa2de26fa775882cb5eb (diff)
downloadfocaccia-qemu-ab2da564d7f8f2a0e4e31875e1cdf87db14500e2.tar.gz
focaccia-qemu-ab2da564d7f8f2a0e4e31875e1cdf87db14500e2.zip
sh4: r2d fix no ide/net case
Fix invalid access/crash when there is no IDE device or NET device.

Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp>
Tested-by: Shin-ichiro KAWASAKI <kawasaki@juno.dti.ne.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6673 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/r2d.c')
-rw-r--r--hw/r2d.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/r2d.c b/hw/r2d.c
index e6b2bf41fe..713fc53b7e 100644
--- a/hw/r2d.c
+++ b/hw/r2d.c
@@ -224,13 +224,13 @@ static void r2d_init(ram_addr_t ram_size, int vga_ram_size,
 	       serial_hds[2]);
 
     /* onboard CF (True IDE mode, Master only). */
-    mmio_ide_init(0x14001000, 0x1400080c, irq[CF_IDE], 1,
-        drives_table[drive_get_index(IF_IDE, 0, 0)].bdrv, NULL);
+    if ((i = drive_get_index(IF_IDE, 0, 0)) != -1)
+	mmio_ide_init(0x14001000, 0x1400080c, irq[CF_IDE], 1,
+		      drives_table[i].bdrv, NULL);
 
     /* NIC: rtl8139 on-board, and 2 slots. */
-    pci_nic_init(pci, &nd_table[0], 2 << 3, "rtl8139");
-    for (i = 1; i < nb_nics; i++)
-        pci_nic_init(pci, &nd_table[i], -1, "ne2k_pci");
+    for (i = 0; i < nb_nics; i++)
+        pci_nic_init(pci, &nd_table[i], (i==0)? 2<<3: -1, "rtl8139");
 
     /* Todo: register on board registers */
     {