Expand description
Traits for allocating, handling and interacting with the VM’s physical memory.
For a typical hypervisor, there are several components, such as boot loader, virtual device drivers, virtio backend drivers and vhost drivers etc, that need to access VM’s physical memory. This crate aims to provide a set of stable traits to decouple VM memory consumers from VM memory providers. Based on these traits, VM memory consumers could access VM’s physical memory without knowing the implementation details of the VM memory provider. Thus hypervisor components, such as boot loader, virtual device drivers, virtio backend drivers and vhost drivers etc, could be shared and reused by multiple hypervisors.
Modules§
- address
- Traits to represent an address within an address space.
- atomic
backend-atomic - A wrapper over an
ArcSwap<GuestMemory>struct to support RCU-style mutability. - bitmap
- This module holds abstractions that enable tracking the areas dirtied by writes of a specified
length to a given offset. In particular, this is used to track write accesses within a
GuestMemoryRegionobject, and the resulting bitmaps can then be aggregated to build the global view for an entireGuestMemoryobject. - bytes
- Define the
ByteValuedtrait to mark that it is safe to instantiate the struct with random data. - endian
- Explicit endian types useful for embedding in structs or reinterpreting data.
- guest_
memory - Traits to track and access the physical memory of the guest.
- io
- Module containing versions of the standard library’s
ReadandWritetraits compatible with volatile memory accesses. - mmap
backend-mmap - The default implementation for the
GuestMemorytrait. - region
- Module containing abstracts for dealing with contiguous regions of guest memory
- volatile_
memory - Types for volatile access to memory.
Structs§
- Be16
- An unsigned integer type of with an explicit endianness.
- Be32
- An unsigned integer type of with an explicit endianness.
- Be64
- An unsigned integer type of with an explicit endianness.
- BeSize
- An unsigned integer type of with an explicit endianness.
- File
Offset - Represents the start point within a
Filethat backs aGuestMemoryRegion. - Guest
Address - Represents a guest physical address (GPA).
- Guest
Memory Atomic backend-atomic - A fast implementation of a mutable collection of memory regions.
- Guest
Memory Load Guard backend-atomic - A guard that provides temporary access to a
GuestMemoryAtomic. This object is returned from thememory()method. It dereference to a snapshot of theGuestMemory, so it can be used transparently to access memory. - Guest
Region Collection GuestMemoryBackendimplementation based on a homogeneous collection ofGuestMemoryRegionimplementations.- Guest
Region Mmap backend-mmap GuestMemoryRegionimplementation that mmaps the guest’s memory region in the current process.- Le16
- An unsigned integer type of with an explicit endianness.
- Le32
- An unsigned integer type of with an explicit endianness.
- Le64
- An unsigned integer type of with an explicit endianness.
- LeSize
- An unsigned integer type of with an explicit endianness.
- Memory
Region Address - Represents an offset inside a region.
- Mmap
Range backend-mmapandxenandtarget_family=unix MmapRangerepresents a range of arguments required to create Mmap regions.- Mmap
Region backend-mmap - Helper structure for working with mmaped memory regions with Xen.
- Mmap
XenFlags backend-mmapandxenandtarget_family=unix - Flags for the Xen mmap message.
- Volatile
Array Ref - A memory location that supports volatile access to an array of elements of type
T. - Volatile
Ref - A memory location that supports volatile access to an instance of
T. - Volatile
Slice - A slice of raw memory that supports volatile access.
Enums§
- Guest
Memory Error - Errors associated with handling guest memory accesses.
- Guest
Region Collection Error - Errors that can occur when dealing with
GuestRegionCollections - Volatile
Memory Error VolatileMemoryrelated errors.
Traits§
- Address
- Simple helper trait used to store a raw address value. Trait to represent an address within an address space.
- Address
Value - Simple helper trait used to store a raw address value. Simple helper trait used to store a raw address value.
- Atomic
Access - A trait used to identify types which can be accessed atomically by proxy.
- Atomic
Integer - Safety
- Byte
Valued - Types for which it is safe to initialize from raw data.
- Bytes
- A container to host a range of bytes and access its content.
- 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 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 Region - Represents a continuous region of guest physical memory.
- Guest
Memory Region Bytes - A marker trait that if implemented on a type
Rmakes available a default implementation ofBytes<MemoryRegionAddress>forR, based on the assumption that the entireGuestMemoryRegionis just traditional memory without any special access requirements. - Read
Volatile - A version of the standard library’s
Readtrait that operates on volatile memory instead of slices - Volatile
Memory - Types that support raw volatile access to their data.
- Write
Volatile - A version of the standard library’s
Writetrait that operates on volatile memory instead of slices.
Type Aliases§
- Guest
Memory Mmap backend-mmap GuestMemoryBackendimplementation that mmaps the guest’s memory in the current process.- Guest
Memory Result - Result of guest memory operations.
- Guest
Usize - Type of the raw value stored in a
GuestAddressobject. - Volatile
Memory Result - Result of volatile memory operations.