Module vm_memory::atomic

source ·
Expand description

A wrapper over an ArcSwap<GuestMemory> struct to support RCU-style mutability.

With the backend-atomic feature enabled, simply replacing GuestMemoryMmap with GuestMemoryAtomic<GuestMemoryMmap> will enable support for mutable memory maps. To support mutable memory maps, devices will also need to use GuestAddressSpace::memory() to gain temporary access to guest memory.

Structs

  • A fast implementation of a mutable collection of memory regions.
  • An RAII implementation of a “scoped lock” for GuestMemoryAtomic. When this structure is dropped (falls out of scope) the lock will be unlocked, possibly after updating the memory map represented by the GuestMemoryAtomic that created the guard.
  • 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.