diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2a43b87..848146e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -18,7 +18,7 @@ jobs: with: components: rustfmt, clippy - name: Install Targets - run: rustup target add x86_64-unknown-none aarch64-unknown-none riscv64gc-unknown-none-elf + run: rustup target add x86_64-unknown-none aarch64-unknown-none riscv64gc-unknown-none-elf loongarch64-unknown-none - name: Rust Version run: rustup --version && rustc --version - name: Run clippy x86_64 @@ -27,6 +27,8 @@ jobs: run: cargo clippy --verbose --target aarch64-unknown-none --all-features -- -D warnings - name: Run clippy riscv64 run: cargo clippy --verbose --target riscv64gc-unknown-none-elf --all-features -- -D warnings + - name: Run clippy loongarch64 + run: cargo clippy --verbose --target loongarch64-unknown-none --all-features -- -D warnings - name: Reformat code uses: mbrobbel/rustfmt-check@master with: diff --git a/src/lib.rs b/src/lib.rs index 57a5930..493e9b4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -103,6 +103,9 @@ unsafe impl Send for BaseRevision {} #[cfg(not(any( target_arch = "x86_64", target_arch = "aarch64", - target_arch = "riscv64" + target_arch = "riscv64", + target_arch = "loongarch64" )))] -compile_error!("Unsupported architecture, please use `x86_64`, `aarch64`, or `riscv64`"); +compile_error!( + "Unsupported architecture, please use `x86_64`, `aarch64`, `riscv64`, or `loongarch64`" +); diff --git a/src/response.rs b/src/response.rs index 2997953..210782c 100644 --- a/src/response.rs +++ b/src/response.rs @@ -155,6 +155,7 @@ impl PagingModeResponse { #[repr(C)] pub struct SmpResponse { revision: u64, + #[cfg(not(target_arch = "loongarch64"))] flags: smp::ResponseFlags, #[cfg(target_arch = "x86_64")] bsp_lapic_id: u32, @@ -172,6 +173,7 @@ impl SmpResponse { /// Returns the flags that were enabled by the bootloader. See /// [`ResponseFlags`](smp::ResponseFlags) for more information. + #[cfg(not(target_arch = "loongarch64"))] pub fn flags(&self) -> smp::ResponseFlags { self.flags } diff --git a/src/smp.rs b/src/smp.rs index a7d818d..44175b4 100644 --- a/src/smp.rs +++ b/src/smp.rs @@ -47,8 +47,10 @@ pub struct Cpu { /// The address to jump to. Writing to this field will cause the core to /// jump to the given function. The function will receive a pointer to this /// structure, and it will have its own 64KiB (or requested-size) stack. + #[cfg(not(target_arch = "loongarch64"))] pub goto_address: GotoAddress, /// Free for use by the kernel. + #[cfg(not(target_arch = "loongarch64"))] pub extra: u64, } @@ -73,7 +75,7 @@ bitflags! { } } -#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))] +#[cfg(not(target_arch = "x86_64"))] bitflags! { /// Flags for the [SMP response](crate::response::SmpResponse). #[derive(Default, Clone, Copy)]