Expand description
Traits to track and access the physical memory of the guest.
To make the abstraction as generic as possible, all the core traits declared here only define methods to access guest’s memory, and never define methods to manage (create, delete, insert, remove etc) guest’s memory. This way, the guest memory consumers (virtio device drivers, vhost drivers and boot loaders etc) may be decoupled from the guest memory provider (typically a hypervisor).
Traits and Structs
GuestAddress: represents a guest physical address (GPA).MemoryRegionAddress: represents an offset inside a region.GuestMemoryRegion: represent a continuous region of guest’s physical memory.GuestMemoryBackend: represent a collection ofGuestMemoryRegionobjects. The main responsibilities of theGuestMemoryBackendtrait are:- hide the detail of accessing guest’s physical address.
- map a request address to a
GuestMemoryRegionobject and relay the request to it. - handle cases where an access request spanning two or more
GuestMemoryRegionobjects.
Whenever a collection of GuestMemoryRegion objects is mutable,
GuestAddressSpace should be implemented
for clients to obtain a GuestMemoryBackend reference or smart pointer.
The GuestMemoryRegion trait has an associated B: Bitmap type which is used to handle
dirty bitmap tracking. Backends are free to define the granularity (or whether tracking is
actually performed at all). Those that do implement tracking functionality are expected to
ensure the correctness of the underlying Bytes implementation. The user has to explicitly
record (using the handle returned by GuestRegionMmap::bitmap) write accesses performed
via pointers, references, or slices returned by methods of GuestMemoryBackend,GuestMemoryRegion,
VolatileSlice, VolatileRef, or VolatileArrayRef.
Structs§
- File
Offset - Represents the start point within a
Filethat backs aGuestMemoryRegion. - Guest
Address - Represents a guest physical address (GPA).
- Guest
Memory Backend Slice Iterator - Iterates over
VolatileSlices that together form a guest memory area. - Memory
Region Address - Represents an offset inside a region.
Enums§
- Error
- Errors associated with handling guest memory accesses.
- Permissions
- Permissions for accessing virtual memory.
Traits§
- Guest
Address Space GuestAddressSpaceprovides a way to retrieve aGuestMemoryBackendobject. The vm-memory crate already provides trivial implementation for references toGuestMemoryBackendor reference-countedGuestMemoryBackendobjects, but the trait can also be implemented by any other struct in order to provide temporary access to a snapshot of the memory map.- Guest
Memory - Represents virtual I/O memory.
- Guest
Memory Backend GuestMemoryBackendrepresents a container for an immutable collection ofGuestMemoryRegionobjects.GuestMemoryBackendprovides theBytes<GuestAddress>trait to hide the details of accessing guest memory by physical address. Interior mutability is not allowed for implementations ofGuestMemoryBackendso that they always provide a consistent view of the memory map.- Guest
Memory Slice Iterator - Iterates over
VolatileSlices that together form an I/O memory area.
Type Aliases§
- Guest
Usize - Type of the raw value stored in a
GuestAddressobject. - Result
- Result of guest memory operations.