The code for reading the level 4 table was moved to the next post

This commit is contained in:
Philipp Oppermann
2019-03-10 16:07:09 +01:00
parent 6ffcb2cf1a
commit 7198a4d110

View File

@@ -9,7 +9,7 @@ use core::panic::PanicInfo;
#[no_mangle] #[no_mangle]
pub extern "C" fn _start() -> ! { pub extern "C" fn _start() -> ! {
use blog_os::interrupts::PICS; use blog_os::interrupts::PICS;
use x86_64::structures::paging::PageTable; use x86_64::registers::control::Cr3;
println!("Hello World{}", "!"); println!("Hello World{}", "!");
@@ -18,11 +18,11 @@ pub extern "C" fn _start() -> ! {
unsafe { PICS.lock().initialize() }; unsafe { PICS.lock().initialize() };
x86_64::instructions::interrupts::enable(); x86_64::instructions::interrupts::enable();
let level_4_table_ptr = 0xffff_ffff_ffff_f000 as *const PageTable; let (level_4_page_table, _) = Cr3::read();
let level_4_table = unsafe { &*level_4_table_ptr }; println!(
for i in 0..10 { "Level 4 page table at: {:?}",
println!("Entry {}: {:?}", i, level_4_table[i]); level_4_page_table.start_address()
} );
println!("It did not crash!"); println!("It did not crash!");
blog_os::hlt_loop(); blog_os::hlt_loop();