#kernel #arceos

no-std axklib

Small kernel-helper abstractions used across the microkernel

2 unstable releases

Uses new Rust 2024

new 0.2.0 Feb 3, 2026
0.1.0-alpha.1 Jan 27, 2026

#187 in Operating systems

Apache-2.0

11KB

axklib

Crates.io Docs License

axklib — Small kernel-helper abstractions used across the ArceOS microkernel.

Overview

This crate exposes a tiny, no_std-compatible trait (Klib) that the platform/board layer must implement. The trait provides a handful of common kernel helpers such as:

  • Memory mapping helpers
  • Timing utilities (busy-wait)
  • IRQ registration and enabling/disabling

The implementation is typically supplied by the platform layer (e.g., modules/axklib-impl) and consumed by drivers and other modules.

The crate also provides small convenience modules (mem, time, irq) that re-export the trait methods with shorter names to make call sites more ergonomic.

Usage

Add this to your Cargo.toml:

[dependencies]
axklib = "0.2.0"

Example

// 1. Map 4K of device MMIO at physical address `paddr`
// Returns axerrno::AxResult<VirtAddr>
let vaddr = axklib::mem::iomap(paddr, 0x1000)?;

// 2. Busy-wait for 100 microseconds
axklib::time::busy_wait(core::time::Duration::from_micros(100));

// 3. Register an IRQ handler
// Returns bool indicating success
axklib::irq::register(32, my_irq_handler);

fn my_irq_handler() {
    // Handle interrupt...
}

License

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

Dependencies

~1.1–1.6MB
~24K SLoC