Merge remote-tracking branch 'refs/remotes/origin/dev' into dev

merging into dev
This commit is contained in:
2025-02-22 15:41:54 +00:00
7 changed files with 79 additions and 11 deletions
+15 -1
View File
@@ -1,7 +1,8 @@
use lib_ascii::{print, println_log};
use lib_serial::serial_println;
use x86_64::instructions::port::Port;
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame};
use x86_64::registers::control::Cr2;
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame, PageFaultErrorCode};
use pic8259::ChainedPics;
use spin::{Lazy, Mutex};
@@ -20,6 +21,7 @@ static IDT: Lazy<InterruptDescriptorTable> = Lazy::new(|| {
idt.general_protection_fault
.set_handler_fn(general_protection_fault_handler);
idt.page_fault.set_handler_fn(page_fault_handler);
idt[InterruptIndex::Timer.as_u8()].set_handler_fn(timer_interrupt_handler);
idt[InterruptIndex::Keyboard.as_u8()].set_handler_fn(keyboard_interrupt_handler);
@@ -116,3 +118,15 @@ extern "x86-interrupt" fn timer_interrupt_handler(_stack_frame: InterruptStackFr
.notify_end_of_interrupt(InterruptIndex::Timer.as_u8());
}
}
extern "x86-interrupt" fn page_fault_handler(
stack_frame: InterruptStackFrame,
error_code: PageFaultErrorCode,
) {
serial_println!("Exception: Page Fault");
serial_println!("Accessed Address: {:?}", Cr2::read());
serial_println!("Error Code: {:?}", error_code);
serial_println!("{:#?}", stack_frame);
crate::hcf();
}