interrupts: page fault handler
This commit is contained in:
parent
346d3a9166
commit
fe69e31b91
|
@ -12,7 +12,7 @@ use pic8259::ChainedPics;
|
||||||
use qrcode::QrCode;
|
use qrcode::QrCode;
|
||||||
use seq_macro::seq;
|
use seq_macro::seq;
|
||||||
use spin::Lazy;
|
use spin::Lazy;
|
||||||
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame};
|
use x86_64::{structures::idt::{InterruptDescriptorTable, InterruptStackFrame, PageFaultErrorCode}, registers::control::Cr2};
|
||||||
|
|
||||||
use super::sloop;
|
use super::sloop;
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ static IDT: Lazy<InterruptDescriptorTable> = Lazy::new(|| {
|
||||||
});
|
});
|
||||||
|
|
||||||
idt.breakpoint.set_handler_fn(breakpoint_handler);
|
idt.breakpoint.set_handler_fn(breakpoint_handler);
|
||||||
|
idt.page_fault.set_handler_fn(page_fault_handler);
|
||||||
unsafe {
|
unsafe {
|
||||||
idt.double_fault
|
idt.double_fault
|
||||||
.set_handler_fn(double_fault_handler)
|
.set_handler_fn(double_fault_handler)
|
||||||
|
@ -93,13 +94,22 @@ extern "x86-interrupt" fn breakpoint_handler(stack_frame: InterruptStackFrame) {
|
||||||
trace!("EXCEPTION: BREAKPOINT\n{:#?}", stack_frame);
|
trace!("EXCEPTION: BREAKPOINT\n{:#?}", stack_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "x86-interrupt" fn page_fault_handler(
|
||||||
|
stack_frame: InterruptStackFrame,
|
||||||
|
error_code: PageFaultErrorCode
|
||||||
|
) {
|
||||||
|
error!("EXCEPTION: PAGE FAULT {error_code:?}\n{:#?}", stack_frame);
|
||||||
|
trace!("CR2: {:x}", Cr2::read_raw());
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
extern "x86-interrupt" fn double_fault_handler(
|
extern "x86-interrupt" fn double_fault_handler(
|
||||||
stack_frame: InterruptStackFrame,
|
stack_frame: InterruptStackFrame,
|
||||||
// NOTE(able): ignore this always is 0
|
// NOTE(able): ignore this always is 0
|
||||||
_error_code: u64,
|
_error_code: u64,
|
||||||
) -> ! {
|
) -> ! {
|
||||||
bsod(BSODSource::DoubleFault(&stack_frame));
|
// bsod(BSODSource::DoubleFault(&stack_frame));
|
||||||
// panic!("EXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame);
|
panic!("EXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SAFETY
|
/* SAFETY
|
||||||
|
|
Loading…
Reference in a new issue