Skip to main content

virt_to_phys

Function virt_to_phys 

Source
pub unsafe fn virt_to_phys<'a, Op: TableReadOps + 'a>(
    op: impl AsRef<Op> + Copy + 'a,
    address: u64,
    len: u64,
) -> impl Iterator<Item = Mapping> + 'a
Expand description

This function is presently used for reading the tracing data, also it is useful for debugging

ยงSafety

This function traverses page table data structures, and should not be called concurrently with any other operations that modify the page table. Translates a virtual address range to the physical address pages that back it by walking the page tables.

Returns an iterator with an entry for each mapped page that intersects the given range.

This takes AsRef + Copy so that on targets where the operations have little state (e.g. the guest) the operations state can be copied into the closure(s) in the iterator, allowing for a nicer result lifetime. On targets like the building-an-original-snapshot portion of the host, where the operations structure owns a large buffer, a reference can instead be passed.