Print non-empty level 4 table entries

This commit is contained in:
Philipp Oppermann
2019-03-13 13:52:16 +01:00
parent e1ec5159b8
commit 61683bccda

View File

@@ -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 x86_64::registers::control::Cr3; use blog_os::memory::active_level_4_table;
println!("Hello World{}", "!"); println!("Hello World{}", "!");
@@ -20,11 +20,12 @@ fn kernel_main(boot_info: &'static BootInfo) -> ! {
unsafe { PICS.lock().initialize() }; unsafe { PICS.lock().initialize() };
x86_64::instructions::interrupts::enable(); x86_64::instructions::interrupts::enable();
let (level_4_page_table, _) = Cr3::read(); let l4_table = unsafe { active_level_4_table(boot_info.physical_memory_offset) };
println!( for (i, entry) in l4_table.iter().enumerate() {
"Level 4 page table at: {:?}", if !entry.is_unused() {
level_4_page_table.start_address() println!("L4 Entry {}: {:?}", i, entry);
); }
}
println!("It did not crash!"); println!("It did not crash!");
blog_os::hlt_loop(); blog_os::hlt_loop();