Create a new TaskStateSegment

(that contains the double fault stack in its IST)
This commit is contained in:
Philipp Oppermann
2017-01-02 15:54:54 +01:00
parent e08bd375ae
commit d330a67659

View File

@@ -8,6 +8,7 @@
// except according to those terms. // except according to those terms.
use memory::MemoryController; use memory::MemoryController;
use x86::bits64::task::TaskStateSegment;
mod idt; mod idt;
@@ -102,10 +103,15 @@ lazy_static! {
}; };
} }
const DOUBLE_FAULT_IST_INDEX: usize = 0;
pub fn init(memory_controller: &mut MemoryController) { pub fn init(memory_controller: &mut MemoryController) {
let double_fault_stack = memory_controller.alloc_stack(1) let double_fault_stack = memory_controller.alloc_stack(1)
.expect("could not allocate double fault stack"); .expect("could not allocate double fault stack");
let mut tss = TaskStateSegment::new();
tss.ist[DOUBLE_FAULT_IST_INDEX] = double_fault_stack.top() as u64;
IDT.load(); IDT.load();
} }