Skip to main content

Module vmem

Module vmem 

Source

Structs§

BasicMapping
CowMapping
Mapping
MayMoveTable
A marker struct, used by an implementation of TableOps to indicate that it may need to move existing page tables
MayNotMoveTable
A marker struct, used by an implementation of TableOps to indicate that it will be able to update existing page tables in-place, without moving them.
SpaceReferenceMapping
A reference from one address space to an intermediate page table that lives in a different space. Produced by walk_va_spaces when the walker encounters an intermediate table (at some depth below the root) whose physical address was already seen via an earlier root — i.e. the two spaces alias that sub-tree.
UpdateParentNone
A struct implementing UpdateParent that is impossible to use (since its UpdateParent::update_parent method takes Void), used when it is statically known that a table operation cannot result in a need to update ancestors.

Enums§

MappingKind
SpaceAwareMapping
Either a normal leaf mapping in the current space, or a reference to an intermediate table in another space. The compaction loop in the host snapshotting code treats these two cases differently:
Void
Our own version of ! until it is stable. Used to avoid needing to implement TableOps::update_root for ops that never need to move a table.

Constants§

PAGE_PRESENT
Page is Present
PAGE_SIZE
This is always the page size that the /guest/ is being compiled for, which may or may not be the same as the host page size.
PAGE_TABLE_ENTRIES_PER_TABLE
PAGE_TABLE_SIZE
PTE_ADDR_MASK
Mask to extract the physical address from a PTE (bits 51:12) This masks out the lower 12 flag bits AND the upper bits including NX (bit 63)

Traits§

TableMovability
A sealed trait used to collect some information about the marker structures MayMoveTable and MayNotMoveTable
TableOps
The operations used to actually access the page table structures that involve writing to them, used to allow the same code to be used in the host and the guest for page table setup.
TableReadOps
The read-only operations used to actually access the page table structures, used to allow the same code to be used in the host and the guest for page table setup. This is distinct from TableWriteOps, since there are some implementations for which writing does not make sense, and only reading is required.
UpdateParent
A helper trait that allows us to move a page table (e.g. from the snapshot to the scratch region), keeping track of the context that needs to be updated when that is moved (and potentially recursively updating, if necessary).

Functions§

map
Assumption: all are page-aligned
space_aware_map
Counterpart of walk_va_spaces’s AnotherSpace entries on the write side: installs a link in op’s root PT tree at ref_map.our_va that points at whatever intermediate table the owning space ended up with at ref_map.their_va (in built_roots[ref_map.space]).
virt_to_phys
This function is presently used for reading the tracing data, also it is useful for debugging
walk_va_spaces
Walk multiple page-table roots together, emitting either a normal leaf mapping (ThisSpace) or a reference to an alias that was already seen via an earlier root (AnotherSpace).

Type Aliases§

PageTableEntry
PhysAddr
SpaceId
Identifier for a virtual address space, used by the multi-space walker to describe which space “owns” a shared intermediate table. Implementations typically use the physical address of the root page table (which is unique per space).
VirtAddr