[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [QEMU] Simpler workaround for guest writes to PCI config
# HG changeset patch # User kfraser@xxxxxxxxxxxxxxxxxxxxx # Node ID f66f7c3a82a7420d80714b0d349ee9a24b50ec28 # Parent ccc419cbe0bada0ae901e0d426dabce70a429876 [QEMU] Simpler workaround for guest writes to PCI config space that extend past byte 0xff. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- tools/ioemu/hw/pci.c | 24 ++++++++---------------- tools/ioemu/vl.h | 7 +++++-- 2 files changed, 13 insertions(+), 18 deletions(-) diff -r ccc419cbe0ba -r f66f7c3a82a7 tools/ioemu/hw/pci.c --- a/tools/ioemu/hw/pci.c Thu Nov 30 17:27:00 2006 +0000 +++ b/tools/ioemu/hw/pci.c Thu Nov 30 17:32:16 2006 +0000 @@ -221,23 +221,16 @@ uint32_t pci_default_read_config(PCIDevi uint32_t address, int len) { uint32_t val; - switch(len) { + case 1: + val = d->config[address]; + break; + case 2: + val = le16_to_cpu(*(uint16_t *)(d->config + address)); + break; default: case 4: - if (address <= 0xfc) { - val = le32_to_cpu(*(uint32_t *)(d->config + address)); - break; - } - /* fall through */ - case 2: - if (address <= 0xfe) { - val = le16_to_cpu(*(uint16_t *)(d->config + address)); - break; - } - /* fall through */ - case 1: - val = d->config[address]; + val = le32_to_cpu(*(uint32_t *)(d->config + address)); break; } return val; @@ -340,8 +333,7 @@ void pci_default_write_config(PCIDevice d->config[addr] = val; } - if (++addr > 0xff) - break; + addr++; val >>= 8; } diff -r ccc419cbe0ba -r f66f7c3a82a7 tools/ioemu/vl.h --- a/tools/ioemu/vl.h Thu Nov 30 17:27:00 2006 +0000 +++ b/tools/ioemu/vl.h Thu Nov 30 17:32:16 2006 +0000 @@ -650,8 +650,11 @@ typedef struct PCIIORegion { #define PCI_MAX_LAT 0x3f /* 8 bits */ struct PCIDevice { - /* PCI config space */ - uint8_t config[256]; + /* + * PCI config space. The 4 extra bytes are a safety buffer for guest + * word/dword writes that can extend past byte 0xff. + */ + uint8_t config[256+4]; /* the following fields are read only */ PCIBus *bus; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |