Module virtio_device::mem

source ·
Expand description

Structures for talking about memory shared between virtio devices and drivers

Drivers, located in the guest, and devices, located in the host, operate with shared memory, but may use different addresses to access it. All addresses published into the virtio data structures are published by the driver and so refer to memory addresses as understood by the driver.

It is the responsibility of the host to know how to turn an address published by the driver, a DriverRange, into memory that can be ultimately be dereferenced and read/written to by this device code, i.e. a DeviceRange. The DriverMem trait defines an interface for performing this translation, although it is the responsibility of the application code to provide and pass in implementations of this trait.

DeviceRange is intended to describe valid ranges of memory that can be turned into pointers through try_ptr and try_mut_ptr to actually read and write.

Structs§

  • Represents a range of memory as seen from the device.
  • Represents a range of memory as seen from the driver.

Traits§