Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Kernel CI

on:
push:
branches: [ main ]
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
with:
components: rust-src, clippy

# - name: Get just
# uses: taiki-e/install-action@just

- 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

# - name: Test
# run: cargo test --verbose

- name: Clippy
run: cargo clippy --all-features -- -D warnings
2 changes: 1 addition & 1 deletion src/allocator/tiered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl BuddySystem {
/// # Safety
/// This is safe as long as the `addr` is valid
pub unsafe fn init(base: usize) -> Result<Self, AllocatorError> {
if base % PAGE_SIZE != 0 {
if base.is_multiple_of(PAGE_SIZE) {
return Err(AllocatorError::AddrNotAligned {
addr: base,
align: PAGE_SIZE,
Expand Down
2 changes: 1 addition & 1 deletion src/kinit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/vmem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 {
Expand Down