mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27: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))]
|
#[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();
|
||||||
|
|||||||
Reference in New Issue
Block a user