Expand description
s9vm : vCPU: state, control block configuration, entry/exit.
A Vcpu is the guest execution unit. It owns:
- a hardware control block (
ControlBlock); - a dedicated host stack (used by the trampoline to return from the guest);
- the guest state (
GuestState) and theEnterFrameexchange area.
Configuration is deliberately explicit (configure_host,
configure_guest, configure_controls) rather than spread across the
constructor: each step is checkable and hardware errors (VMfail) can be
attributed to a step.
No policy is decided here: the module does not know what a guest OS, a device or a complete virtual machine is.
Re-exportsยง
use crate::memory::frame::FrameAllocOptions;๐use crate::memory::frame::FramePurpose;๐use crate::memory::frame::PhysFrame;๐use crate::s9vm::caps::HwCaps;๐use crate::s9vm::control::field;๐use crate::s9vm::control::ControlBlock;๐use crate::s9vm::control::ControlError;๐use crate::s9vm::exit::ExitClass;๐use crate::s9vm::exit::ExitReason;๐use crate::s9vm::fpu::FpuSwitch;๐use crate::s9vm::guest::GuestState;๐use crate::s9vm::launch::s9vm_enter_guest;๐use crate::s9vm::launch::s9vm_guest_exit;๐use crate::s9vm::launch::EnterFrame;๐use crate::s9vm::mmu;๐use crate::s9vm::mmu::Perms;๐use crate::s9vm::mmu::SecondLevel;๐use crate::s9vm::mmu::TableMemory;๐use crate::s9vm::msr;๐use crate::s9vm::msr::MsrModel;๐
Modulesยง
- bits
- Control bits useful for configuration (SDM).
- msr_
bitmap - Layout of the 4 KiB MSR bitmap.
Structsยง
- Exit
Info - Information about a guest exit, copied out of the control block.
- Hhdm
Tables - Table provider that accesses physical memory through the HHDM and keeps track of the allocated tables so they can be freed.
- Host
Stack ๐ - Host stack dedicated to the trampoline.
- Second
Level Memory - Pre-allocated resources for second-level translation.
- Vcpu
- A vCPU: resources, guest state and control block.
Enumsยง
- Vcpu
Error - vCPU lifecycle errors.
Constantsยง
- DEFAULT_
PREEMPTION_ TIMER_ TICKS - Number of preemption-timer counts per guest time slice.
- GPR_RSP ๐
- Index of RSP in the x86 register encoding order.
Functionsยง
- alloc_
msr_ ๐bitmap - Allocates the MSR bitmap of a vCPU.
- gpr_
from_ ๐frame - Reads a general-purpose register out of the entry frame (encoding order).
- gpr_
into_ ๐frame - Writes a general-purpose register into the entry frame (encoding order).
- primary_
controls ๐ - Primary processor-based controls of a vCPU.
- read_
cr0 ๐ - read_
cr3 ๐ - read_
cr4 ๐ - read_
gdtr ๐ - Reads the global descriptor table base (
sgdt). - read_
idtr ๐ - Reads the interrupt descriptor table base (
sidt). - service_
pending_ host_ interrupts - Opens a one-instruction window so a pending host interrupt can be delivered to the host while the vCPU loop keeps interrupts disabled.
- set_
msr_ ๐intercept - Marks one MSR as intercepted (read and/or write) in the bitmap.
- shadow_
gpr ๐ - Mutable view of the shadow copy of a general-purpose register.
- tr_base ๐
- Base of a TSS descriptor from its selector (GDT).