diff --git a/src/arch/x86_64/idt.rs b/src/arch/x86_64/idt.rs index 9c9f1286bbfa1191450e60f8a1a1588a6a2ee6e9..af15634086f6e4bf232ebc092b236b386279a443 100644 --- a/src/arch/x86_64/idt.rs +++ b/src/arch/x86_64/idt.rs @@ -30,7 +30,7 @@ extern "x86-interrupt" fn double_fault(stack: InterruptStackFrame, ec: u64) -> ! crate::qemu::_print(format_args_nl!("INT: Double fault ({ec})\n{stack:#?}")); - let mut sp = stack.stack_pointer.as_ptr() as *const [u8; 8]; + let sp = stack.stack_pointer.as_ptr() as *const [u8; 8]; for i in 0isize..256 { let sp = unsafe { sp.offset(i) }; let bytes: [u8; 8] = unsafe { *sp }; diff --git a/src/arch/x86_64/limine/framebuffer.rs b/src/arch/x86_64/limine/framebuffer.rs index 08b9332a133aded9658781f44c8266096d98383e..d7e874e38622c57aaf0943b0a370193273f46e75 100644 --- a/src/arch/x86_64/limine/framebuffer.rs +++ b/src/arch/x86_64/limine/framebuffer.rs @@ -15,7 +15,7 @@ pub fn init() { .get_response() .get() .into_iter() - .flat_map(|resp| resp.framebuffers().into_iter()) + .flat_map(|resp| resp.framebuffers().iter()) .find_map(|fb| { if fb.bpp != 32 { return None; diff --git a/src/main.rs b/src/main.rs index e7e77af320f6eff6503a4ce38c4ee4f901459609..9bdb52c3685dba97871dfcd96ca024c51bcf86ca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ use spin::Mutex; use crate::{ term::escape::encode::EscapeEncoder, - video::framebuffer::{get_fbo, Color, FBO}, + video::framebuffer::{get_fbo, Color}, }; // @@ -31,7 +31,7 @@ pub mod video; // /// Name of the kernel -pub static KERNEL: &'static str = if cfg!(test) { +pub static KERNEL: &str = if cfg!(test) { "Hyperion-Testing" } else { "Hyperion" diff --git a/src/qemu.rs b/src/qemu.rs index a2e715f590563c04d614882dc75e0b52faa02c71..d16e757c210038a526f942cff4f71952dac0c82a 100644 --- a/src/qemu.rs +++ b/src/qemu.rs @@ -13,6 +13,11 @@ pub fn _print(args: Arguments) { } /// Unlocks the COM1 writer IF it is locked by this exact thread +/// +/// # Safety +/// +/// This function is extremely unsafe and should only be used by the double fault handler when the +/// same thread had locked this pub unsafe fn unlock() { // TODO: SMP // if COM1_LOCKER.load(Ordering::SeqCst) != crate::THREAD { diff --git a/src/term/escape/decode.rs b/src/term/escape/decode.rs index 9ce4e1ba725f8170d112bc2ab94a07e46b25deb6..d359b980a594158e4a3818fa2bf43e55dc0f924c 100644 --- a/src/term/escape/decode.rs +++ b/src/term/escape/decode.rs @@ -36,13 +36,13 @@ impl EscapeDecoder { match (self.len, byte) { (0, b'\x1B') => { self.len += 1; - self.buf[0 as usize] = byte; + self.buf[0_usize] = byte; DecodedPart::None } (0, _) => DecodedPart::Byte(byte), (1, b'[') => { self.len += 1; - self.buf[1 as usize] = byte; + self.buf[1_usize] = byte; DecodedPart::None } (i, b'm') => { @@ -103,6 +103,4 @@ impl EscapeDecoder { // longest supported: "\x1B[48;2;255;255;255m" const LONGEST_ESCAPE: usize = "\x1B[48;2;255;255;255m".len(); -const LONGEST_ESCAPE_PREV: usize = LONGEST_ESCAPE - 1; -const LONGEST_ESCAPE_U8: u8 = LONGEST_ESCAPE as u8; const LONGEST_ESCAPE_PREV_U8: u8 = LONGEST_ESCAPE as u8 - 1; diff --git a/src/testfw.rs b/src/testfw.rs index a89324ce0f3d82bb6154664e4f3b4571b6230bcd..6e22a506c246f96fb21cbff157a6a88d354588bc 100644 --- a/src/testfw.rs +++ b/src/testfw.rs @@ -1,4 +1,4 @@ -use crate::{arch::done, print, println}; +use crate::{print, println}; use core::{any::type_name, panic::PanicInfo}; use x86_64::instructions::port::Port; diff --git a/src/video/framebuffer.rs b/src/video/framebuffer.rs index 1d6d838b7128d4e70d1d22830dabf59ab6be68b7..5943a0373d79e4dc71c7a373b2ea804369e83c9b 100644 --- a/src/video/framebuffer.rs +++ b/src/video/framebuffer.rs @@ -1,9 +1,8 @@ use super::font::FONT; use core::{ - fmt, ops::{Deref, DerefMut}, }; -use spin::{Lazy, Mutex, MutexGuard, Once}; +use spin::{Mutex, MutexGuard, Once}; // @@ -67,7 +66,7 @@ impl Framebuffer { pub fn scroll(&mut self, h: usize) { for y in h..self.height { - let two_rows = &mut self.buf[(y - 1) * self.info.pitch..(y + 1) * self.info.pitch]; + let _two_rows = &mut self.buf[(y - 1) * self.info.pitch..(y + 1) * self.info.pitch]; self.buf.copy_within( y * self.info.pitch..(y + 1) * self.info.pitch, diff --git a/src/video/logger.rs b/src/video/logger.rs index e1ef1a8300e80dba6404c463c86c8abff76518c1..28128541c5517e82a5490ccc10e9e6f1fe18e4f6 100644 --- a/src/video/logger.rs +++ b/src/video/logger.rs @@ -2,10 +2,10 @@ use crate::term::escape::decode::{DecodedPart, EscapeDecoder}; use super::{ font::FONT, - framebuffer::{get_fbo, Color, Framebuffer, FBO}, + framebuffer::{get_fbo, Color, Framebuffer}, }; use core::fmt::{self, Arguments, Write}; -use spin::{Lazy, Mutex, MutexGuard, Once}; +use spin::{Mutex, MutexGuard}; //