Introduction to Paging
This commit is contained in:
10
src/main.rs
10
src/main.rs
@@ -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!");
|
||||
|
||||
Reference in New Issue
Block a user