Commit 4856fcff8af1ba349baaf063af00f5e5d87a99f4

Authored by Paul Brook
1 parent 52368552

Fix lance segfaults

Signed-off-by: Paul Brook <paul@codesourcery.com>
Showing 1 changed file with 6 additions and 3 deletions
hw/pcnet.c
@@ -2068,25 +2068,28 @@ static void pci_pcnet_init(PCIDevice *pci_dev) @@ -2068,25 +2068,28 @@ static void pci_pcnet_init(PCIDevice *pci_dev)
2068 2068
2069 static void parent_lance_reset(void *opaque, int irq, int level) 2069 static void parent_lance_reset(void *opaque, int irq, int level)
2070 { 2070 {
  2071 + SysBusPCNetState *d = opaque;
2071 if (level) 2072 if (level)
2072 - pcnet_h_reset(opaque); 2073 + pcnet_h_reset(&d->state);
2073 } 2074 }
2074 2075
2075 static void lance_mem_writew(void *opaque, target_phys_addr_t addr, 2076 static void lance_mem_writew(void *opaque, target_phys_addr_t addr,
2076 uint32_t val) 2077 uint32_t val)
2077 { 2078 {
  2079 + SysBusPCNetState *d = opaque;
2078 #ifdef PCNET_DEBUG_IO 2080 #ifdef PCNET_DEBUG_IO
2079 printf("lance_mem_writew addr=" TARGET_FMT_plx " val=0x%04x\n", addr, 2081 printf("lance_mem_writew addr=" TARGET_FMT_plx " val=0x%04x\n", addr,
2080 val & 0xffff); 2082 val & 0xffff);
2081 #endif 2083 #endif
2082 - pcnet_ioport_writew(opaque, addr, val & 0xffff); 2084 + pcnet_ioport_writew(&d->state, addr, val & 0xffff);
2083 } 2085 }
2084 2086
2085 static uint32_t lance_mem_readw(void *opaque, target_phys_addr_t addr) 2087 static uint32_t lance_mem_readw(void *opaque, target_phys_addr_t addr)
2086 { 2088 {
  2089 + SysBusPCNetState *d = opaque;
2087 uint32_t val; 2090 uint32_t val;
2088 2091
2089 - val = pcnet_ioport_readw(opaque, addr); 2092 + val = pcnet_ioport_readw(&d->state, addr);
2090 #ifdef PCNET_DEBUG_IO 2093 #ifdef PCNET_DEBUG_IO
2091 printf("lance_mem_readw addr=" TARGET_FMT_plx " val = 0x%04x\n", addr, 2094 printf("lance_mem_readw addr=" TARGET_FMT_plx " val = 0x%04x\n", addr,
2092 val & 0xffff); 2095 val & 0xffff);