Trait chipset_device::mmio::MmioIntercept
source · pub trait MmioIntercept: ChipsetDevice {
// Required methods
fn mmio_read(&mut self, addr: u64, data: &mut [u8]) -> IoResult;
fn mmio_write(&mut self, addr: u64, data: &[u8]) -> IoResult;
// Provided method
fn get_static_regions(&mut self) -> &[(&str, RangeInclusive<u64>)] { ... }
}
Expand description
Implemented by devices which use MMIO intercepts.
NOTE: Devices that wish to register objects (e.g: files, shared memory file
descriptors, etc…) into guest memory directly (thereby bypassing the need
for a MMIO intercepts) should obtain a reference to a
guestmem::MemoryMapper
object.
Required Methods§
sourcefn mmio_read(&mut self, addr: u64, data: &mut [u8]) -> IoResult
fn mmio_read(&mut self, addr: u64, data: &mut [u8]) -> IoResult
Dispatch an MMIO read to the device with the given address.
sourcefn mmio_write(&mut self, addr: u64, data: &[u8]) -> IoResult
fn mmio_write(&mut self, addr: u64, data: &[u8]) -> IoResult
Dispatch an MMIO write to the device with the given address.
Provided Methods§
sourcefn get_static_regions(&mut self) -> &[(&str, RangeInclusive<u64>)]
fn get_static_regions(&mut self) -> &[(&str, RangeInclusive<u64>)]
Report a set of static static mmio regions (region_name, gpa_range) that cannot be remapped at runtime and are always registered.
Note: This is a convenience method that makes it easy for simple
devices to declare some fixed IO regions without having to do through
the rigamarole of obtaining a reference to an instance of
RegisterMmioIntercept
+ manually registering fixed ranges as part of
device init.