Crate vm_memory

Crate vm_memory 

Source
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.
atomicbackend-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 GuestMemoryRegion object, and the resulting bitmaps can then be aggregated to build the global view for an entire GuestMemory object.
bytes
Define the ByteValued trait 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 Read and Write traits compatible with volatile memory accesses.
mmapbackend-mmap
The default implementation for the GuestMemory trait.
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.
FileOffset
Represents the start point within a File that backs a GuestMemoryRegion.
GuestAddress
Represents a guest physical address (GPA).
GuestMemoryAtomicbackend-atomic
A fast implementation of a mutable collection of memory regions.
GuestMemoryLoadGuardbackend-atomic
A guard that provides temporary access to a GuestMemoryAtomic. This object is returned from the memory() method. It dereference to a snapshot of the GuestMemory, so it can be used transparently to access memory.
GuestRegionCollection
GuestMemoryBackend implementation based on a homogeneous collection of GuestMemoryRegion implementations.
GuestRegionMmapbackend-mmap
GuestMemoryRegion implementation 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.
MemoryRegionAddress
Represents an offset inside a region.
MmapRangebackend-mmap and xen and target_family=unix
MmapRange represents a range of arguments required to create Mmap regions.
MmapRegionbackend-mmap
Helper structure for working with mmaped memory regions with Xen.
MmapXenFlagsbackend-mmap and xen and target_family=unix
Flags for the Xen mmap message.
VolatileArrayRef
A memory location that supports volatile access to an array of elements of type T.
VolatileRef
A memory location that supports volatile access to an instance of T.
VolatileSlice
A slice of raw memory that supports volatile access.

Enums§

GuestMemoryError
Errors associated with handling guest memory accesses.
GuestRegionCollectionError
Errors that can occur when dealing with GuestRegionCollections
VolatileMemoryError
VolatileMemory related errors.

Traits§

Address
Simple helper trait used to store a raw address value. Trait to represent an address within an address space.
AddressValue
Simple helper trait used to store a raw address value. Simple helper trait used to store a raw address value.
AtomicAccess
A trait used to identify types which can be accessed atomically by proxy.
AtomicInteger
Safety
ByteValued
Types for which it is safe to initialize from raw data.
Bytes
A container to host a range of bytes and access its content.
GuestAddressSpace
GuestAddressSpace provides a way to retrieve a GuestMemoryBackend object. The vm-memory crate already provides trivial implementation for references to GuestMemoryBackend or reference-counted GuestMemoryBackend objects, but the trait can also be implemented by any other struct in order to provide temporary access to a snapshot of the memory map.
GuestMemory
GuestMemoryBackend represents a container for an immutable collection of GuestMemoryRegion objects. GuestMemoryBackend provides the Bytes<GuestAddress> trait to hide the details of accessing guest memory by physical address. Interior mutability is not allowed for implementations of GuestMemoryBackend so that they always provide a consistent view of the memory map.
GuestMemoryRegion
Represents a continuous region of guest physical memory.
GuestMemoryRegionBytes
A marker trait that if implemented on a type R makes available a default implementation of Bytes<MemoryRegionAddress> for R, based on the assumption that the entire GuestMemoryRegion is just traditional memory without any special access requirements.
ReadVolatile
A version of the standard library’s Read trait that operates on volatile memory instead of slices
VolatileMemory
Types that support raw volatile access to their data.
WriteVolatile
A version of the standard library’s Write trait that operates on volatile memory instead of slices.

Type Aliases§

GuestMemoryMmapbackend-mmap
GuestMemoryBackend implementation that mmaps the guest’s memory in the current process.
GuestMemoryResult
Result of guest memory operations.
GuestUsize
Type of the raw value stored in a GuestAddress object.
VolatileMemoryResult
Result of volatile memory operations.