From 91011d4f3b7c311a42b842f6682ac64a2372d2b7 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 13 Nov 2009 23:26:27 +0100 Subject: [PATCH] pci: Fix function pci_default_write_config Change 260c0cd3d985e51b15870ff47e17b7b930efbda1 (pci: use range helper functions) introduced a bug which made pci cirrus vga on mips malta (and maybe other pci devices) fail. Don't change addr - its original value is needed by ranges_overlap() and range_covers(). Signed-off-by: Stefan Weil Acked-by: Ryan Harper Signed-off-by: Aurelien Jarno --- hw/pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index a326930..6864339 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -856,9 +856,9 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l) int i; uint32_t config_size = pci_config_size(d); - for(i = 0; i < l && addr < config_size; val >>= 8, ++i, ++addr) { - uint8_t wmask = d->wmask[addr]; - d->config[addr] = (d->config[addr] & ~wmask) | (val & wmask); + for (i = 0; i < l && addr + i < config_size; val >>= 8, ++i) { + uint8_t wmask = d->wmask[addr + i]; + d->config[addr + i] = (d->config[addr + i] & ~wmask) | (val & wmask); } if (ranges_overlap(addr, l, PCI_BASE_ADDRESS_0, 24) || ranges_overlap(addr, l, PCI_ROM_ADDRESS, 4) || -- 2.7.4