mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 06:17:49 +00:00
Print non-empty level 4 table entries
This commit is contained in:
13
src/main.rs
13
src/main.rs
@@ -11,7 +11,7 @@ entry_point!(kernel_main);
|
||||
#[cfg(not(test))]
|
||||
fn kernel_main(boot_info: &'static BootInfo) -> ! {
|
||||
use blog_os::interrupts::PICS;
|
||||
use x86_64::registers::control::Cr3;
|
||||
use blog_os::memory::active_level_4_table;
|
||||
|
||||
println!("Hello World{}", "!");
|
||||
|
||||
@@ -20,11 +20,12 @@ fn kernel_main(boot_info: &'static BootInfo) -> ! {
|
||||
unsafe { PICS.lock().initialize() };
|
||||
x86_64::instructions::interrupts::enable();
|
||||
|
||||
let (level_4_page_table, _) = Cr3::read();
|
||||
println!(
|
||||
"Level 4 page table at: {:?}",
|
||||
level_4_page_table.start_address()
|
||||
);
|
||||
let l4_table = unsafe { active_level_4_table(boot_info.physical_memory_offset) };
|
||||
for (i, entry) in l4_table.iter().enumerate() {
|
||||
if !entry.is_unused() {
|
||||
println!("L4 Entry {}: {:?}", i, entry);
|
||||
}
|
||||
}
|
||||
|
||||
println!("It did not crash!");
|
||||
blog_os::hlt_loop();
|
||||
|
||||
Reference in New Issue
Block a user