first interrupt handler + setup IDT

This commit is contained in:
2025-02-22 01:06:55 +00:00
parent cb77883f4c
commit 1b313c67e0
8 changed files with 502 additions and 64 deletions
+22
View File
@@ -0,0 +1,22 @@
use lib_ascii::println_log;
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame};
use spin::Lazy;
static IDT: Lazy<InterruptDescriptorTable> = Lazy::new(|| {
let mut idt = InterruptDescriptorTable::new();
idt.breakpoint.set_handler_fn(breakpoint_handler);
idt
});
pub fn init_idt() {
IDT.load();
}
extern "x86-interrupt" fn breakpoint_handler(
stack_frame: InterruptStackFrame
) {
println_log!("Exception: Breakpoint\n{:#?}", stack_frame);
}