mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Create a new TaskStateSegment
(that contains the double fault stack in its IST)
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user