segment not present for qemu tests

This commit is contained in:
Ryan Kennedy 2020-03-15 14:03:33 -05:00
parent 706725cc02
commit 27ee8090ff

View file

@ -34,16 +34,7 @@ pub static PICS: Spinlock<ChainedPics> =
static IDT: Lazy<InterruptDescriptorTable> = Lazy::new(|| { static IDT: Lazy<InterruptDescriptorTable> = Lazy::new(|| {
let mut idt = InterruptDescriptorTable::new(); let mut idt = InterruptDescriptorTable::new();
idt.page_fault.set_handler_fn(page_fault_handler); idt.page_fault.set_handler_fn(page_fault_handler);
idt.divide_error.set_handler_fn(divide_error_handler);
idt.non_maskable_interrupt.set_handler_fn(non_maskable_interrupt);
idt.overflow.set_handler_fn(overflow);
idt.bound_range_exceeded.set_handler_fn(bound_range_exceeded);
idt.invalid_opcode.set_handler_fn(invalid_opcode);
idt.device_not_available.set_handler_fn(device_not_available);
idt.invalid_tss.set_handler_fn(invalid_tss);
idt.segment_not_present.set_handler_fn(segment_not_present); idt.segment_not_present.set_handler_fn(segment_not_present);
idt.stack_segment_fault.set_handler_fn(stack_segment_fault);
idt.general_protection_fault.set_handler_fn(general_protection_fault);
unsafe { unsafe {
idt.double_fault idt.double_fault
.set_handler_fn(double_fault_handler) .set_handler_fn(double_fault_handler)
@ -77,45 +68,10 @@ extern "x86-interrupt" fn page_fault_handler(
hlt_loop(); hlt_loop();
} }
extern "x86-interrupt" fn divide_error_handler(stack_frame: &mut InterruptStackFrame) { extern "x86-interrupt" fn segment_not_present(
panic!("EXCEPTION: DIVIDE ERROR\n{:#?}", stack_frame); _stack_frame: &mut InterruptStackFrame,
} _error_code: u64,
) {
extern "x86-interrupt" fn non_maskable_interrupt(stack_frame: &mut InterruptStackFrame) { // For some reason this sometimes gets thrown when running tests in qemu,
panic!( // so leave empty so the tests finish for now.
"EXCEPTION: NON MASKABLE INTERRUPT ERROR\n{:#?}",
stack_frame
);
}
extern "x86-interrupt" fn overflow(stack_frame: &mut InterruptStackFrame) {
panic!("EXCEPTION: OVERFLOW\n{:#?}", stack_frame);
}
extern "x86-interrupt" fn bound_range_exceeded(stack_frame: &mut InterruptStackFrame) {
panic!("EXCEPTION: BOUND RANGE EXCEEDED\n{:#?}", stack_frame);
}
extern "x86-interrupt" fn invalid_opcode(stack_frame: &mut InterruptStackFrame) {
panic!("EXCEPTION: INVALID OPCODE\n{:#?}", stack_frame);
}
extern "x86-interrupt" fn device_not_available(stack_frame: &mut InterruptStackFrame) {
panic!("EXCEPTION: DEVICE NOT AVAILABLE\n{:#?}", stack_frame);
}
extern "x86-interrupt" fn invalid_tss(stack_frame: &mut InterruptStackFrame, error_code: u64) {
panic!("EXCEPTION: INVALID TSS\n{:#?}", stack_frame);
}
extern "x86-interrupt" fn segment_not_present(stack_frame: &mut InterruptStackFrame, error_code: u64) {
panic!("EXCEPTION: SEGMENT NOT PRESENT\n{:#?}", stack_frame);
}
extern "x86-interrupt" fn stack_segment_fault(stack_frame: &mut InterruptStackFrame, error_code: u64) {
panic!("EXCEPTION: STACK SEGMENT FAULT\n{:#?}", stack_frame);
}
extern "x86-interrupt" fn general_protection_fault(stack_frame: &mut InterruptStackFrame, error_code: u64) {
panic!("EXCEPTION: GENERAL PROTECTION FAULT\n{:#?}", stack_frame);
} }