diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f44b4ed..4c3dd0d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,6 @@ jobs: - name: Check code format run: cargo fmt --all -- --check - name: Clippy - run: cargo clippy --target ${{ matrix.targets }} --all-features -- -A clippy::new_without_default + run: cargo clippy --target ${{ matrix.targets }} --all-features -- -D warnings - name: Build - run: cargo build --target ${{ matrix.targets }} --all-features \ No newline at end of file + run: cargo build --target ${{ matrix.targets }} --all-features diff --git a/.gitignore b/.gitignore index 6985cf1..73fab07 100644 --- a/.gitignore +++ b/.gitignore @@ -3,10 +3,6 @@ debug/ target/ -# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries -# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock - # These are backup files generated by rustfmt **/*.rs.bk diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..56a439d --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,40 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aarch64-cpu" +version = "9.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac42a04a61c19fc8196dd728022a784baecc5d63d7e256c01ad1b3fbfab26287" +dependencies = [ + "tock-registers", +] + +[[package]] +name = "arm_gic" +version = "0.1.0" +dependencies = [ + "aarch64-cpu", + "bitflags", + "cfg-if", + "tock-registers", +] + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "tock-registers" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "696941a0aee7e276a165a978b37918fd5d22c55c3d6bda197813070ca9c0f21c" diff --git a/src/gic_v3.rs b/src/gic_v3.rs index d067eb2..7291916 100644 --- a/src/gic_v3.rs +++ b/src/gic_v3.rs @@ -202,18 +202,18 @@ impl GicDistributor { fn mpidr_affinity_level(mpidr: u64, level: u32) -> u64 { match level { - 3 => mpidr >> 32 & 0xff, - 2 => mpidr >> 16 & 0xff, - 1 => mpidr >> 8 & 0xff, + 3 => (mpidr >> 32) & 0xff, + 2 => (mpidr >> 16) & 0xff, + 1 => (mpidr >> 8) & 0xff, 0 => mpidr & 0xff, _ => panic!("invalid affinity level"), } } fn mpidr_to_affinity_level(mpidr: u64) -> u64 { - Self::mpidr_affinity_level(mpidr, 3) << 32 - | Self::mpidr_affinity_level(mpidr, 2) << 16 - | Self::mpidr_affinity_level(mpidr, 1) << 8 + (Self::mpidr_affinity_level(mpidr, 3) << 32) + | (Self::mpidr_affinity_level(mpidr, 2) << 16) + | (Self::mpidr_affinity_level(mpidr, 1) << 8) | Self::mpidr_affinity_level(mpidr, 0) } @@ -327,7 +327,7 @@ impl GicRedistributor { fn base_init(&mut self) { let typer = self.gicr_regs().TYPER.get() as usize; - let mut ppinum = typer >> 27 & 0x1f; + let mut ppinum = (typer >> 27) & 0x1f; ppinum = match ppinum { 0 => 16, 1 | 2 => 16 + 32 * ppinum, diff --git a/src/lib.rs b/src/lib.rs index 4bd2ec0..63af910 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,9 +12,6 @@ //! Please contact the developer if you need this function #![no_std] -#![feature(const_ptr_as_ref)] -#![feature(const_option)] -#![feature(const_nonnull_new)] use core::fmt; use core::fmt::{Debug, Formatter};