Add page fault handler that does nothing, I am tired
Continuous integration / build (push) Failing after 38m24s

This commit is contained in:
2025-02-22 05:00:18 +00:00
parent 2b2219f5be
commit 40ad5dbbf4
3 changed files with 71 additions and 4 deletions
+15 -1
View File
@@ -1,7 +1,8 @@
use lib_ascii::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};
@@ -12,6 +13,7 @@ static IDT: Lazy<InterruptDescriptorTable> = Lazy::new(|| {
idt.double_fault.set_handler_fn(double_fault_handler);
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);
@@ -85,3 +87,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();
}