mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
The code for reading the level 4 table was moved to the next post
This commit is contained in:
12
src/main.rs
12
src/main.rs
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user