kernel/cpu/interrupts/handlers.rs
1//! Global handlers that have several purposes and doesn't belong in 1 place specifically
2
3use crate::{
4 cpu::idt::InterruptAllSavedState,
5 devices::{clock, keyboard_mouse},
6 io::console,
7 process::scheduler,
8};
9
10use super::apic;
11
12pub extern "C" fn apic_timer_handler(all_state: &mut InterruptAllSavedState) {
13 // make sure its initialized
14 clock::clocks().tick_system_time();
15 // flush log file if needed
16 console::tracing::flush_log_file();
17 // trigger poll if there is any events
18 keyboard_mouse::poll_events();
19
20 scheduler::yield_current_if_any(all_state);
21 apic::return_from_interrupt();
22}