pub fn translate(
state: &CpuState,
mem: &dyn GuestMemory,
linear: u64,
) -> Result<Translation, WalkError>Expand description
Translates one linear address using the paging structures that state points at.
ยงExamples
With paging off, translation is the identity:
use kvmtrace::{memory::MappedMemory, paging::translate, state::CpuState};
let s = CpuState::default(); // CR0.PG = 0
let t = translate(&s, &MappedMemory::new(), 0x1234).unwrap();
assert_eq!(t.physical, 0x1234);