Expand description
s9vm : processor control block (guest/host state structure).
This module provides:
- field encoding (16, 32, 64 bits and “natural”) according to the SDM;
- the assembler primitives
vmptrld,vmclear,vmptrst,vmread,vmwrite(Intel instruction names, unrelated to a commercial hypervisor); - the building of the enabling value (
EPTP) and the computation of the controls from the “allowed” masks.
The module depends only on core: it is testable on the host (L2 tests).
The assembler calls must be made with local interrupts
disabled and a control block loaded on the current CPU.
Re-exports§
use core::arch::asm;🔒use core::sync::atomic::AtomicBool;🔒use core::sync::atomic::AtomicU32;🔒use core::sync::atomic::Ordering;🔒
Modules§
- field
- Field encodings that are useful to the s9vm foundation. The width is deduced
by
FieldWidth::of; these constants are checked by the L2 tests.
Structs§
- Control
Block - Scope of a control block: a physical region aligned on 4 KiB.
Enums§
- Control
Error - Errors of the control block primitives.
- Field
Width - Weight of the fields according to bits 14:13 of the encoding.
Statics§
- TRACE_
ERROR 🔒 - TRACE_
FIELD 🔒 - WRITE_
TRACE 🔒 - Diagnostic: when enabled, every successful
vmwriteis followed by a read of the VM-instruction error field. The first field whose write leaves a non-zero error is recorded inTRACE_FIELD/TRACE_ERROR. This makes a silently rejected field identifiable on hardware.
Functions§
- invalidate_
second_ ⚠level - Invalidates the second-level translations for a given context
(
invepttype 1, single context). - invalidate_
second_ ⚠level_ all - Invalidates all second-level translations (
invepttype 2). - make_
eptp - Builds the enabling value of the second-level translation (
EPTP): memory type, walk length, A/D and root address. - region_
size_ from_ basic - Minimum size of the control block region (bytes), from
MSR_BASICbits 44:32. - revision_
from_ basic - Control block revision identifier from
MSR_BASIC. - set_
write_ trace - Enables or disables the write trace (also resets the recorded failure).
- write_
trace_ failure - First field (and error) for which a
vmwriteleft a non-zero instruction error, if any.