RTL8029AS: Do not call isapnp_set_normal() in nic_config_reset() on this card, fixes segmentation fault.

This commit is contained in:
OBattler
2025-09-26 01:14:07 +02:00
parent e7645e5c39
commit 5ac9d65a8b

View File

@@ -92,11 +92,12 @@ typedef struct nic_t {
uint8_t csnsav;
/* RTL8019AS/RTL8029AS registers */
uint8_t _9346cr;
uint8_t config0;
uint8_t config1;
uint8_t config2;
uint8_t config3;
uint8_t _9346cr;
uint8_t res;
uint8_t pci_regs[PCI_REGSIZE];
@@ -176,13 +177,15 @@ static void
nic_config_reset(void *priv)
{
nic_t *dev = (nic_t *) priv;
uint8_t *data = (uint8_t *) nmc93cxx_eeprom_data(dev->eeprom);
dev->config1 = (data[0x00] & 0x7f) | 0x80;
dev->config2 = (data[0x01] & 0xdf);
dev->config3 = (data[0x02] & 0xf7);
isapnp_set_normal(dev->pnp_card, !!(dev->config3 & 0x80));
if (dev->pnp_card != NULL)
isapnp_set_normal(dev->pnp_card, !!(dev->config3 & 0x80));
}
/* reset - restore state to power-up, cancelling all i/o */
@@ -384,10 +387,20 @@ page3_read(nic_t *dev, uint32_t off, UNUSED(unsigned int len))
ret = (dev->config3 & 0x46);
break;
case 0x7: /* Reserved, Do not write */
if (dev->board == NE2K_RTL8019AS_PNP)
ret = dev->res;
break;
case 0x8: /* CSNSAV */
ret = ((dev->board == NE2K_RTL8019AS_PNP) ? *dev->pnp_csnsav : 0x00);
break;
case 0x9: case 0xa:
case 0xc:
ret = 0xff;
break;
case 0xb: /* INTR */
if (dev->board == NE2K_RTL8019AS_PNP) {
ret = (pic2.irr & 0x02) ? 0x01 : 0x00;
@@ -411,11 +424,15 @@ page3_read(nic_t *dev, uint32_t off, UNUSED(unsigned int len))
case 0xe: /* 8029ASID0 */
if (dev->board == NE2K_RTL8029AS)
ret = 0x29;
else
ret = 0xff;
break;
case 0xf: /* 8029ASID1 */
if (dev->board == NE2K_RTL8029AS)
ret = 0x80;
else
ret = 0xff;
break;
}
@@ -477,6 +494,11 @@ page3_write(nic_t *dev, uint32_t off, uint32_t val, UNUSED(unsigned len))
}
break;
case 0x7: /* Reserved, Do not write */
if (dev->board == NE2K_RTL8019AS_PNP)
dev->res = val;
break;
case 0x09: /* HLTCLK */
break;