| Crates.io | arm_vgic |
| lib.rs | arm_vgic |
| version | 0.1.0 |
| created_at | 2025-08-17 16:29:10.940666+00 |
| updated_at | 2025-08-17 16:29:10.940666+00 |
| description | ARM Virtual Generic Interrupt Controller (VGIC) implementation. |
| homepage | |
| repository | https://github.com/arceos-hypervisor/arm_vgic |
| max_upload_size | |
| id | 1799555 |
| size | 92,650 |
A Virtual Generic Interrupt Controller (VGIC) implementation for ARM architecture, designed for the ArceOS hypervisor ecosystem.
This crate provides a comprehensive implementation of ARM's Virtual Generic Interrupt Controller (VGIC), enabling virtualized interrupt management for guest operating systems running under a hypervisor. The VGIC emulates the behavior of ARM's Generic Interrupt Controller (GIC) hardware, allowing multiple virtual machines to share the underlying interrupt controller while maintaining isolation.
vgicv3 feature)The crate is organized into several key components:
vgic.rs): Main VGIC controller implementationvgicd.rs): Virtual GIC Distributor for interrupt routinginterrupt.rs): Interrupt state management and operationsregisters.rs): GIC register definitions and accesslist_register.rs): Hardware list register managementuse arm_vgic::Vgic;
// Create a new VGIC instance
let vgic = Vgic::new();
// The VGIC implements BaseDeviceOps for MMIO handling
// Register it with your hypervisor's device management system
Enable GICv3 support:
[dependencies]
arm_vgic = { version = "*", features = ["vgicv3"] }
This crate is designed to integrate seamlessly with the ArceOS hypervisor ecosystem:
axdevice_base for device abstractionaxaddrspace for memory managementaxvisor_api for hypervisor operationsThe VGIC exposes the following memory-mapped regions to guest VMs:
0x0800_0000 - 0x0800_FFFF (64KB)0x0801_0000 - 0x0801_FFFF (64KB)0x0802_0000+ (128KB per CPU)GICD_CTLR - Distributor Control RegisterGICD_TYPER - Interrupt Controller Type RegisterGICD_IIDR - Distributor Implementer Identification RegisterGICD_IGROUPR - Interrupt Group RegistersGICD_ISENABLER - Interrupt Set-Enable RegistersGICD_ICENABLER - Interrupt Clear-Enable RegistersGICD_ISPENDR - Interrupt Set-Pending RegistersGICD_ICPENDR - Interrupt Clear-Pending RegistersGICD_ISACTIVER - Interrupt Set-Active RegistersGICD_ICACTIVER - Interrupt Clear-Active RegistersGICD_IPRIORITYR - Interrupt Priority RegistersGICD_ITARGETSR - Interrupt Processor Targets RegistersGICD_ICFGR - Interrupt Configuration RegistersGICD_SGIR - Software Generated Interrupt RegisterGICC_CTLR - CPU Interface Control RegisterGICC_PMR - Interrupt Priority Mask RegisterGICC_BPR - Binary Point RegisterGICC_IAR - Interrupt Acknowledge RegisterGICC_EOIR - End Of Interrupt RegisterGICC_RPR - Running Priority RegisterGICC_HPPIR - Highest Priority Pending Interrupt Registeraxdevice_base: Device abstraction layeraxaddrspace: Address space managementaxvisor_api: Hypervisor API and operationsaarch64-unknown-none-softfloat// Interrupt injection is handled through the ArceOS VMM API
use axvisor_api::vmm::InterruptVector;
// Hardware interrupt injection (handled by hypervisor)
let vector = InterruptVector::new(42); // IRQ 42
// The VGIC will handle the virtualization automatically
use arm_vgic::vtimer::get_sysreg_device;
// Get virtual timer system register devices
let timer_devices = get_sysreg_device();
// Register with your system register handler
for device in timer_devices {
// Register device with hypervisor's system register emulation
}
# Run tests
cargo test
# Run tests with all features
cargo test --all-features
This project is part of the ArceOS hypervisor ecosystem. Contributions should follow the ArceOS project guidelines and maintain compatibility with the broader ecosystem.