pub trait ResolveMemoryFault: Send + Sync {
// Required method
fn resolve(
&self,
fault: MemoryRange,
write: bool,
) -> Result<MemoryRange, GuestMemoryBackingError>;
}Expand description
Prepares guest-memory backing to resolve a memory-access fault, and reports the GPA range the partition should map in response.
This is implemented by the memory backing and called by hypervisor backends (e.g. WHP) that forward guest memory-access faults to the VMM. It lets the backing commit lazily-backed pages and opportunistically widen the mapped range to a large page (soft large pages), while the backend keeps the final per-page safety decision over the returned range.
Required Methods§
Sourcefn resolve(
&self,
fault: MemoryRange,
write: bool,
) -> Result<MemoryRange, GuestMemoryBackingError>
fn resolve( &self, fault: MemoryRange, write: bool, ) -> Result<MemoryRange, GuestMemoryBackingError>
Prepares backing for the faulting range fault and returns the GPA range
the partition should map.
The caller passes the range it needs backed (expressed in whatever page
granularity the backend uses), so this layer never needs to know the
guest page size. The returned range is always a superset of fault,
clamped to a single uniform RAM region. It is widened (e.g. to 2 MB) only
on the first fault of a large-page-eligible region that fully contains
fault; otherwise fault is returned unchanged. Subsequent faults of an
already-attempted region are not widened.