Expand description
A software walker for x86 guest page tables.
MacSim does its own address translation, so a MacSim trace only needs virtual addresses. We still walk the guest’s page tables because:
- instruction bytes live at a linear address and must be read from guest-physical memory;
- the extended trace records the guest-physical address of every access, for simulators that want it;
- a walk that fails tells us, before the instruction runs, that an access is going to fault.
The walker understands every paging mode an x86-64 guest can be in: none, 32-bit (with 4 MiB pages), PAE, 4-level and 5-level. It reads the tables the same way the CPU does, but does not set Accessed/Dirty bits and does not model the TLB: it always reflects the tables as they are in memory right now.
Structs§
- Translation
- The result of a successful walk.
Enums§
- Intent
- What kind of access a permission check is for.
- Paging
Mode - Which page-table format is active.
- Walk
Error - Why a walk stopped.
Functions§
- permits
- Would an access with this
intentbe allowed byt? - read_
linear - Reads guest memory at a linear address, crossing page boundaries as needed.
Returns the number of bytes actually read (fewer than
buf.len()if a later page is not mapped). - translate
- Translates one linear address using the paging structures that
statepoints at.