diff --git a/src/interrupts/idt.rs b/src/interrupts/idt.rs index 9c191cbb..b139b648 100644 --- a/src/interrupts/idt.rs +++ b/src/interrupts/idt.rs @@ -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 } } diff --git a/src/interrupts/mod.rs b/src/interrupts/mod.rs index d059cffe..3d4fc5b9 100644 --- a/src/interrupts/mod.rs +++ b/src/interrupts/mod.rs @@ -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