Introduction to Paging

This commit is contained in:
2022-01-12 16:54:57 +08:00
parent 6f67926a75
commit c3e1897c23
2 changed files with 22 additions and 1 deletions

View File

@@ -16,6 +16,16 @@ pub extern "C" fn _start() -> ! {
anos::init();
let ptr = 0x2031b2 as *mut u32;
unsafe { let x = *ptr; }
println!("read worked");
unsafe { *ptr = 42 };
println!("write worked");
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());
// 触发一个中断
x86_64::instructions::interrupts::int3();
println!("It didn't crash!");