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
8 changes: 4 additions & 4 deletions libkernel/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub enum ProbeError {
NoInterrupts,

#[error("No parent interrupt controller in FDT")]
NoParentIntterupt,
NoParentInterrupt,

#[error("The specified interrupt parent isn't an interrupt controller")]
NotInterruptController,
Expand Down Expand Up @@ -57,7 +57,7 @@ pub enum IoError {
#[error("The requested I/O operation was out of bounds for the block device")]
OutOfBounds,

#[error("Courruption found in the filesystem metadata")]
#[error("Corruption found in the filesystem metadata")]
MetadataCorruption,
}

Expand Down Expand Up @@ -114,7 +114,7 @@ pub enum ExecError {
#[error("Invalid Script Format")]
InvalidScriptFormat,

#[error("Invalid Porgram Header Format")]
#[error("Invalid Program Header Format")]
InvalidPHdrFormat,
}

Expand Down Expand Up @@ -156,7 +156,7 @@ pub enum KernelError {
#[error("Not a tty")]
NotATty,

#[error("Fault errror during syscall")]
#[error("Fault error during syscall")]
Fault,

#[error("Not an open file descriptor")]
Expand Down
2 changes: 1 addition & 1 deletion libkernel/src/fs/filesystems/fat32/bpb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl BiosParameterBlock {

pub fn cluster_to_sectors(&self, cluster: Cluster) -> Result<impl Iterator<Item = Sector>> {
if cluster.0 < 2 {
warn!("Cannot conver sentinel cluster number");
warn!("Cannot convert sentinel cluster number");
Err(FsError::InvalidFs.into())
} else {
let root_sector = Sector(
Expand Down
2 changes: 1 addition & 1 deletion libkernel/src/fs/filesystems/fat32/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl<T: Fat32Operations> Fat32Reader<T> {
}
}

// The bounds checks on `effective_buf` throughout the loops ensure that
// The bounds check on `effective_buf` throughout the loops ensure that
// the final `read_sector` call will be passed a smaller slice,
// correctly reading only the remaining bytes and handling the tail
// misalignment automagically. See `self.fs.read_sector`.
Expand Down
2 changes: 1 addition & 1 deletion libkernel/src/fs/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl Path {
/// ```
pub fn strip_prefix(&self, base: &Path) -> Option<&Path> {
if self.inner.starts_with(&base.inner) {
// If the prefixes are the same and they have the same length, the
// If the prefixes are the same, and they have the same length, the
// whole string is the prefix.
if base.inner.len() == self.inner.len() {
return Some(Path::new(""));
Expand Down
2 changes: 1 addition & 1 deletion libkernel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub trait UserAddressSpace: Send + Sync {
/// space are flushed.
fn activate(&self);

/// Decativate this address space for the current CPU.
/// Deactivate this address space for the current CPU.
///
/// This should be called to leave the CPU without any current process
/// state. Used on process termination code-paths.
Expand Down
4 changes: 2 additions & 2 deletions libkernel/src/memory/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl PageFrame {
}
}

/// A conveniance wrapper for dealing with single-page allocaitons.
/// A convenience wrapper for dealing with single-page allocations.
pub struct ClaimedPage<A: CpuOps, G: PageAllocGetter<A>, T: AddressTranslator<()>>(
PageAllocation<'static, A>,
PhantomData<G>,
Expand Down Expand Up @@ -82,7 +82,7 @@ impl<A: CpuOps, G: PageAllocGetter<A>, T: AddressTranslator<()>> ClaimedPage<A,
/// # Safety
///
/// Ensure that the calling context does indeed own this page. Otherwise,
/// the page may be free'd when it's owned by another context.
/// the page may be freed when it's owned by another context.
pub unsafe fn from_pfn(pfn: PageFrame) -> Self {
Self(
unsafe {
Expand Down
2 changes: 1 addition & 1 deletion libkernel/src/memory/page_alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ pub mod tests {
fixture.assert_free_list_counts(&expected_counts);
}

/// Tests the allocation of a multi-page block and verifies head/tail metadata.
/// Tests the allocation of a multipage block and verifies head/tail metadata.
#[test]
fn alloc_multi_page_block() {
let fixture = TestFixture::new(&[(0, (1 << (MAX_ORDER + PAGE_SHIFT)) * 2)], &[]);
Expand Down
6 changes: 3 additions & 3 deletions libkernel/src/memory/proc_vm/vmarea.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ impl VMAPermissions {
}
}

/// Describes the kind of access that occured during a page fault.
/// Describes the kind of access that occurred during a page fault.
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum AccessKind {
/// The CPU attempted to read the faulting address.
Read,
/// The CPU attempted to write to the faulting address.
Write,
/// The CPU attempted to execute the instruciton at the faulting address.
/// The CPU attempted to execute the instruction at the faulting address.
Execute,
}

Expand Down Expand Up @@ -199,7 +199,7 @@ impl VMArea {
/// memory permissions.
///
/// Note: If a program header's VA isn't page-aligned this function will
/// align it down and addjust the offset and size accordingly.
/// align it down and adjust the offset and size accordingly.
///
/// # Arguments
/// * `f`: A handle to the ELF file's inode.
Expand Down
2 changes: 1 addition & 1 deletion libkernel/src/sync/condvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl<S, C: CpuOps> CondVar<S, C> {
/// # Arguments
/// * `predicate`: A closure that checks the condition in the underlying
/// state. It should return `None` to continue waiting, or `Some(T)` to
/// stop waitng and yield T to the caller.
/// stop waiting and yield T to the caller.
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub fn wait_until<T, F>(&self, predicate: F) -> impl Future<Output = T> + use<T, S, C, F>
where
Expand Down
5 changes: 3 additions & 2 deletions libkernel/src/sync/per_cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl<G, CPU: CpuOps> IrqGuard<G, CPU> {

impl<G, CPU: CpuOps> Drop for IrqGuard<G, CPU> {
fn drop(&mut self) {
// Enaure we drop the refcell guard prior to restoring interrupts.
// Ensure we drop the refcell guard prior to restoring interrupts.
unsafe { ManuallyDrop::drop(&mut self.guard) };

CPU::restore_interrupt_state(self.flags);
Expand Down Expand Up @@ -132,7 +132,8 @@ impl<T: Send, CPU: CpuOps> PerCpu<T, CPU> {

/// Returns a reference to the underlying datakj for the current CPU.
///
/// # Panics Panics if the `PerCpu` variable has not been initialized.
/// # Panics
/// Panics if the `PerCpu` variable has not been initialized.
fn get_cell(&self) -> &RefCell<T> {
let id = CPU::id();
let base_ptr = self.ptr.load(Ordering::Acquire);
Expand Down
2 changes: 1 addition & 1 deletion src/arch/arm64/boot/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ pub fn setup_stack_and_heap(pgtbl_base: TPA<PgTableArray<L0Table>>) -> Result<VA
HEAP_ALLOCATOR.0.lock_save_irq().init(
heap_virt_region.start_address().as_ptr_mut().cast(),
heap_virt_region.size(),
)
);
};

Ok(stack_virt_region.end_address())
Expand Down
2 changes: 1 addition & 1 deletion src/arch/arm64/boot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub(super) mod secondary;

global_asm!(include_str!("start.s"));

/// Stage 1 Initialize of the system architechture.
/// Stage 1 Initialize of the system architecture.
///
/// This function is called by the main primary CPU with the other CPUs parked.
/// All interrupts should be disabled, the ID map setup in TTBR0 and the highmem
Expand Down
6 changes: 3 additions & 3 deletions src/arch/arm64/boot/secondary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn prepare_for_secondary_entry() -> Result<(PA, PA)> {
.ok_or(KernelError::Other("Idmap not set"))?,
start_fn: VA::from_value(arch_init_secondary as *const () as usize),
exception_ret: VA::from_value(&exception_return as *const _ as usize),
})
});
};

Ok((entry_fn, ctx))
Expand Down Expand Up @@ -186,7 +186,7 @@ fn cpu_node_iter() -> impl Iterator<Item = fdt_parser::Node<'static>> {
pub fn boot_secondaries() {
for cpu_node in cpu_node_iter() {
if let Err(e) = do_boot_secondary(cpu_node) {
log::warn!("Failed to boot secondary: {}", e);
log::warn!("Failed to boot secondary: {e}");
}
}
}
Expand All @@ -204,7 +204,7 @@ pub fn save_idmap(addr: PA) {
pub fn secondary_booted() {
let id = ArchImpl::id();

info!("CPU {} online.", id);
info!("CPU {id} online.");

SECONDARY_BOOT_FLAG.store(true, Ordering::Release);
}
Expand Down
2 changes: 1 addition & 1 deletion src/arch/arm64/memory/fault.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn handle_uacess_abort(exception: Exception, info: AbortIss, state: &mut Excepti
match run_mem_fault_handler(exception, info) {
// We mapped in a page, the uacess handler can proceed.
Ok(FaultResolution::Resolved) => (),
// If the fault coldn't be resolved, signal to the uacess fixup that
// If the fault couldn't be resolved, signal to the uacess fixup that
// the abort failed.
Ok(FaultResolution::Denied) => {
state.x[0] = UAccessResult::AbortDenied as _;
Expand Down
4 changes: 2 additions & 2 deletions src/arch/arm64/memory/fixmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl Fixmap {

let mut phys_region = PhysMemoryRegion::new(fdt_ptr.to_untyped(), sz);
let mut va = FIXMAP_BASE;
let invaldator = AllEl1TlbInvalidator::new();
let invalidator = AllEl1TlbInvalidator::new();

while phys_region.size() > 0 {
L3Table::from_ptr(TVA::from_ptr_mut(&mut self.l3[0] as *mut _)).set_desc(
Expand All @@ -144,7 +144,7 @@ impl Fixmap {
MemoryType::Normal,
PtePermissions::ro(false),
),
&invaldator,
&invalidator,
);

phys_region = phys_region.add_pages(1);
Expand Down
2 changes: 1 addition & 1 deletion src/arch/arm64/memory/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ unsafe impl GlobalAlloc for SpinlockHeap {
unsafe {
self.0
.lock_save_irq()
.deallocate(NonNull::new_unchecked(ptr), layout)
.deallocate(NonNull::new_unchecked(ptr), layout);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/arch/arm64/memory/uaccess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ fn do_copy_from_user(
lateout("x3") work_vtable,
// Clobbers
out("lr") _, out("x4") _
)
);
}

(
Expand Down Expand Up @@ -205,7 +205,7 @@ impl Future for Arm64CopyStrnFromUser {
lateout("x3") work_vtable,
// Clobbers
out("lr") _, out("x4") _
)
);
}

(
Expand Down Expand Up @@ -266,7 +266,7 @@ impl Future for Arm64CopyToUser {
lateout("x3") work_vtable,
// Clobbers
out("lr") _, out("x4") _
)
);
}
(
UAccessResult::from(status),
Expand Down
2 changes: 1 addition & 1 deletion src/arch/arm64/proc/idle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn create_idle_task() -> OwnedTask {
.cast::<u8>()
.as_ptr_mut(),
code_sz,
)
);
};

let mut addr_space = <ArchImpl as VirtualMemory>::ProcessAddressSpace::new().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/console/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub fn set_active_console(
let buf_contents = unsafe { (*addr_of_mut!(EARLY_BOOT_BUFFER)).data() };

if let Ok(s) = str::from_utf8(buf_contents) {
let _ = console.write_fmt(format_args!("{}", s));
let _ = console.write_fmt(format_args!("{s}"));
}
}

Expand Down
7 changes: 2 additions & 5 deletions src/drivers/fdt_prober.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub fn probe_for_fdt_devices() {
}
Err(e) => {
// A fatal error occurred during probe.
error!("Fatal error while probing device \"{}\": {}", desc, e);
error!("Fatal error while probing device \"{desc}\": {e}");
}
}
}
Expand All @@ -89,10 +89,7 @@ pub fn probe_for_fdt_devices() {
// If we made no progress in a full pass, we are done (or have an unresolvable dependency).
if !progress_made && !to_probe.is_empty() {
for desc in &to_probe {
warn!(
"Could not probe device \"{}\" due to missing dependencies.",
desc
);
warn!("Could not probe device \"{desc}\" due to missing dependencies.");
}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/fs/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl Inode for DevFsINode {
async fn getattr(&self) -> Result<FileAttr> {
let mut attr = self.attr.lock_save_irq().clone();
if let InodeKind::CharDevice { device_id } = self.kind {
attr.file_type = FileType::CharDevice(device_id)
attr.file_type = FileType::CharDevice(device_id);
}
Ok(attr)
}
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/fs/proc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ Threads:\t{tasks}\n",
let mut output = String::new();
output.push_str(&format!("{} ", task.process.tgid.0)); // pid
output.push_str(&format!("({}) ", name.as_str())); // comm
output.push_str(&format!("{} ", state)); // state
output.push_str(&format!("{state} ")); // state
output.push_str(&format!("{} ", 0)); // ppid
output.push_str(&format!("{} ", 0)); // pgrp
output.push_str(&format!("{} ", task.process.sid.lock_save_irq().value())); // session
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub unsafe fn run_initcalls() {
let init_func = &*current;
// Call each driver's init function
if let Err(e) = init_func(&mut bus, &mut dm) {
error!("A driver failed to initialize: {}", e);
error!("A driver failed to initialize: {e}");
}

current = current.add(1);
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/interrupts/arm_gic_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,7 @@ pub fn gic_v2_probe(_dm: &mut DriverManager, d: DeviceDescriptor) -> Result<Arc<
};

info!(
"ARM Gic V2 initialising: distributor_regs: {:?} cpu_regs: {:?}",
distributor_mem, cpu_mem
"ARM Gic V2 initialising: distributor_regs: {distributor_mem:?} cpu_regs: {cpu_mem:?}",
);

let dev = Arc::new_cyclic(|this| {
Expand Down
16 changes: 6 additions & 10 deletions src/drivers/interrupts/arm_gic_v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,7 @@ impl ArmGicV3 {
rdist.WAKER.set(rdist.WAKER.get() & !(1 << 1));
while rdist.WAKER.get() & (1 << 2) != 0 {}

info!(
"GICv3: Redistributor for core {} (MPIDR=0x{:x}) is awake.",
core_id, mpidr
);
info!("GICv3: Redistributor for core {core_id} (MPIDR=0x{mpidr:x}) is awake.",);

// 2. Configure PPIs and SGIs for this core SGIs (0-15) are Group 0,
// PPIs (16-31) are Group 1
Expand All @@ -263,7 +260,7 @@ impl ArmGicV3 {
// 5. Enable interrupt group 1 at the CPU interface
set_icc_igrpen1_el1(1);

info!("GICv3: CPU interface for core {} enabled.", core_id);
info!("GICv3: CPU interface for core {core_id} enabled.");
Ok(())
}

Expand All @@ -272,7 +269,7 @@ impl ArmGicV3 {
// This is a simplified search. A full implementation should parse the
// GICR's TYPER to find the correct redistributor for a given MPIDR. For
// systems where cores and redistributors are mapped linearly (like QEMU
// virt) this should be fine, but we do an assert just to be ensure.
// virt) this should be fine, but we do an assert just to ensure.
let core_id = (mpidr & 0xFF) + ((mpidr >> 8) & 0xFF) * 4; // Simple linear core ID
let rdist_offset = core_id as usize * self.rdist_stride;
let rdist_addr = self.rdist_base.value() + rdist_offset;
Expand Down Expand Up @@ -401,7 +398,7 @@ impl InterruptController for ArmGicV3 {

fn enable_core(&mut self, cpu_id: usize) {
if let Err(e) = self.init_core(cpu_id) {
warn!("Failed to enable interrupts for core {}: {}", cpu_id, e);
warn!("Failed to enable interrupts for core {cpu_id}: {e}");
return;
}

Expand Down Expand Up @@ -442,7 +439,7 @@ impl InterruptController for ArmGicV3 {
0x4 => LevelHigh,
// GICv3 simplified trigger types for SPIs. Level-low and falling-edge are less common.
_ => {
warn!("Unsupported GIC interrupt trigger flag: {}", flags);
warn!("Unsupported GIC interrupt trigger flag: {flags}");
LevelHigh // Default to a safe value
}
};
Expand Down Expand Up @@ -488,8 +485,7 @@ pub fn gic_v3_probe(_dm: &mut DriverManager, d: DeviceDescriptor) -> Result<Arc<
};

info!(
"ARM GICv3 found: dist @ {:?}, rdist @ {:?} (stride=0x{:x})",
dist_region, rdist_region, rdist_stride
"ARM GICv3 found: dist @ {dist_region:?}, rdist @ {rdist_region:?} (stride=0x{rdist_stride:x})",
);

let mut gic = ArmGicV3::new(dist_mem, rdist_mem, rdist_stride)?;
Expand Down
Loading