#aarch64 #register #ruspiro

no-std ruspiro-arch-aarch64

This crate provides access to Aarch64 system registers as well as specific usefull aarch64 assembly instructions

8 releases

0.1.7 Dec 28, 2021
0.1.6 Dec 28, 2021
0.1.5 Aug 30, 2021
0.1.4 Apr 23, 2021
0.1.3 Sep 23, 2020

#466 in No standard library

Download history 22/week @ 2024-07-22 33/week @ 2024-07-29 34/week @ 2024-08-05 26/week @ 2024-08-12 21/week @ 2024-08-19 13/week @ 2024-08-26 28/week @ 2024-09-02 33/week @ 2024-09-09 28/week @ 2024-09-16 44/week @ 2024-09-23 49/week @ 2024-09-30 23/week @ 2024-10-14 23/week @ 2024-10-21 23/week @ 2024-10-28 15/week @ 2024-11-04

84 downloads per month
Used in 10 crates (5 directly)

MIT/Apache

71KB
911 lines

RusPiRo Aarch64 API

This crate provides access to ARM Aarch64 system registers as well as specific assembly instructions. The system registers are organized based on the highest exception level they are available.

CI Latest Version Documentation License

Usage

To use this crate simply add the dependency to your Cargo.toml file:

[dependencies]
ruspiro-arch-aarch64 = "0.1.7"

With the dependency maintained in the Cargo.toml file the different defined system registers can be accessed as shown in the following code snipped.

For each available system register a mdule with the registers name is available providing functions to read/write the contents of the register. Those read/write accesses can be either use raw values (u32, u64 - based on register size) or predifined register fields. If a register field is used value contained in the field is properly shifted and masked when written to or read from a register.

use ruspiro_arch_aarch64::register::*;

fn some_function() {
    // read the current exeption level - do this by accessing the predefined
    // register field
    let current_el = currentel::read(currentel::EL::Field);

    if current_el == currentel::EL::EL2 {
        // if a register definition provides predefined constants for specific
        // register fields those can be used for instance to write to the register
        mair_el2::write(
            mair_el2::MAIR0::NGNRNE
                | mair_el2::MAIR1::NGNRE
                | mair_el2::MAIR2::GRE
                | mair_el2::MAIR3::NC
                | mair_el2::MAIR4::NORM,
        );
    }
}

License

Licensed under Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) or MIT (LICENSE-MIT or http://opensource.org/licenses/MIT)) at your choice.

Dependencies

~14KB