aboutsummaryrefslogtreecommitdiff
path: root/hw/pci_host.h
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-07-22 11:05:01 +0200
committerMichael S. Tsirkin <mst@redhat.com>2011-07-27 10:57:22 +0300
commit42e4126b793d15ec40f3a84017e1d8afecda1b6d (patch)
treecad2ca961f45dbfca771a370cf8fd95c47cd09ba /hw/pci_host.h
parent85dde9a90b9d26273ef531d344b2cdfee9a6683d (diff)
downloadqemu-42e4126b793d15ec40f3a84017e1d8afecda1b6d.zip
qemu-42e4126b793d15ec40f3a84017e1d8afecda1b6d.tar.gz
qemu-42e4126b793d15ec40f3a84017e1d8afecda1b6d.tar.bz2
pci: Common overflow prevention
Introduce pci_config_read/write_common helpers to prevent passing accesses down the callback chain that go beyond the config space limits. Adjust length assertions as they are no longer correct (cutting may generate valid 3 byte accesses). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pci_host.h')
-rw-r--r--hw/pci_host.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/pci_host.h b/hw/pci_host.h
index 0a58595..c8390ee 100644
--- a/hw/pci_host.h
+++ b/hw/pci_host.h
@@ -39,6 +39,12 @@ struct PCIHostState {
PCIBus *bus;
};
+/* common internal helpers for PCI/PCIe hosts, cut off overflows */
+void pci_host_config_write_common(PCIDevice *pci_dev, uint32_t addr,
+ uint32_t limit, uint32_t val, uint32_t len);
+uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
+ uint32_t limit, uint32_t len);
+
void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len);
uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len);