diff --git a/kernel/src/arch/x86_64/cpu/msr.rs b/kernel/src/arch/x86_64/cpu/msr.rs index 0463b70..5dae062 100644 --- a/kernel/src/arch/x86_64/cpu/msr.rs +++ b/kernel/src/arch/x86_64/cpu/msr.rs @@ -1,4 +1,3 @@ -#![expect(unused)] use core::arch::x86_64::__cpuid; use spin::Lazy; use x86_64::registers::model_specific::Msr; diff --git a/kernel/src/arch/x86_64/cpu/port.rs b/kernel/src/arch/x86_64/cpu/port.rs index 6abf31f..7c3a67b 100644 --- a/kernel/src/arch/x86_64/cpu/port.rs +++ b/kernel/src/arch/x86_64/cpu/port.rs @@ -1,5 +1,4 @@ //! Functions for IO using ports. -#![expect(unused)] use core::arch::asm; /// Take a byte in from a port. diff --git a/kernel/src/arch/x86_64/dev/pic.rs b/kernel/src/arch/x86_64/dev/pic.rs index 944fb0a..9a253b2 100644 --- a/kernel/src/arch/x86_64/dev/pic.rs +++ b/kernel/src/arch/x86_64/dev/pic.rs @@ -1,4 +1,4 @@ -#![expect(unused)] +#![allow(clippy::missing_safety_doc)] use x86_64::instructions::port::Port; const CMD_INIT: u8 = 0x11; @@ -41,7 +41,8 @@ pub struct ChainedPics { } impl ChainedPics { - pub const unsafe fn new(offset1: u8, offset2: u8) -> Self { + /// Creates a new [`ChainedPics`]. + pub const fn new(offset1: u8, offset2: u8) -> Self { Self { pics: [ Pic { @@ -58,13 +59,8 @@ impl ChainedPics { } } - /// . - /// - /// # Safety - /// - /// . - pub const unsafe fn new_contiguous(primary_offset: u8) -> Self { - unsafe { Self::new(primary_offset, primary_offset + 8) } + pub const fn new_contiguous(primary_offset: u8) -> Self { + Self::new(primary_offset, primary_offset + 8) } /// Returns the initialize of this [`ChainedPics`]. diff --git a/kernel/src/arch/x86_64/gdt.rs b/kernel/src/arch/x86_64/gdt.rs index abf34dd..73b0d7a 100644 --- a/kernel/src/arch/x86_64/gdt.rs +++ b/kernel/src/arch/x86_64/gdt.rs @@ -1,4 +1,3 @@ -#![expect(unused)] use x86_64::{ VirtAddr, instructions::tables::load_tss, diff --git a/kernel/src/arch/x86_64/interrupts.rs b/kernel/src/arch/x86_64/interrupts.rs index f8be559..47e1d27 100644 --- a/kernel/src/arch/x86_64/interrupts.rs +++ b/kernel/src/arch/x86_64/interrupts.rs @@ -1,5 +1,3 @@ -#![expect(unused)] - use pic8259::ChainedPics; use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame}; diff --git a/kernel/src/arch/x86_64/memmap.rs b/kernel/src/arch/x86_64/memmap.rs index 5992a89..1df8437 100644 --- a/kernel/src/arch/x86_64/memmap.rs +++ b/kernel/src/arch/x86_64/memmap.rs @@ -47,7 +47,6 @@ pub static _KERNEL_PHYSICAL_MEMORY_OFFSET: Lazy<(u64, u64)> = Lazy::new(|| { /// # Panics /// /// Panics if the memory map was not found in MEMORY_MAP_REQUEST. -#[expect(unused)] pub fn get_memory_map() -> &'static MemoryMapResponse { MEMORY_MAP_REQUEST.get_response().map_or_else( || unreachable!("Could not fetch memory map from Limine."), diff --git a/kernel/src/graphics/writer.rs b/kernel/src/graphics/writer.rs index 8005e8b..e1abeb6 100644 --- a/kernel/src/graphics/writer.rs +++ b/kernel/src/graphics/writer.rs @@ -1,4 +1,3 @@ -#![expect(dead_code)] use core::fmt; use spin::{Lazy, Mutex}; use x86_64::instructions::interrupts; @@ -171,18 +170,21 @@ fn write(args: fmt::Arguments, fg: Colour, bg: Colour) { }); } +#[doc(hidden)] pub fn _print(args: fmt::Arguments) { x86_64::instructions::interrupts::without_interrupts(|| { write(args, Colour::White, Colour::Black); }) } +#[doc(hidden)] pub fn _print_err(args: fmt::Arguments) { x86_64::instructions::interrupts::without_interrupts(|| { write(args, Colour::Red, Colour::Black); }) } +#[doc(hidden)] pub fn _print_log(args: fmt::Arguments) { x86_64::instructions::interrupts::without_interrupts(|| { write(args, Colour::Yellow, Colour::Black); @@ -228,7 +230,7 @@ macro_rules! println { #[macro_export] macro_rules! print { - ($($arg:tt)*) => ($crate::_print(format_args!($($arg)*))); + ($($arg:tt)*) => ($crate::graphics::writer::_print(format_args!($($arg)*))); } #[macro_export] @@ -239,5 +241,5 @@ macro_rules! printlnerr { #[macro_export] macro_rules! printerr { - ($($arg:tt)*) => ($crate::_print_err(format_args!($($arg)*))); + ($($arg:tt)*) => ($crate::graphics::writer::_print_err(format_args!($($arg)*))); } diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index b3c3b50..238d92d 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -15,9 +15,9 @@ use core::arch::asm; use graphics::font::{FONT_SPLEEN_8X16, Font}; use limine::BaseRevision; -mod arch; -mod graphics; -mod io; +pub mod arch; +pub mod graphics; +pub mod io; /// Sets the base revision to the latest revision supported by the crate. /// See specification for further info. @@ -45,8 +45,10 @@ pub fn hcf() -> ! { } pub fn boot() -> Result<(), &'static str> { + println!("Test!"); + if !BASE_REVISION.is_supported() { - return Err("base revision not supported"); + return Err("Base Revision was not supported."); } Ok(())