| Crates.io | x86_vcpu |
| lib.rs | x86_vcpu |
| version | 0.1.0 |
| created_at | 2025-08-18 05:56:57.721405+00 |
| updated_at | 2025-08-18 05:56:57.721405+00 |
| description | x86 Virtual CPU implementation for the Arceos Hypervisor |
| homepage | |
| repository | https://github.com/arceos-hypervisor/x86_vcpu |
| max_upload_size | |
| id | 1799993 |
| size | 248,483 |
Definition of the vCPU structure and virtualization-related interface support for x86_64 architecture.
The crate user must implement the AxVCpuHal trait to provide the required low-level implementantion,
relevant implementation can refer to axvcpu. [Work in Progress]
svm)tracing)The library is structured into several key modules:
vmx/: Intel VMX virtualization implementation
vcpu.rs: Virtual CPU implementation (VmxArchVCpu)vmcs.rs: VMCS (Virtual Machine Control Structure) managementpercpu.rs: Per-CPU state management (VmxArchPerCpuState)definitions.rs: VMX constants and exit reasonsinstructions.rs: VMX instruction wrappersstructs.rs: VMX data structuresregs/: Register management
accessors.rs: Register access utilitiesdiff.rs: Register state comparisonmod.rs: General-purpose registers (GeneralRegisters)ept.rs: Extended Page Tables implementation
msr.rs: Model-Specific Register handling
VmxArchVCpu: Main virtual CPU implementationVmxArchPerCpuState: Per-CPU virtualization stateGeneralRegisters: x86-64 general-purpose registersVmxExitReason: VM exit reason enumerationGuestPageWalkInfo: Guest page walk informationuse x86_vcpu::{has_hardware_support, GeneralRegisters};
// Check if VMX is supported on this hardware
if has_hardware_support() {
println!("VMX hardware support detected");
} else {
println!("VMX hardware support not available");
}
// Create and initialize guest registers
let mut regs = GeneralRegisters::default();
regs.rax = 0x1234;
regs.rbx = 0x5678;
println!("Guest registers initialized:");
println!("RAX: {:#x}", regs.rax);
println!("RBX: {:#x}", regs.rbx);
// Display register names
for (i, name) in GeneralRegisters::REGISTER_NAMES.iter().enumerate() {
println!("Register {}: {}", i, name);
}
The library supports the following Cargo features:
default: Enables VMX support by defaultvmx: Intel VMX (VT-x) supportsvm: AMD SVM supporttracing: Enable tracing for debuggingThis project is licensed under multiple licenses. You may choose to use this project under any of the following licenses:
You may use this software under the terms of any of these licenses at your option.