changed page allocation to happen on page fault for performance reasons
This commit is contained in:
+27
-18
@@ -15,6 +15,7 @@ extern crate alloc;
|
||||
|
||||
use arch::x86_64::apic::enable_apic;
|
||||
use core::arch::asm;
|
||||
use libk::drivers::memory;
|
||||
use limine::BaseRevision;
|
||||
|
||||
use libk::drivers::kalloc::allocator::init_heap;
|
||||
@@ -57,7 +58,7 @@ pub fn boot() -> Result<(), &'static str> {
|
||||
return Err("base revision not supported");
|
||||
}
|
||||
|
||||
use arch::x86_64::{gdt, interrupts, memmap, memory};
|
||||
use arch::x86_64::{gdt, interrupts, memmap};
|
||||
|
||||
let memory_map = memmap::get_memory_map();
|
||||
|
||||
@@ -72,29 +73,37 @@ pub fn boot() -> Result<(), &'static str> {
|
||||
gdt::init();
|
||||
println_log!("[Success]");
|
||||
|
||||
print_log!(" Initialising Memory Subsystem... ");
|
||||
let physical_memory_offset = VirtAddr::new(*memmap::PHYSICAL_MEMORY_OFFSET);
|
||||
let mut l4_table = unsafe { memory::init(physical_memory_offset) };
|
||||
println_log!("[Success]");
|
||||
|
||||
print_log!(" Setting Up Page Table... ");
|
||||
let mut frame_allocator = unsafe { memory::FoundryOSFrameAllocator::init(memory_map) };
|
||||
println_log!("[Success]");
|
||||
|
||||
print_log!(" Initialising Heap... ");
|
||||
if init_heap(&mut l4_table, &mut frame_allocator).is_err() {
|
||||
return Err("Failed to initialise heap: error");
|
||||
}
|
||||
println_log!("[Success]");
|
||||
|
||||
print_log!(" Setting Up Interrupt Descriptor Table... ");
|
||||
interrupts::init_idt();
|
||||
println_log!("[Success]");
|
||||
|
||||
print_log!(" Initialising APIC");
|
||||
enable_apic(&mut l4_table, &mut frame_allocator);
|
||||
print_log!(" Initialising Memory Subsystem... ");
|
||||
let physical_memory_offset = VirtAddr::new(*memmap::PHYSICAL_MEMORY_OFFSET);
|
||||
let mut l4_table = memory::init_page_table(physical_memory_offset);
|
||||
println_log!("[Success]");
|
||||
|
||||
print_log!(" Setting Up Page Table... ");
|
||||
memory::init_frame_allocator(memory_map);
|
||||
println_log!("[Success]");
|
||||
|
||||
print_log!(" Initialising Heap... ");
|
||||
if init_heap().is_err() {
|
||||
return Err("Failed to initialise heap: error");
|
||||
}
|
||||
println_log!("[Success]");
|
||||
|
||||
print_log!(" Enabling PICs... ");
|
||||
interrupts::enable_pic();
|
||||
println_log!("[Success]");
|
||||
|
||||
// print_log!(" Disabling PICs... ");
|
||||
// interrupts::disable_pic();
|
||||
// println_log!("[Success]");
|
||||
//
|
||||
// print_log!(" Initialising APIC");
|
||||
// enable_apic(&mut l4_table, &mut frame_allocator);
|
||||
// println_log!("[Success]");
|
||||
|
||||
print_log!(" Enabling Interrupts... ");
|
||||
x86_64::instructions::interrupts::enable();
|
||||
println_log!("[Success]");
|
||||
|
||||
Reference in New Issue
Block a user