Double Faults

This commit is contained in:
2022-01-10 17:45:04 +08:00
parent 70099da497
commit a3bc614725
6 changed files with 122 additions and 0 deletions

View File

@@ -15,9 +15,18 @@ pub extern "C" fn _start() -> ! {
println!("Hello World{}", "!");
anos::init();
// 触发一个中断
x86_64::instructions::interrupts::int3();
println!("It didn't crash!");
// 触发一个页错误
// 由于我们没有设定页错误的处理函数
// 所以会触发 double fault
unsafe {
*(0xdeadbeef as *mut u64) = 42; // 强制写入某个内存地址
}
#[cfg(test)]
test_main();