Pass the memory controller to interrupts::init and use it to create a double fault stack

master
Philipp Oppermann 8 years ago
parent f1459a552c
commit 00bbd6fbc6

@ -1,4 +1,5 @@
use x86_64::structures::idt::{Idt, ExceptionStackFrame}; use x86_64::structures::idt::{Idt, ExceptionStackFrame};
use memory::MemoryController;
lazy_static! { lazy_static! {
static ref IDT: Idt = { 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(); IDT.load();
} }

@ -42,14 +42,14 @@ pub extern "C" fn rust_main(multiboot_information_address: usize) {
enable_write_protect_bit(); enable_write_protect_bit();
// set up guard page and map the heap pages // set up guard page and map the heap pages
memory::init(boot_info); let mut memory_controller = memory::init(boot_info);
unsafe { unsafe {
HEAP_ALLOCATOR.lock().init(HEAP_START, HEAP_START + HEAP_SIZE); HEAP_ALLOCATOR.lock().init(HEAP_START, HEAP_START + HEAP_SIZE);
} }
// initialize our IDT // initialize our IDT
interrupts::init(); interrupts::init(&mut memory_controller);
for i in 0..10000 { for i in 0..10000 {
format!("Some String"); format!("Some String");

Loading…
Cancel
Save