From d3d52c974a75d6c8be4983b4840aa2adddb1615b Mon Sep 17 00:00:00 2001 From: Erin Date: Sat, 7 Jan 2023 22:18:47 +0100 Subject: [PATCH] clippy and reformat --- kernel/src/allocator.rs | 4 ++-- kernel/src/arch/x86_64/mod.rs | 9 ++++----- repbuild/src/main.rs | 3 +-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/kernel/src/allocator.rs b/kernel/src/allocator.rs index 67dd39b..4c73d1c 100644 --- a/kernel/src/allocator.rs +++ b/kernel/src/allocator.rs @@ -148,7 +148,7 @@ impl Heap { aligned_first_chunk + chunks_needed <= first_chunk + chunks_needed + chunk_alignment ); - let header: *mut Header = unsafe { mem::transmute(addr) }; + let header = add as *mut Header; unsafe { (*header).size_in_chunks = chunks_needed; } @@ -340,5 +340,5 @@ unsafe impl Send for Heap {} #[alloc_error_handler] fn alloc_error_handler(layout: alloc::alloc::Layout) -> ! { - loop {} + crate::arch::sloop() } diff --git a/kernel/src/arch/x86_64/mod.rs b/kernel/src/arch/x86_64/mod.rs index fa6e153..5a6814e 100644 --- a/kernel/src/arch/x86_64/mod.rs +++ b/kernel/src/arch/x86_64/mod.rs @@ -13,15 +13,11 @@ static SERIAL_CONSOLE: Mutex = Mutex::new(unsafe { SerialPort::new(0 #[no_mangle] unsafe extern "C" fn _kernel_start() -> ! { - static HDHM_REQ: LimineHhdmRequest = LimineHhdmRequest::new(0); - static MMAP_REQ: LimineMmapRequest = LimineMmapRequest::new(0); - static KFILE_REQ: LimineKernelFileRequest = LimineKernelFileRequest::new(0); - static MOD_REQ: LimineModuleRequest = LimineModuleRequest::new(0); - SERIAL_CONSOLE.lock().init(); crate::logger::init().expect("failed to set logger"); log::info!("Initialising AKern {}", crate::VERSION); + static HDHM_REQ: LimineHhdmRequest = LimineHhdmRequest::new(0); memory::init_pt(VirtAddr::new( HDHM_REQ .get_response() @@ -30,6 +26,7 @@ unsafe extern "C" fn _kernel_start() -> ! { .offset, )); + static MMAP_REQ: LimineMmapRequest = LimineMmapRequest::new(0); memory::init_falloc( MMAP_REQ .get_response() @@ -42,6 +39,8 @@ unsafe extern "C" fn _kernel_start() -> ! { gdt::init(); interrupts::init(); + static KFILE_REQ: LimineKernelFileRequest = LimineKernelFileRequest::new(0); + static MOD_REQ: LimineModuleRequest = LimineModuleRequest::new(0); crate::kmain::kmain( KFILE_REQ .get_response() diff --git a/repbuild/src/main.rs b/repbuild/src/main.rs index 0a6d7da..bfd139e 100644 --- a/repbuild/src/main.rs +++ b/repbuild/src/main.rs @@ -1,7 +1,6 @@ use error_stack::{bail, report, Context, IntoReport, Result, ResultExt}; use fatfs::{FileSystem, FormatVolumeOptions, FsOptions, ReadWriteSeek}; -use nix::fcntl::FallocateFlags; -use std::{fmt::Display, fs::File, io, os::fd::AsRawFd, path::Path, process::Command}; +use std::{fmt::Display, fs::File, io, path::Path, process::Command}; fn main() -> Result<(), Error> { env_logger::init();