From 9d07fa2862e8d4d7733d9b6887ee5ffc2b2b892d Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Mon, 5 Apr 2021 17:34:49 +0300 Subject: [PATCH] Fix Prometheus word PCI config area writes. --- pci.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pci.cpp b/pci.cpp index c7605ae6..55e5fc58 100644 --- a/pci.cpp +++ b/pci.cpp @@ -445,9 +445,12 @@ static uae_u8 *get_pci_config(uaecptr addr, int size, uae_u32 v, int *endianswap c[off + 1] = pcibs->board->pci_get_config(off + 2); c[off + 0] = pcibs->board->pci_get_config(off + 3); } else if (size == 2 || size == -2) { - if (pcib->endian_swap_config) { - c[(off ^ (pcib->endian_swap_config > 0 ? 0 : 2)) + 0] = pcibs->board->pci_get_config(off + 0); - c[(off ^ (pcib->endian_swap_config > 0 ? 0 : 2)) + 1] = pcibs->board->pci_get_config(off + 1); + if (pcib->endian_swap_config < 0) { + c[(off ^ 2) + 0] = pcibs->board->pci_get_config(off + 0); + c[(off ^ 2) + 1] = pcibs->board->pci_get_config(off + 1); + } else if (pcib->endian_swap_config > 0) { + c[off + 0] = pcibs->board->pci_get_config(off + 0); + c[off + 1] = pcibs->board->pci_get_config(off + 1); } else { c[off + 1] = pcibs->board->pci_get_config((off ^ 2) + 0); c[off + 0] = pcibs->board->pci_get_config((off ^ 2) + 1); @@ -530,9 +533,12 @@ static void update_pci_config(uaecptr addr, int size) pcibs->board->pci_put_config(off + 1, d[off + 2]); pcibs->board->pci_put_config(off + 0, d[off + 3]); } else if (size == 2) { - if (pcib->endian_swap_config) { - pcibs->board->pci_put_config((off ^ (pcib->endian_swap_config > 0 ? 2 : 0)) + 1, d[off + 0]); - pcibs->board->pci_put_config((off ^ (pcib->endian_swap_config > 0 ? 2 : 0)) + 0, d[off + 1]); + if (pcib->endian_swap_config < 0) { + pcibs->board->pci_put_config((off ^ 2) + 0, d[off + 0]); + pcibs->board->pci_put_config((off ^ 2) + 1, d[off + 1]); + } else if (pcib->endian_swap_config > 0) { + pcibs->board->pci_put_config(off + 0, d[off + 0]); + pcibs->board->pci_put_config(off + 1, d[off + 1]); } else { pcibs->board->pci_put_config(off + 0, d[off + 0]); pcibs->board->pci_put_config(off + 1, d[off + 1]); -- 2.47.3