Skip to content

Commit 2e003eb

Browse files
committed
Add the InterruptVector type
1 parent 42c60b8 commit 2e003eb

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

Diff for: src/lib.rs

+79
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,82 @@ impl PrivilegeLevel {
111111
}
112112
}
113113
}
114+
115+
/// This structure defines the CPU-internal interrupt vectors.
116+
///
117+
/// The values are defined by the following manual sections:
118+
/// * AMD Volume 2: 8.2
119+
/// * Intel Volume 3A: 6.3.1
120+
#[repr(u8)]
121+
#[non_exhaustive]
122+
#[derive(Copy, Clone, Debug, PartialEq)]
123+
pub enum InterruptVector {
124+
/// Divide-by-zero Error
125+
DivideByZero = 0x00,
126+
127+
/// Debug
128+
Debug = 0x01,
129+
130+
/// Non-Maskable Interrupt
131+
NonMaskableInterrupt = 0x02,
132+
133+
/// Breakpoint
134+
Breakpoint = 0x03,
135+
136+
/// Overflow
137+
Overflow = 0x04,
138+
139+
/// Bound Range Exceeded
140+
BoundRange = 0x05,
141+
142+
/// Invalid Opcode
143+
InvalidOpcode = 0x06,
144+
145+
/// Device Not Available
146+
DeviceNotAvailable = 0x07,
147+
148+
/// Double Fault
149+
DoubleFault = 0x08,
150+
151+
/// Invalid TSS
152+
InvalidTss = 0x0A,
153+
154+
/// Segment Not Present
155+
SegmentNotPresent = 0x0B,
156+
157+
/// Stack Fault
158+
Stack = 0x0C,
159+
160+
/// General Protection Fault
161+
GeneralProtection = 0x0D,
162+
163+
/// Page Fault
164+
Page = 0x0E,
165+
166+
/// x87 Floating-Point Exception
167+
FloatingPoint = 0x10,
168+
169+
/// Alignment Check
170+
AlignmentCheck = 0x11,
171+
172+
/// Machine Check
173+
MachineCheck = 0x12,
174+
175+
/// SIMD Floating-Point Exception
176+
SimdFloatingPoint = 0x13,
177+
178+
/// Virtualization Exception (Intel-only)
179+
Virtualization = 0x14,
180+
181+
/// Control Protection Exception (AMD-only)
182+
ControlProtection = 0x15,
183+
184+
/// Hypervisor Injection (AMD-only)
185+
HypervisorInjection = 0x1C,
186+
187+
/// VMM Communication (AMD-only)
188+
VmmCommunication = 0x1D,
189+
190+
/// Security Exception
191+
Security = 0x1E,
192+
}

0 commit comments

Comments
 (0)