Skip to content

Commit 137f555

Browse files
npmccallumjosephlr
authored andcommitted
Add the ExceptionVector type
Signed-off-by: Joe Richey <[email protected]>
1 parent c83f36c commit 137f555

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

src/structures/idt.rs

+79
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,85 @@ pub enum DescriptorTable {
10101010
Ldt,
10111011
}
10121012

1013+
/// This structure defines the CPU-internal exception vector numbers.
1014+
///
1015+
/// The values are defined by the following manual sections:
1016+
/// * AMD Volume 2: 8.2
1017+
/// * Intel Volume 3A: 6.3.1
1018+
#[repr(u8)]
1019+
#[non_exhaustive]
1020+
#[derive(Copy, Clone, Debug, PartialEq)]
1021+
pub enum ExceptionVector {
1022+
/// Error during Division
1023+
Division = 0x00,
1024+
1025+
/// Debug
1026+
Debug = 0x01,
1027+
1028+
/// Non-Maskable Interrupt
1029+
NonMaskableInterrupt = 0x02,
1030+
1031+
/// Breakpoint
1032+
Breakpoint = 0x03,
1033+
1034+
/// Overflow
1035+
Overflow = 0x04,
1036+
1037+
/// Bound Range Exceeded
1038+
BoundRange = 0x05,
1039+
1040+
/// Invalid Opcode
1041+
InvalidOpcode = 0x06,
1042+
1043+
/// Device Not Available
1044+
DeviceNotAvailable = 0x07,
1045+
1046+
/// Double Fault
1047+
Double = 0x08,
1048+
1049+
/// Invalid TSS
1050+
InvalidTss = 0x0A,
1051+
1052+
/// Segment Not Present
1053+
SegmentNotPresent = 0x0B,
1054+
1055+
/// Stack Fault
1056+
Stack = 0x0C,
1057+
1058+
/// General Protection Fault
1059+
GeneralProtection = 0x0D,
1060+
1061+
/// Page Fault
1062+
Page = 0x0E,
1063+
1064+
/// x87 Floating-Point Exception
1065+
X87FloatingPoint = 0x10,
1066+
1067+
/// Alignment Check
1068+
AlignmentCheck = 0x11,
1069+
1070+
/// Machine Check
1071+
MachineCheck = 0x12,
1072+
1073+
/// SIMD Floating-Point Exception
1074+
SimdFloatingPoint = 0x13,
1075+
1076+
/// Virtualization Exception (Intel-only)
1077+
Virtualization = 0x14,
1078+
1079+
/// Control Protection Exception
1080+
ControlProtection = 0x15,
1081+
1082+
/// Hypervisor Injection (AMD-only)
1083+
HypervisorInjection = 0x1C,
1084+
1085+
/// VMM Communication (AMD-only)
1086+
VmmCommunication = 0x1D,
1087+
1088+
/// Security Exception
1089+
Security = 0x1E,
1090+
}
1091+
10131092
#[cfg(test)]
10141093
mod test {
10151094
use super::*;

0 commit comments

Comments
 (0)