summaryrefslogtreecommitdiff
path: root/kernel/src/interrupts/interrupt_handlers.rs
blob: 8b3a7eb26a29bc2856f5372644a2ceffa8f0d7d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use core::fmt::Write;
use x86_64::structures::idt::InterruptStackFrame;
use x86_64::structures::port;

pub extern "x86-interrupt" fn timer_handler(_stack_frame: InterruptStackFrame) {
    crate::io::vga_text::OStream::new().print(b"Timer");

    if let Some(apic) = super::apic::get_local_apic() {
        apic.end_of_interrupt()
    }
}

pub extern "x86-interrupt" fn keyboard_handler(_stack_frame: InterruptStackFrame) {
    let code: u8 = unsafe { port::PortRead::read_from_port(0x60) };
    let _ = write!(crate::io::vga_text::OStream::new(), "{}", code);
    if let Some(apic) = super::apic::get_local_apic() {
        apic.end_of_interrupt()
    }
}