arm_vcpu 0.5.20

OS-neutral AArch64 vCPU core
Documentation

Crates.io Docs.rs Rust License

English | 中文

Introduction

arm_vcpu provides an OS-neutral AArch64 vCPU core. It owns EL2 guest entry/exit, guest register state, trap decode, and hardware virtualization register semantics. Host OS and VMM policy is supplied through ArmHostOps; AxVM integration lives in virtualization/axvm/src/arch/aarch64.

Quick Start

Installation

Add this crate to your Cargo.toml:

[dependencies]
arm_vcpu = "0.5.0"

Run Check and Test

# Enter the crate directory
cd virtualization/arm_vcpu

# Format code
cargo fmt --all

# Run the workspace clippy flow
cargo xtask clippy --package arm_vcpu

# Run host-runnable contract tests
cargo test -p arm_vcpu --test dependency_contract_test

# Build documentation
cargo doc --no-deps

Integration

Example

use arm_vcpu::{ArmHostOps, ArmVcpu, ArmVcpuCreateConfig, ArmVcpuResult};

struct MyHost;

impl ArmHostOps for MyHost {
    fn inject_virtual_interrupt(_vector: u32) -> ArmVcpuResult {
        Ok(())
    }

    fn fetch_pending_host_irq() -> Option<usize> {
        None
    }

    fn handle_current_host_irq() {}
}

fn build_vcpu() -> ArmVcpuResult<ArmVcpu<MyHost>> {
    ArmVcpu::<MyHost>::new(0, 0, ArmVcpuCreateConfig::default())
}

Documentation

Generate and view API documentation:

cargo doc --no-deps --open

Online documentation: docs.rs/arm_vcpu

Contributing

  1. Fork the repository and create a branch
  2. Run local format and checks
  3. Run local tests relevant to this crate
  4. Submit a PR and ensure CI passes

License

Licensed under the Apache License, Version 2.0. See LICENSE for details.