From 0273377d7af39abb4ee86c2b7b02ab0d4157c37a Mon Sep 17 00:00:00 2001 From: piguycs Date: Fri, 21 Nov 2025 16:30:31 +0100 Subject: [PATCH 1/8] copying over a basic template gh action file --- .github/workflows/build.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..91616d9 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,31 @@ +name: Build the kernel + +on: + push: + branches: [ ci/build ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@nightly + + - name: Cache cargo + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + + - name: Build + run: cargo build --verbose From 20d19aa0d51046513a0d0a0d276d122a8591eb3c Mon Sep 17 00:00:00 2001 From: piguycs Date: Fri, 21 Nov 2025 16:32:07 +0100 Subject: [PATCH 2/8] adding rust-src component --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91616d9..6a27dba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,8 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@nightly + with: + components: rust-src - name: Cache cargo uses: actions/cache@v4 From 1c8e36e69ed9d51619ffcc8157951b6416fa285e Mon Sep 17 00:00:00 2001 From: piguycs Date: Fri, 21 Nov 2025 16:34:53 +0100 Subject: [PATCH 3/8] adding tests and clippy (with warnings) --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6a27dba..8c8a92c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,3 +31,9 @@ jobs: - name: Build run: cargo build --verbose + + - name: Test + run: cargo test --verbose + + - name: Clippy + run: cargo clippy --all-features -- -D warnings From 24d9df3d81dabf97956ec98e6f2cba63bbe4d371 Mon Sep 17 00:00:00 2001 From: piguycs Date: Fri, 21 Nov 2025 16:40:25 +0100 Subject: [PATCH 4/8] add `just` to github actions --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8c8a92c..cf60e12 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,9 @@ jobs: with: components: rust-src + - name: Get just + uses: taiki-e/install-action@just + - name: Cache cargo uses: actions/cache@v4 with: From 9a86fb563fddcb224ea651eca2b9557f2e9cf9ac Mon Sep 17 00:00:00 2001 From: piguycs Date: Fri, 21 Nov 2025 16:41:39 +0100 Subject: [PATCH 5/8] not running any OS code on github, they dont have qemu --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cf60e12..3b75561 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,8 +19,8 @@ jobs: with: components: rust-src - - name: Get just - uses: taiki-e/install-action@just + # - name: Get just + # uses: taiki-e/install-action@just - name: Cache cargo uses: actions/cache@v4 @@ -35,8 +35,8 @@ jobs: - name: Build run: cargo build --verbose - - name: Test - run: cargo test --verbose + # - name: Test + # run: cargo test --verbose - name: Clippy run: cargo clippy --all-features -- -D warnings From 2d0e451fc83f6fd836a4175efe42a4a64278c1ca Mon Sep 17 00:00:00 2001 From: piguycs Date: Fri, 21 Nov 2025 16:45:06 +0100 Subject: [PATCH 6/8] adding clippy component --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3b75561..67294e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build the kernel +name: Kernel CI on: push: @@ -17,7 +17,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@nightly with: - components: rust-src + components: rust-src, clippy # - name: Get just # uses: taiki-e/install-action@just From 33c58b89308751fe37e84fac9dd0690debb5b7f7 Mon Sep 17 00:00:00 2001 From: piguycs Date: Fri, 21 Nov 2025 16:45:22 +0100 Subject: [PATCH 7/8] setting the branch to main --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 67294e8..958d0de 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: Kernel CI on: push: - branches: [ ci/build ] + branches: [ main ] pull_request: branches: [ main ] From fec0e14be4f276b56b0da514be1acbc92ff711cf Mon Sep 17 00:00:00 2001 From: piguycs Date: Fri, 21 Nov 2025 16:48:45 +0100 Subject: [PATCH 8/8] fixing the clippy lints, so they become good for merge --- src/allocator/tiered.rs | 2 +- src/kinit.rs | 2 +- src/vmem.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/allocator/tiered.rs b/src/allocator/tiered.rs index 1d81c0a..105a973 100644 --- a/src/allocator/tiered.rs +++ b/src/allocator/tiered.rs @@ -32,7 +32,7 @@ impl BuddySystem { /// # Safety /// This is safe as long as the `addr` is valid pub unsafe fn init(base: usize) -> Result { - if base % PAGE_SIZE != 0 { + if base.is_multiple_of(PAGE_SIZE) { return Err(AllocatorError::AddrNotAligned { addr: base, align: PAGE_SIZE, diff --git a/src/kinit.rs b/src/kinit.rs index e504d5f..f9a0d58 100644 --- a/src/kinit.rs +++ b/src/kinit.rs @@ -14,7 +14,7 @@ pub fn pre_kinit(balloc: &mut BitMapAlloc, fdt: fdt::Fdt) { let addr = balloc.alloc(STACK_PAGES); // the address we are returned is at the top of the allocated space, we need to go lower let stack_bottom = addr + STACK_SIZE; - sbi::hsm::start(id, _start as usize, stack_bottom); + sbi::hsm::start(id, _start as *const () as usize, stack_bottom); } } diff --git a/src/vmem.rs b/src/vmem.rs index e19862d..11060de 100644 --- a/src/vmem.rs +++ b/src/vmem.rs @@ -78,7 +78,7 @@ impl PTEntry { } } -pub fn init(balloc: &mut BitMapAlloc) -> Mapper { +pub fn init(balloc: &mut BitMapAlloc) -> Mapper<'_> { let tbl_addr = balloc.alloc(1); PAGE_TABLE.store(tbl_addr, Ordering::Relaxed); @@ -95,7 +95,7 @@ fn map( perms: Perms, pages: usize, ) -> Result<(), MapError> { - assert!((vaddr & 4096) % 4096 == 0); + assert!((vaddr & 4096).is_multiple_of(4096)); assert!(pages > 0); for i in 0..pages {