Allocate a new double fault stack in interrupts::init

This commit is contained in:
Philipp Oppermann
2017-01-02 15:51:56 +01:00
parent 8ad76ba496
commit e08bd375ae
2 changed files with 8 additions and 3 deletions

View File

@@ -7,6 +7,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use memory::MemoryController;
mod idt;
macro_rules! save_scratch_registers {
@@ -100,7 +102,10 @@ lazy_static! {
};
}
pub fn init() {
pub fn init(memory_controller: &mut MemoryController) {
let double_fault_stack = memory_controller.alloc_stack(1)
.expect("could not allocate double fault stack");
IDT.load();
}

View File

@@ -51,10 +51,10 @@ pub extern "C" fn rust_main(multiboot_information_address: usize) {
enable_write_protect_bit();
// set up guard page and map the heap pages
memory::init(boot_info);
let mut memory_controller = memory::init(boot_info);
// initialize our IDT
interrupts::init();
interrupts::init(&mut memory_controller);
fn stack_overflow() {
stack_overflow(); // for each recursion, the return address is pushed