diff --git a/src/interrupts.rs b/src/interrupts.rs index 095367b..0d8ad37 100644 --- a/src/interrupts.rs +++ b/src/interrupts.rs @@ -1,4 +1,5 @@ use x86_64::structures::idt::{Idt, ExceptionStackFrame}; +use memory::MemoryController; lazy_static! { static ref IDT: Idt = { @@ -9,7 +10,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 403c9f4..5d65479 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -42,14 +42,14 @@ 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); unsafe { HEAP_ALLOCATOR.lock().init(HEAP_START, HEAP_START + HEAP_SIZE); } // initialize our IDT - interrupts::init(); + interrupts::init(&mut memory_controller); for i in 0..10000 { format!("Some String");