summaryrefslogtreecommitdiff
path: root/kernel/src/interrupts/mod.rs
blob: 1cab59578cf2675536e5e5e6b7d86dcccf38386d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
pub mod apic;
pub mod exception_handlers;
pub mod gdt;
pub mod idt;
pub mod interrupt_handlers;

const INT_OFFSET: u8 = 32;

#[repr(u8)]
#[derive(PartialEq, Clone, Copy)]
pub enum Interrupts {
    None,
    PageFault,
    DoubleFault,
    NotPresent,
    Breakpoint,
    GeneralProtectionFault,

    Timer = INT_OFFSET,
    Keyboard = INT_OFFSET + 1,
}

impl Interrupts {
    fn as_u8(self) -> u8 {
        self as u8
    }

    fn as_usize(self) -> usize {
        usize::from(self.as_u8())
    }
}