Skip to main content

Module control

Module control 

Source
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§

ControlBlock
Scope of a control block: a physical region aligned on 4 KiB.

Enums§

ControlError
Errors of the control block primitives.
FieldWidth
Weight of the fields according to bits 14:13 of the encoding.

Statics§

TRACE_ERROR 🔒
TRACE_FIELD 🔒
WRITE_TRACE 🔒
Diagnostic: when enabled, every successful vmwrite is followed by a read of the VM-instruction error field. The first field whose write leaves a non-zero error is recorded in TRACE_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 (invept type 1, single context).
invalidate_second_level_all⚠
Invalidates all second-level translations (invept type 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_BASIC bits 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 vmwrite left a non-zero instruction error, if any.