mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Use BootInfoFrameAllocator instead of EmptyFrameAllocator
This commit is contained in:
@@ -11,7 +11,7 @@ entry_point!(kernel_main);
|
|||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
fn kernel_main(boot_info: &'static BootInfo) -> ! {
|
fn kernel_main(boot_info: &'static BootInfo) -> ! {
|
||||||
use blog_os::interrupts::PICS;
|
use blog_os::interrupts::PICS;
|
||||||
use blog_os::memory::{self, create_example_mapping, EmptyFrameAllocator};
|
use blog_os::memory::{self, create_example_mapping};
|
||||||
|
|
||||||
println!("Hello World{}", "!");
|
println!("Hello World{}", "!");
|
||||||
|
|
||||||
@@ -21,8 +21,9 @@ fn kernel_main(boot_info: &'static BootInfo) -> ! {
|
|||||||
x86_64::instructions::interrupts::enable();
|
x86_64::instructions::interrupts::enable();
|
||||||
|
|
||||||
let mut recursive_page_table = unsafe { memory::init(boot_info.p4_table_addr as usize) };
|
let mut recursive_page_table = unsafe { memory::init(boot_info.p4_table_addr as usize) };
|
||||||
|
let mut frame_allocator = memory::init_frame_allocator(&boot_info.memory_map);
|
||||||
|
|
||||||
create_example_mapping(&mut recursive_page_table, &mut EmptyFrameAllocator);
|
create_example_mapping(&mut recursive_page_table, &mut frame_allocator);
|
||||||
unsafe { (0xdeadbeaf900 as *mut u64).write_volatile(0xf021f077f065f04e) };
|
unsafe { (0xdeadbeaf900 as *mut u64).write_volatile(0xf021f077f065f04e) };
|
||||||
|
|
||||||
println!("It did not crash!");
|
println!("It did not crash!");
|
||||||
|
|||||||
Reference in New Issue
Block a user