4 releases

Uses new Rust 2024

new 0.2.1 Feb 9, 2026
0.2.0 Feb 3, 2026
0.1.1-preview.1 Feb 8, 2026
0.1.0 Aug 17, 2025

#195 in Configuration

Download history 21/week @ 2025-10-17 4/week @ 2025-10-24 275/week @ 2025-10-31 134/week @ 2025-11-07 8/week @ 2025-11-14 15/week @ 2025-11-21 10/week @ 2025-11-28 13/week @ 2025-12-19 1/week @ 2025-12-26 84/week @ 2026-01-02 7/week @ 2026-01-09 1/week @ 2026-01-23 218/week @ 2026-01-30

282 downloads per month
Used in 3 crates (via x86_vcpu)

Apache-2.0

140KB
1.5K SLoC

x86_vlapic

CI

A Rust library for virtualizing x86 Local Advanced Programmable Interrupt Controller (LAPIC) functionality. [Work in Progress].

Overview

This library provides a software implementation of the x86 Local APIC (Advanced Programmable Interrupt Controller) for hypervisor use cases. It virtualizes the LAPIC registers and functionality according to the Intel Software Developer's Manual (SDM) specifications.

⚠️ Important: This is an early-stage library focused solely on timer virtualization. Do not use for full LAPIC emulation yet.

Current Status

  • Timer Virtualization: Fully implemented with support for one-shot, periodic, and TSC-deadline modes
  • 🚧 Register Definitions: Complete register layout and bitfield definitions for all LAPIC registers
  • 🚧 Interrupt Handling: Framework implemented, core interrupt delivery logic in development
  • 🚧 IPI Support: Partial implementation, some functions are placeholders

Architecture

The library is structured into several key modules:

Core Modules

Register Definitions

Basic Example

use x86_vlapic::EmulatedLocalApic;
use axvisor_api::vmm::{VMId, VCpuId};

// Create a new emulated Local APIC for VM 1, VCPU 0
let vm_id = VMId::from(1 as usize);
let vcpu_id = VCpuId::from(0 as usize);
let apic = EmulatedLocalApic::new(vm_id, vcpu_id);

// Get the shared virtual APIC access page address (static for all instances)
let access_addr = EmulatedLocalApic::virtual_apic_access_addr();
assert!(access_addr.is_aligned(PAGE_SIZE_4K));

// Get the per-VCPU virtual APIC page address
let page_addr = apic.virtual_apic_page_addr();
assert!(page_addr.is_aligned(PAGE_SIZE_4K));

Target Platform

This library is designed for x86_64 architecture and targets x86_64-unknown-none for no-std environments, making it suitable for hypervisor and kernel development.

ArceOS - An experimental modular OS (or Unikernel) AxVisor - Hypervisor implementation


Note: This is a virtualization library and does not interact with actual hardware LAPIC. It's designed for use in hypervisors and virtual machine monitors.

License

X86_vlapic is licensed under the Apache License, Version 2.0. See the LICENSE file for details.

Dependencies

~7.5MB
~126K SLoC