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

@@ -38,7 +38,7 @@ pub fn test_panic_handler(info: &PanicInfo) -> ! {
serial_println!("[failed]\n");
serial_println!("Error: {}\n", info);
exit_qemu(QemuExitCode::Failed);
loop {}
hlt_loop();
}
#[cfg(test)]
@@ -46,7 +46,7 @@ pub fn test_panic_handler(info: &PanicInfo) -> ! {
pub extern "C" fn _start() -> ! {
init();
test_main();
loop {}
hlt_loop();
}
#[cfg(test)]
@@ -79,7 +79,15 @@ pub fn exit_qemu(exit_code: QemuExitCode) {
}
}
pub fn hlt_loop() -> ! {
loop {
x86_64::instructions::hlt();
}
}
pub fn init() {
gdt::init();
interrupts::init_idt();
unsafe { interrupts::PICS.lock().initialize() };
x86_64::instructions::interrupts::enable();
}