Skip to content

Low level access to Cortex-A 64-bit processors

License

Notifications You must be signed in to change notification settings

lhw2002426/aarch64

 
 

Repository files navigation

crates.io crates.io

aarch64

Low level access to Cortex-A 64-bit processors.

Used by rCore.

Minimum Supported Rust Version

Requires rustc 1.45.0 or later due to use of the new asm!() syntax.

Usage

Example from https://github.com/rust-embedded/rust-raspi3-OS-tutorials

unsafe fn el2_to_el1_transition() -> ! {
    // Enable timer counter registers for EL1.
    CNTHCTL_EL2.write(CNTHCTL_EL2::EL1PCEN::SET + CNTHCTL_EL2::EL1PCTEN::SET);

    // No offset for reading the counters.
    CNTVOFF_EL2.set(0);

    // Set EL1 execution state to AArch64.
    HCR_EL2.write(HCR_EL2::RW::EL1IsAarch64);

    // Set up a simulated exception return.
    SPSR_EL2.write(
        SPSR_EL2::D::Masked
            + SPSR_EL2::A::Masked
            + SPSR_EL2::I::Masked
            + SPSR_EL2::F::Masked
            + SPSR_EL2::M::EL1h,
    );

Disclaimer

Descriptive comments in the source files are taken from the ARM Architecture Reference Manual ARMv8, for ARMv8-A architecture profile.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Low level access to Cortex-A 64-bit processors

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 99.8%
  • Makefile 0.2%