Skip to main content

Crate ax_percpu

Crate ax_percpu 

Source
Expand description

ax-percpu

Define and access per-CPU data structures

Crates.io Docs.rs Rust License

English | 中文

§Introduction

ax-percpu provides Define and access per-CPU data structures. It is maintained as part of the TGOSKits component set and is intended for Rust projects that integrate with ArceOS, AxVisor, or related low-level systems software.

ax-percpu was derived from https://github.com/arceos-org/percpu

§Quick Start

§Installation

Add this crate to your Cargo.toml:

[dependencies]
ax-percpu = "0.4.3"

§Run Check and Test

# Enter the crate directory
cd components/percpu/percpu

# Format code
cargo fmt --all

# Run clippy
cargo clippy --all-targets --all-features

# Run Linux host tests
cargo test --features host-test,non-zero-vma

# Build documentation
cargo doc --no-deps

§Integration

§Example

use ax_percpu as _;

fn main() {
    // Integrate `ax-percpu` into your project here.
}

§Documentation

Generate and view API documentation:

cargo doc --no-deps --open

Online documentation: docs.rs/ax-percpu

§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.

Structs§

EXAMPLE_PERCPU_DATA_WRAPPER
Wrapper struct for the per-CPU data EXAMPLE_PERCPU_DATA

Statics§

EXAMPLE_PERCPU_DATAdoc
Example per-CPU data for documentation only.

Functions§

init
Initialize all per-CPU data areas.
init_percpu_reg
Initializes the per-CPU data register.
percpu_area_base
Returns the base address of the per-CPU data area on the given CPU.
percpu_area_num
Returns the number of per-CPU data areas reserved.
percpu_area_size
Returns the per-CPU data area size for one CPU.
read_percpu_reg
Reads the architecture-specific per-CPU data register.
write_percpu_reg
Writes the architecture-specific per-CPU data register.

Attribute Macros§

def_percpu
Defines a per-CPU static variable.