[6673] sh4: r2d fix no ide/net case
Revision: 6673
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6673 Author: aurel32 Date: 2009-03-03 06:23:17 +0000 (Tue, 03 Mar 2009)
Log Message:
-----------
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 <[email protected]>
Tested-by Shin-ichiro KAWASAKI <[email protected]>
Signed-off-by Aurelien Jarno <[email protected]>
Modified Paths:
--------------
trunk/hw/r2d.c
Modified: trunk/hw/r2d.c
===================================================================
hw/r2d.c +5 -5
@@ -224,13 +224,13 @@ 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 */ {