Hardware Interrupts

This commit is contained in:
2022-01-11 17:09:13 +08:00
parent f0f10fc701
commit 6f67926a75
7 changed files with 119 additions and 19 deletions

View File

@@ -20,17 +20,10 @@ pub extern "C" fn _start() -> ! {
x86_64::instructions::interrupts::int3();
println!("It didn't crash!");
// 触发一个页错误
// 由于我们没有设定页错误的处理函数
// 所以会触发 double fault
unsafe {
*(0xdeadbeef as *mut u64) = 42; // 强制写入某个内存地址
}
#[cfg(test)]
test_main();
loop {}
anos::hlt_loop();
}
// 在非测试模式下,将 panic 信息打印到 VGA 缓冲区
@@ -40,7 +33,7 @@ pub extern "C" fn _start() -> ! {
// 禁用标准库之后,这些东西就都没有了,我们需要把它重写一遍
fn panic(info: &PanicInfo) -> ! {
println!("{}", info);
loop {}
anos::hlt_loop();
}
#[cfg(test)]