Double Faults
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user