Skip to content

Commit 6c6f631

Browse files
committed
[feat] intercept access to PCI config space (0xcf8-0xcff) for guest VMs
1 parent fa2b35c commit 6c6f631

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/vmx/vcpu.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,13 @@ impl<H: AxVCpuHal> VmxVcpu<H> {
770770

771771
self.setup_io_bitmap()?;
772772

773+
if is_guest {
774+
// Intercept access to PCI config space (0xcf8-0xcff) for guest VMs.
775+
const PCI_RANGE: core::ops::Range<u32> = 0xcf8..0xcff;
776+
self.io_bitmap
777+
.set_intercept_of_range(PCI_RANGE.start, PCI_RANGE.count() as u32, true);
778+
}
779+
773780
VmcsControl32::EXCEPTION_BITMAP.write(exception_bitmap)?;
774781
VmcsControl64::IO_BITMAP_A_ADDR.write(self.io_bitmap.phys_addr().0.as_usize() as _)?;
775782
VmcsControl64::IO_BITMAP_B_ADDR.write(self.io_bitmap.phys_addr().1.as_usize() as _)?;

0 commit comments

Comments
 (0)