diff --git a/src/interrupts/mod.rs b/src/interrupts/mod.rs index c0232760..aad3b782 100644 --- a/src/interrupts/mod.rs +++ b/src/interrupts/mod.rs @@ -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(); } diff --git a/src/lib.rs b/src/lib.rs index fed0b0dd..d7f8ccb8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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