Hardware Interrupts
This commit is contained in:
11
src/main.rs
11
src/main.rs
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user