diff --git a/src/tasking.rs b/src/tasking.rs index eaf9afa..5479a44 100644 --- a/src/tasking.rs +++ b/src/tasking.rs @@ -1,8 +1,9 @@ use crate::{ - gdt, println, qemu_exit, virtual_memory::{ASpaceMutex, AddressSpace, PagingError, KERNEL_SPACE} + gdt, println, qemu_exit, + virtual_memory::{ASpaceMutex, AddressSpace, PagingError, KERNEL_SPACE}, }; use alloc::{borrow::ToOwned, boxed::Box, collections::VecDeque, ffi::CString, vec::Vec}; -use core::{alloc::Layout, arch::asm, ptr::addr_of, ffi::CStr}; +use core::{alloc::Layout, arch::asm, ffi::CStr, ptr::addr_of}; use crossbeam_queue::SegQueue; use slab::Slab; use spin::{Lazy, Mutex}; @@ -147,22 +148,31 @@ impl Tasking { PageTableFlags::USER_ACCESSIBLE, )?; let arguments = arguments.iter().map(|arg| (*arg).to_owned()).collect::>(); - #[expect(clippy::unwrap_used, reason = "This fails if the byte size of the array exceeds isize::MAX, which with 48-bit virtual addresses cannot happen")] + #[expect( + clippy::unwrap_used, + reason = "This fails if the byte size of the array exceeds isize::MAX, which with 48-bit virtual addresses cannot happen" + )] let mut args_layout = Layout::array::<*const u8>(arguments.len()).unwrap(); let mut arg_offsets = Vec::new(); for argument in &arguments { - #[expect(clippy::unwrap_used, reason = "This fails if the total size of the layout exceeds isize::MAX, which with 48-bit virtual addresses cannot happen")] + #[expect( + clippy::unwrap_used, + reason = "This fails if the total size of the layout exceeds isize::MAX, which with 48-bit virtual addresses cannot happen" + )] let (new_layout, offset) = args_layout.extend(Layout::for_value(argument.to_bytes_with_nul())).unwrap(); args_layout = new_layout; arg_offsets.push(offset); } args_layout = { - #[expect(clippy::unwrap_used, reason = "This fails if the aligned size of the layout exceeds isize::MAX, which with 48-bit virtual addresses cannot happen")] + #[expect( + clippy::unwrap_used, + reason = "This fails if the aligned size of the layout exceeds isize::MAX, which with 48-bit virtual addresses cannot happen" + )] args_layout.align_to(4096).unwrap().pad_to_align() }; - let user_arg_mem = address_space - .map_free(args_layout.size() / 4096, PageTableFlags::USER_ACCESSIBLE)?; + let user_arg_mem = + address_space.map_free(args_layout.size() / 4096, PageTableFlags::USER_ACCESSIBLE)?; address_space.run(|| unsafe { let mut ptr_ptr: *mut *const u8 = user_arg_mem.cast(); for (&offset, argument) in arg_offsets.iter().zip(arguments.iter()) {