add some interrupts

This commit is contained in:
fekhesk 2022-10-26 12:10:12 -07:00
parent d0817025aa
commit 9a5a004243
No known key found for this signature in database
GPG key ID: D17BA3F38ED319DF
2 changed files with 20 additions and 1 deletions

View file

@ -1,8 +1,10 @@
use core::borrow::{BorrowMut};
use x86_64::registers::control::Cr2;
use x86_64::structures::idt::PageFaultErrorCode;
use crate::{InterruptStackFrame, font, println};
use crate::{InterruptStackFrame, font, println, print};
use crate::internals::WhyDoTheyCallItOvenWhenYouOfInTheColdFoodOfOutHotEatTheFood::{COMMUNIST_RED, CUM_WHITE, Colour};
use crate::serial::terminal::ST;
@ -10,5 +12,20 @@ pub extern "x86-interrupt" fn breakpoint_exception(stack_frame: InterruptStackFr
println!("---KERNEL WARNING UWU---");
println!("breakpoint exception");
println!("stack frame: {:#?}", stack_frame);
}
pub extern "x86-interrupt" fn double_fault(stack_frame: InterruptStackFrame, _error_code: u64) -> ! {
println!("---KERNEL FUCKY WUKKY UWU---");
println!("double fault!");
println!("stack frame: {:#?}", stack_frame);
loop {}
}
pub extern "x86-interrupt" fn page_fault(stack_frame: InterruptStackFrame, error_code: PageFaultErrorCode) -> ! {
println!("---KERNEL FUCKY WUKKY UWU---");
println!("page fault!");
println!("accessed address: {:?}", Cr2::read());
println!("error code: {:?}", error_code);
println!("stack frame: {:#?}", stack_frame);
loop {}
}

View file

@ -37,6 +37,8 @@ lazy_static! {
static ref IDT: InterruptDescriptorTable = {
let mut idt = InterruptDescriptorTable::new();
idt.breakpoint.set_handler_fn(internals::errors::breakpoint_exception);
idt.double_fault.set_handler_fn(internals::errors::double_fault);
idt.page_fault.set_handler_fn(internals::errors::page_fault);
idt
};
}