pub fn plan_map(gpa: u64, len: u64) -> Result<Vec<MapSegment>, MapError>Expand description
Plans the 2 MiB/4 KiB split of [gpa, gpa + len).
Rules:
- the range must be 4 KiB aligned and inside the guest physical space,
like
GuestMap::reserve; - a 2 MiB-aligned, 2 MiB-multiple middle is emitted as 2 MiB segments;
- a partial head (base not 2 MiB aligned) and a partial tail stay 4 KiB;
- a granularity never straddles a 2 MiB boundary, so one 2 MiB region is always mapped with a single granularity.
The plan only splits the GPA range. Installing a 2 MiB segment also requires a 2 MiB-aligned, physically contiguous host block; a caller that cannot provide one must fall back to 4 KiB pages for that region.