From 0483b8ceecfcc5d863406732df6c2f9e974f327e Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 29 Jan 2024 11:07:11 +0100 Subject: [PATCH 1/4] FDC37C669: Fix a wrong condition causing segmentation faults. --- src/sio/sio_fdc37c669.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sio/sio_fdc37c669.c b/src/sio/sio_fdc37c669.c index cb678427c..0cd686991 100644 --- a/src/sio/sio_fdc37c669.c +++ b/src/sio/sio_fdc37c669.c @@ -305,7 +305,7 @@ fdc37c669_reset(void *priv) dev->regs[0x21] = 0x3c; dev->regs[0x22] = 0x3d; - if (dev->id == 1) { + if (dev->id != 1) { fdc_reset(dev->fdc); fdc37c669_fdc_handler(dev); } From c95a0ac599524f756eeaa95e62e82eb0db082084 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Mon, 29 Jan 2024 16:23:23 +0600 Subject: [PATCH 2/4] Update vid_c&t_69000.c --- src/video/vid_c&t_69000.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/video/vid_c&t_69000.c b/src/video/vid_c&t_69000.c index fe22985e0..4856aff33 100644 --- a/src/video/vid_c&t_69000.c +++ b/src/video/vid_c&t_69000.c @@ -42,6 +42,7 @@ typedef struct chips_69000_t { uint8_t pci_line_interrupt; uint8_t pci_rom_enable; uint8_t read_write_bank; + uint8_t slot; atomic_bool engine_active; atomic_bool quit; thread_t *accel_thread; @@ -1193,7 +1194,7 @@ uint16_t chips_69000_readw_linear(uint32_t addr, void *p) { svga_t *svga = (svga_t *) p; - chips_69000_t *chips = (chips_69000_t *) svga->p; + chips_69000_t *chips = (chips_69000_t *) svga->priv; if (addr & 0x400000) return chips_69000_readw_mmio(addr, chips); @@ -1205,7 +1206,7 @@ uint32_t chips_69000_readl_linear(uint32_t addr, void *p) { svga_t *svga = (svga_t *) p; - chips_69000_t *chips = (chips_69000_t *) svga->p; + chips_69000_t *chips = (chips_69000_t *) svga->priv; if (addr & 0x400000) return chips_69000_readl_mmio(addr, chips); @@ -1217,7 +1218,7 @@ void chips_69000_writeb_linear(uint32_t addr, uint8_t val, void *p) { svga_t *svga = (svga_t *) p; - chips_69000_t *chips = (chips_69000_t *) svga->p; + chips_69000_t *chips = (chips_69000_t *) svga->priv; if (addr & 0x400000) return chips_69000_writeb_mmio(addr, val, chips); @@ -1229,7 +1230,7 @@ void chips_69000_writew_linear(uint32_t addr, uint16_t val, void *p) { svga_t *svga = (svga_t *) p; - chips_69000_t *chips = (chips_69000_t *) svga->p; + chips_69000_t *chips = (chips_69000_t *) svga->priv; if (addr & 0x400000) return chips_69000_writew_mmio(addr, val, chips); @@ -1241,7 +1242,7 @@ void chips_69000_writel_linear(uint32_t addr, uint32_t val, void *p) { svga_t *svga = (svga_t *) p; - chips_69000_t *chips = (chips_69000_t *) svga->p; + chips_69000_t *chips = (chips_69000_t *) svga->priv; if (addr & 0x400000) return chips_69000_writel_mmio(addr, val, chips); @@ -1271,7 +1272,7 @@ chips_69000_init(const device_t *info) io_sethandler(0x03c0, 0x0020, chips_69000_in, NULL, NULL, chips_69000_out, NULL, NULL, chips); - pci_add_card(PCI_ADD_VIDEO, chips_69000_pci_read, chips_69000_pci_write, chips); + pci_add_card(PCI_ADD_VIDEO, chips_69000_pci_read, chips_69000_pci_write, chips, &chips->slot); chips->svga.bpp = 8; chips->svga.miscout = 1; From 8724f30320b1b09e32a3ab317126e0cf0ad73e9f Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Mon, 29 Jan 2024 16:31:35 +0600 Subject: [PATCH 3/4] Update vid_c&t_69000.c --- src/video/vid_c&t_69000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/vid_c&t_69000.c b/src/video/vid_c&t_69000.c index 4856aff33..c994e8e54 100644 --- a/src/video/vid_c&t_69000.c +++ b/src/video/vid_c&t_69000.c @@ -1182,7 +1182,7 @@ uint8_t chips_69000_readb_linear(uint32_t addr, void *p) { svga_t *svga = (svga_t *) p; - chips_69000_t *chips = (chips_69000_t *) svga->p; + chips_69000_t *chips = (chips_69000_t *) svga->priv; if (addr & 0x400000) return chips_69000_readb_mmio(addr, chips); @@ -1268,7 +1268,7 @@ chips_69000_init(const device_t *info) NULL, chips_69000_in, chips_69000_out, NULL, - NULL); + chips_69000_recalctimings); io_sethandler(0x03c0, 0x0020, chips_69000_in, NULL, NULL, chips_69000_out, NULL, NULL, chips); From f313e420d3887db891009cd3121668fd996d30b7 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Mon, 29 Jan 2024 16:35:10 +0600 Subject: [PATCH 4/4] Ok fixed for real --- src/video/vid_c&t_69000.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/video/vid_c&t_69000.c b/src/video/vid_c&t_69000.c index c994e8e54..a06246538 100644 --- a/src/video/vid_c&t_69000.c +++ b/src/video/vid_c&t_69000.c @@ -544,7 +544,7 @@ chips_69000_do_rop_24bpp_patterned(uint32_t *dst, uint32_t src, uint8_t nonpatte void chips_69000_recalctimings(svga_t *svga) { - chips_69000_t *chips = (chips_69000_t *) svga->p; + chips_69000_t *chips = (chips_69000_t *) svga->priv; if (chips->ext_regs[0x81] & 0x10) { svga->htotal -= 5; @@ -1265,10 +1265,10 @@ chips_69000_init(const device_t *info) video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_sis); svga_init(info, &chips->svga, chips, 1 << 21, /*2048kb*/ - NULL, + chips_69000_recalctimings, chips_69000_in, chips_69000_out, NULL, - chips_69000_recalctimings); + NULL); io_sethandler(0x03c0, 0x0020, chips_69000_in, NULL, NULL, chips_69000_out, NULL, NULL, chips);