summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bhyve
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2013-08-27 16:50:48 +0000
committerneel <neel@FreeBSD.org>2013-08-27 16:50:48 +0000
commit236964c12d6e45e32a2c5c66673acc605ed2e73e (patch)
treebef637b19b86c36f41997f48338b2ebffaa55666 /usr.sbin/bhyve
parent99ab2bf08eb4c6c6bab630a6a655ca024838e010 (diff)
downloadFreeBSD-src-236964c12d6e45e32a2c5c66673acc605ed2e73e.zip
FreeBSD-src-236964c12d6e45e32a2c5c66673acc605ed2e73e.tar.gz
Allow single byte reads of the emulated MSI-X tables. This is not required
by the PCI specification but needed to dump MMIO space from "ddb" in the guest.
Diffstat (limited to 'usr.sbin/bhyve')
-rw-r--r--usr.sbin/bhyve/pci_emul.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c
index 005e8b1..626dfdf 100644
--- a/usr.sbin/bhyve/pci_emul.c
+++ b/usr.sbin/bhyve/pci_emul.c
@@ -245,8 +245,12 @@ pci_emul_msix_tread(struct pci_devinst *pi, uint64_t offset, int size)
int tab_index;
uint64_t retval = ~0;
- /* support only 4 or 8 byte reads */
- if (size != 4 && size != 8)
+ /*
+ * The PCI standard only allows 4 and 8 byte accesses to the MSI-X
+ * table but we also allow 1 byte access to accomodate reads from
+ * ddb.
+ */
+ if (size != 1 && size != 4 && size != 8)
return (retval);
msix_entry_offset = offset % MSIX_TABLE_ENTRY_SIZE;
@@ -263,7 +267,9 @@ pci_emul_msix_tread(struct pci_devinst *pi, uint64_t offset, int size)
dest = (char *)(pi->pi_msix.table + tab_index);
dest += msix_entry_offset;
- if (size == 4)
+ if (size == 1)
+ retval = *((uint8_t *)dest);
+ else if (size == 4)
retval = *((uint32_t *)dest);
else
retval = *((uint64_t *)dest);
OpenPOWER on IntegriCloud