Catch double faults on a separate stack

This commit is contained in:
Philipp Oppermann
2017-01-02 16:51:01 +01:00
parent 006619920e
commit a43b23b619
2 changed files with 5 additions and 3 deletions

View File

@@ -107,9 +107,10 @@ impl EntryOptions {
self
}
#[allow(dead_code)]
pub fn set_stack_index(&mut self, index: u16) -> &mut Self {
self.0.set_range(0..3, index);
// The hardware IST index starts at 1, but our software IST index
// starts at 0. Therefore we need to add 1 here.
self.0.set_range(0..3, index + 1);
self
}
}

View File

@@ -100,7 +100,8 @@ lazy_static! {
idt.set_handler(0, handler!(divide_by_zero_handler));
idt.set_handler(3, handler!(breakpoint_handler));
idt.set_handler(6, handler!(invalid_opcode_handler));
idt.set_handler(8, handler_with_error_code!(double_fault_handler));
idt.set_handler(8, handler_with_error_code!(double_fault_handler))
.set_stack_index(DOUBLE_FAULT_IST_INDEX as u16);
idt.set_handler(14, handler_with_error_code!(page_fault_handler));
idt