summaryrefslogtreecommitdiff
path: root/kernel/src/interrupts/mod.rs
blob: 3f5e09a2d80855f269dc6b9ba3a4a11dde700782 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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 InterruptType {
    DivZero,
    Debug,
    NonMaskableInterrupt,
    Breakpoint,
    Overflow,
    BountRange,
    InvalidOptcode,
    DeviceNotAvailable,
    DoubleFault,
    CoprocessorOverrun,
    InvalidTTS,
    NotPresent,
    StackSegmentFault,
    GeneralProtectionFault,
    PageFault,
    X87Floating = 16,
    AlignmentCheck,
    MachineCheck,
    SIMD,
    Virtualization,
    Security,
    Timer = INT_OFFSET,
    Keyboard,
    ApicError,
    None = 255,
}

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

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