diff options
| -rw-r--r-- | kernel/src/init/int.rs | 19 | ||||
| -rw-r--r-- | report.typ | 3 |
2 files changed, 12 insertions, 10 deletions
diff --git a/kernel/src/init/int.rs b/kernel/src/init/int.rs index 0300d87..2512434 100644 --- a/kernel/src/init/int.rs +++ b/kernel/src/init/int.rs @@ -3,17 +3,16 @@ use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame}; use crate::printlnk; -static IDT: LazyLock<InterruptDescriptorTable> = LazyLock::new(|| { - let mut idt = InterruptDescriptorTable::new(); - idt.breakpoint.set_handler_fn(breakpoint_handler); - idt.double_fault.set_handler_fn(double_fault_handler); - idt -}); +pub static IDT: LazyLock<InterruptDescriptorTable> = LazyLock::new( + || { + let mut idt = InterruptDescriptorTable::new(); + idt.breakpoint.set_handler_fn(breakpoint_handler); + idt.double_fault.set_handler_fn(double_fault_handler); + idt + }, +); -extern "x86-interrupt" fn double_fault_handler( - stack_frame: InterruptStackFrame, - error_code: u64, -) -> ! { +extern "x86-interrupt" fn double_fault_handler(stack_frame: InterruptStackFrame, error_code: u64) -> ! { panic!("EXCEPTION: DOUBLE FAULT\n{stack_frame:#?}\nERROR CODE:{error_code}"); } @@ -22,3 +22,6 @@ thanks ("https://www.reddit.com/r/cpp/comments/1w6us70/optimizing_a_spinlock/")[ == panic & backtrace thanks ("https://eli.thegreenplace.net/2011/02/07/how-debuggers-work-part-3-debugging-information")[Eli] teaching basic concepts and ("https://wiki.osdev.org/Stack_Trace")[osdev] for a practical example + +== exceptions +used x86_64 crate however still read ("https://os.phil-opp.com/edition-1/extra/naked-exceptions/")[this blog] to understand |
