mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Allocate a new double fault stack in interrupts::init
This commit is contained in:
@@ -7,6 +7,8 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
use memory::MemoryController;
|
||||||
|
|
||||||
mod idt;
|
mod idt;
|
||||||
|
|
||||||
macro_rules! save_scratch_registers {
|
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();
|
IDT.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,10 +51,10 @@ 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);
|
||||||
|
|
||||||
// initialize our IDT
|
// initialize our IDT
|
||||||
interrupts::init();
|
interrupts::init(&mut memory_controller);
|
||||||
|
|
||||||
fn stack_overflow() {
|
fn stack_overflow() {
|
||||||
stack_overflow(); // for each recursion, the return address is pushed
|
stack_overflow(); // for each recursion, the return address is pushed
|
||||||
|
|||||||
Reference in New Issue
Block a user