diff options
| author | Natasha Moongrave <natasha@256phi.eu> | 2026-03-27 21:49:11 +0100 |
|---|---|---|
| committer | Natasha Moongrave <natasha@256phi.eu> | 2026-03-27 21:49:11 +0100 |
| commit | 2dda5a777bbec85d5ebe74fd0468700189a513e8 (patch) | |
| tree | 62b510ab4d6b6e0063a76c7e93da60bd5781b5c6 | |
| parent | 1f645efcf12191af26d0842699ab2633641a7b16 (diff) | |
Updated variable to be prefixed with _ to avoid rust unused variable compiler warning
| -rw-r--r-- | StrixKernel/src/interrupts.rs | 77 |
1 files changed, 36 insertions, 41 deletions
diff --git a/StrixKernel/src/interrupts.rs b/StrixKernel/src/interrupts.rs index 57797f1..9e245cc 100644 --- a/StrixKernel/src/interrupts.rs +++ b/StrixKernel/src/interrupts.rs @@ -1,11 +1,11 @@ // interrupts.rs -use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame}; use lazy_static::lazy_static; +use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame}; -use crate::println; -use crate::print; use crate::gdt; +use crate::print; +use crate::println; // EXCPETION INTERURPTS // @@ -36,22 +36,21 @@ pub fn init_idt() { } // Breakpoint exception -extern "x86-interrupt" fn breakpoint_handler( - stack_frame: InterruptStackFrame) -{ +extern "x86-interrupt" fn breakpoint_handler(stack_frame: InterruptStackFrame) { println!("EXCEPTION: BREAKPOINT\n{:#?}", stack_frame); } // Double fault exception extern "x86-interrupt" fn double_fault_handler( - stack_frame: InterruptStackFrame, _error_code: u64) -> ! -{ + stack_frame: InterruptStackFrame, + _error_code: u64, +) -> ! { panic!("EXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame); } // Page fault exception -use x86_64::structures::idt::PageFaultErrorCode; use crate::hlt_loop; +use x86_64::structures::idt::PageFaultErrorCode; extern "x86-interrupt" fn page_fault_handler( stack_frame: InterruptStackFrame, @@ -93,44 +92,42 @@ impl InterruptIndex { } } -extern "x86-interrupt" fn timer_interrupt_handler( - _stack_frame: InterruptStackFrame) -{ +extern "x86-interrupt" fn timer_interrupt_handler(_stack_frame: InterruptStackFrame) { //print!("."); - + unsafe { PICS.lock() .notify_end_of_interrupt(InterruptIndex::Timer.as_u8()); } } -extern "x86-interrupt" fn keyboard_interrupt_handler( - _stack_frame: InterruptStackFrame) -{ - use pc_keyboard::{layouts, DecodedKey, HandleControl, Keyboard, ScancodeSet1}; - use spin::Mutex; - use x86_64::instructions::port::Port; - - lazy_static! { - static ref KEYBOARD: Mutex<Keyboard<layouts::Us104Key, ScancodeSet1>> = - Mutex::new(Keyboard::new(ScancodeSet1::new(), - layouts::Us104Key, HandleControl::Ignore) - ); - } +extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStackFrame) { + use pc_keyboard::{DecodedKey, HandleControl, Keyboard, ScancodeSet1, layouts}; + use spin::Mutex; + use x86_64::instructions::port::Port; + + lazy_static! { + static ref KEYBOARD: Mutex<Keyboard<layouts::Us104Key, ScancodeSet1>> = + Mutex::new(Keyboard::new( + ScancodeSet1::new(), + layouts::Us104Key, + HandleControl::Ignore + )); + } + + let mut keyboard = KEYBOARD.lock(); + let mut port = Port::new(0x60); - let mut keyboard = KEYBOARD.lock(); - let mut port = Port::new(0x60); - - let scancode: u8 = unsafe { port.read() }; - if let Ok(Some(key_event)) = keyboard.add_byte(scancode) { - if let Some(key) = keyboard.process_keyevent(key_event) { - match key { - DecodedKey::Unicode(character) => print!("{}", character), - DecodedKey::RawKey(key) => {} //print!("{:?}", key), // Do not print controller key debug names like shift ctrl and super - // TODO: Add support for backspace - } + let scancode: u8 = unsafe { port.read() }; + if let Ok(Some(key_event)) = keyboard.add_byte(scancode) { + if let Some(key) = keyboard.process_keyevent(key_event) { + match key { + DecodedKey::Unicode(character) => print!("{}", character), + DecodedKey::RawKey(_key) => {} //print!("{:?}", key), // Do not print controller key debug names like shift ctrl and super + // TODO: Add support for backspace } } + } unsafe { PICS.lock() @@ -138,12 +135,10 @@ extern "x86-interrupt" fn keyboard_interrupt_handler( } } - - - // TESTS // #[test_case] fn test_breakpoint_exception() { // invoke a breakpoint exception x86_64::instructions::interrupts::int3(); -}
\ No newline at end of file +} + |
