Double fault
This commit is contained in:
parent
596bb35697
commit
4c0ce08bc8
@ -6,6 +6,7 @@ lazy_static! {
|
|||||||
static ref IDT: InterruptDescriptorTable = {
|
static ref IDT: InterruptDescriptorTable = {
|
||||||
let mut idt = InterruptDescriptorTable::new();
|
let mut idt = InterruptDescriptorTable::new();
|
||||||
idt.breakpoint.set_handler_fn(breakpoint_handler);
|
idt.breakpoint.set_handler_fn(breakpoint_handler);
|
||||||
|
idt.double_fault.set_handler_fn(double_fault_handler);
|
||||||
idt
|
idt
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -18,3 +19,7 @@ extern "x86-interrupt" fn breakpoint_handler(stack_frame: &mut InterruptStackFra
|
|||||||
|
|
||||||
println!("EXCEPTION - BREAKPOINT\n{:#?}", stack_frame);
|
println!("EXCEPTION - BREAKPOINT\n{:#?}", stack_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "x86-interrupt" fn double_fault_handler(stack_frame: &mut InterruptStackFrame, code: u64) {
|
||||||
|
panic!("EXCEPTION - DOUBLE FAULT (code {})\n{:#?}", code, stack_frame);
|
||||||
|
}
|
||||||
|
@ -22,15 +22,14 @@ pub fn init() {
|
|||||||
pub extern "C" fn _start() -> ! {
|
pub extern "C" fn _start() -> ! {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
x86_64::instructions::interrupts::int3();
|
//x86_64::instructions::interrupts::int3();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
asm!("mov dx, 0; div dx" ::: "ax", "dx" : "volatile", "intel")
|
*(0xf0f0b8b8 as *mut u64) = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("Gamarjoba, munde: {}", 1);
|
println!("Gamarjoba, munde: {}", 1);
|
||||||
println!("Gamarjoba, munde: {}", 2);
|
println!("Gamarjoba, munde: {}", 2);
|
||||||
panic!("A bad thing happened");
|
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user