From a05db759d79168d13113768b39a02366d47dad74 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Tue, 18 Apr 2017 18:21:45 +0200 Subject: [PATCH] Create a TSS and save the double fault stack pointer it its IST --- src/interrupts.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/interrupts.rs b/src/interrupts.rs index 0d8ad37..643cf7a 100644 --- a/src/interrupts.rs +++ b/src/interrupts.rs @@ -1,4 +1,6 @@ +use x86_64::VirtualAddress; use x86_64::structures::idt::{Idt, ExceptionStackFrame}; +use x86_64::structures::tss::TaskStateSegment; use memory::MemoryController; lazy_static! { @@ -10,10 +12,16 @@ lazy_static! { }; } +const DOUBLE_FAULT_IST_INDEX: usize = 0; + pub fn init(memory_controller: &mut MemoryController) { let double_fault_stack = memory_controller.alloc_stack(1) .expect("could not allocate double fault stack"); + let mut tss = TaskStateSegment::new(); + tss.interrupt_stack_table[DOUBLE_FAULT_IST_INDEX] = VirtualAddress( + double_fault_stack.top()); + IDT.load(); }