Skip to content

Commit

Permalink
Add the InterruptVector type
Browse files Browse the repository at this point in the history
  • Loading branch information
npmccallum committed Sep 7, 2021
1 parent c83f36c commit 502ba0c
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,82 @@ impl PrivilegeLevel {
}
}
}

/// This structure defines the CPU-internal interrupt vectors.
///
/// The values are defined by the following manual sections:
/// * AMD Volume 2: 8.2
/// * Intel Volume 3A: 6.3.1
#[repr(u8)]
#[non_exhaustive]
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum InterruptVector {
/// Error during Division
Division = 0x00,

/// Debug
Debug = 0x01,

/// Non-Maskable Interrupt
NonMaskableInterrupt = 0x02,

/// Breakpoint
Breakpoint = 0x03,

/// Overflow
Overflow = 0x04,

/// Bound Range Exceeded
BoundRange = 0x05,

/// Invalid Opcode
InvalidOpcode = 0x06,

/// Device Not Available
DeviceNotAvailable = 0x07,

/// Double Fault
Double = 0x08,

/// Invalid TSS
InvalidTss = 0x0A,

/// Segment Not Present
SegmentNotPresent = 0x0B,

/// Stack Fault
Stack = 0x0C,

/// General Protection Fault
GeneralProtection = 0x0D,

/// Page Fault
Page = 0x0E,

/// x87 Floating-Point Exception
FloatingPoint = 0x10,

/// Alignment Check
AlignmentCheck = 0x11,

/// Machine Check
MachineCheck = 0x12,

/// SIMD Floating-Point Exception
SimdFloatingPoint = 0x13,

/// Virtualization Exception (Intel-only)
Virtualization = 0x14,

/// Control Protection Exception
ControlProtection = 0x15,

/// Hypervisor Injection (AMD-only)
HypervisorInjection = 0x1C,

/// VMM Communication (AMD-only)
VmmCommunication = 0x1D,

/// Security Exception
Security = 0x1E,
}

0 comments on commit 502ba0c

Please sign in to comment.