Skip to content

Commit 7fd4d79

Browse files
authored
Merge pull request #2 from kleineOS/ci/build
Adding CI for building the kernel and checking Clippy lints
2 parents 470d1b2 + fec0e14 commit 7fd4d79

4 files changed

Lines changed: 46 additions & 4 deletions

File tree

.github/workflows/build.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Kernel CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Install Rust
18+
uses: dtolnay/rust-toolchain@nightly
19+
with:
20+
components: rust-src, clippy
21+
22+
# - name: Get just
23+
# uses: taiki-e/install-action@just
24+
25+
- name: Cache cargo
26+
uses: actions/cache@v4
27+
with:
28+
path: |
29+
~/.cargo/registry
30+
~/.cargo/git
31+
target
32+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
33+
restore-keys: ${{ runner.os }}-cargo-
34+
35+
- name: Build
36+
run: cargo build --verbose
37+
38+
# - name: Test
39+
# run: cargo test --verbose
40+
41+
- name: Clippy
42+
run: cargo clippy --all-features -- -D warnings

src/allocator/tiered.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl BuddySystem {
3232
/// # Safety
3333
/// This is safe as long as the `addr` is valid
3434
pub unsafe fn init(base: usize) -> Result<Self, AllocatorError> {
35-
if base % PAGE_SIZE != 0 {
35+
if base.is_multiple_of(PAGE_SIZE) {
3636
return Err(AllocatorError::AddrNotAligned {
3737
addr: base,
3838
align: PAGE_SIZE,

src/kinit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn pre_kinit(balloc: &mut BitMapAlloc, fdt: fdt::Fdt) {
1414
let addr = balloc.alloc(STACK_PAGES);
1515
// the address we are returned is at the top of the allocated space, we need to go lower
1616
let stack_bottom = addr + STACK_SIZE;
17-
sbi::hsm::start(id, _start as usize, stack_bottom);
17+
sbi::hsm::start(id, _start as *const () as usize, stack_bottom);
1818
}
1919
}
2020

src/vmem.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl PTEntry {
7878
}
7979
}
8080

81-
pub fn init(balloc: &mut BitMapAlloc) -> Mapper {
81+
pub fn init(balloc: &mut BitMapAlloc) -> Mapper<'_> {
8282
let tbl_addr = balloc.alloc(1);
8383
PAGE_TABLE.store(tbl_addr, Ordering::Relaxed);
8484

@@ -95,7 +95,7 @@ fn map(
9595
perms: Perms,
9696
pages: usize,
9797
) -> Result<(), MapError> {
98-
assert!((vaddr & 4096) % 4096 == 0);
98+
assert!((vaddr & 4096).is_multiple_of(4096));
9999
assert!(pages > 0);
100100

101101
for i in 0..pages {

0 commit comments

Comments
 (0)