mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Retrieve address of level 4 page table
This commit is contained in:
@@ -9,6 +9,10 @@ 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::registers::control::Cr3;
|
||||||
|
|
||||||
|
let (level_4_page_table, _) = Cr3::read();
|
||||||
|
println!("Level 4 page table at: {:?}", level_4_page_table.start_address());
|
||||||
|
|
||||||
println!("Hello World{}", "!");
|
println!("Hello World{}", "!");
|
||||||
|
|
||||||
@@ -17,10 +21,6 @@ pub extern "C" fn _start() -> ! {
|
|||||||
unsafe { PICS.lock().initialize() };
|
unsafe { PICS.lock().initialize() };
|
||||||
x86_64::instructions::interrupts::enable();
|
x86_64::instructions::interrupts::enable();
|
||||||
|
|
||||||
// provoke a page fault
|
|
||||||
let ptr = 0xdeadbeaf as *mut u32;
|
|
||||||
unsafe { *ptr = 42; }
|
|
||||||
|
|
||||||
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