AArch64 System Register Type Definitions
English | 中文
A library providing type definitions for AArch64 system registers, including operation types, register types, and system register enumerations for the ARM64 architecture. Supports #![no_std] for bare-metal and OS kernel development.
This library exports three core enumeration types:
OperationType— AArch64 instruction operation types (1000+ instructions)RegistersType— General-purpose and vector registers (W/X/V/B/H/S/D/Q/Z/P, etc.)SystemRegType— System registers (debug, trace, performance counters, system control, etc.)
Each type implements Display, From<usize>, LowerHex, and UpperHex traits.
- Rust nightly toolchain
- Rust components: rust-src, clippy, rustfmt
# Install rustup (if not installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install nightly toolchain and components
rustup install nightly
rustup component add rust-src clippy rustfmt --toolchain nightly# 1. Clone the repository
git clone https://github.com/arceos-org/aarch64_sysreg.git
cd aarch64_sysreg
# 2. Code check (format + clippy + build + doc generation)
./scripts/check.sh
# 3. Run tests
# Run all tests (unit tests + integration tests)
./scripts/test.sh
# Run unit tests only
./scripts/test.sh unit
# Run integration tests only
./scripts/test.sh integration
# List all available test suites
./scripts/test.sh list
# Specify unit test target
./scripts/test.sh unit --unit-targets x86_64-unknown-linux-gnuAdd to your Cargo.toml:
[dependencies]
aarch64_sysreg = "0.1.1"use aarch64_sysreg::{OperationType, RegistersType, SystemRegType};
fn main() {
// Operation type: enum variant and value conversion
let op = OperationType::ADD;
println!("{}", op); // ADD
println!("0x{:x}", op); // 0x6
println!("0x{:X}", op); // 0x6
let op_from = OperationType::from(0x6);
assert_eq!(op_from, OperationType::ADD);
// Register type
let reg = RegistersType::X0;
println!("{}", reg); // X0
let reg_from = RegistersType::from(0x22);
assert_eq!(reg_from, RegistersType::X0);
// System register
let sys_reg = SystemRegType::MDSCR_EL1;
println!("{}", sys_reg); // MDSCR_EL1
println!("0x{:x}", sys_reg); // 0x240004
}Generate and view API documentation:
cargo doc --no-deps --openOnline documentation: docs.rs/aarch64_sysreg
- Fork the repository and create a branch
- Run local check:
./scripts/check.sh - Run local tests:
./scripts/test.sh - Submit PR and pass CI checks
Licensed under the Apache License, Version 2.0. See LICENSE for details.