@@ -891,6 +891,10 @@ impl fmt::Debug for InterruptStackFrameValue {
891
891
892
892
bitflags ! {
893
893
/// Describes an page fault error code.
894
+ ///
895
+ /// This structure is defined by the following manual sections:
896
+ /// * AMD Volume 2: 8.4.2
897
+ /// * Intel Volume 3A: 4.7
894
898
#[ repr( transparent) ]
895
899
pub struct PageFaultErrorCode : u64 {
896
900
/// If this flag is set, the page fault was caused by a page-protection violation,
@@ -914,6 +918,21 @@ bitflags! {
914
918
/// If this flag is set, it indicates that the access that caused the page fault was an
915
919
/// instruction fetch.
916
920
const INSTRUCTION_FETCH = 1 << 4 ;
921
+
922
+ /// If this flag is set, it indicates that the page fault was caused by a protection key.
923
+ const PROTECTION_KEY = 1 << 5 ;
924
+
925
+ /// If this flag is set, it indicates that the page fault was caused by a shadow stack
926
+ /// access.
927
+ const SHADOW_STACK = 1 << 6 ;
928
+
929
+ /// If this flag is set, it indicates that the page fault was caused by SGX access-control
930
+ /// requirements (Intel-only).
931
+ const SGX = 1 << 15 ;
932
+
933
+ /// If this flag is set, it indicates that the page fault is a result of the processor
934
+ /// encountering an RMP violation (AMD-only).
935
+ const RMP = 1 << 31 ;
917
936
}
918
937
}
919
938
@@ -992,6 +1011,85 @@ pub enum DescriptorTable {
992
1011
Ldt ,
993
1012
}
994
1013
1014
+ /// This structure defines the CPU-internal exception vector numbers.
1015
+ ///
1016
+ /// The values are defined by the following manual sections:
1017
+ /// * AMD Volume 2: 8.2
1018
+ /// * Intel Volume 3A: 6.3.1
1019
+ #[ repr( u8 ) ]
1020
+ #[ non_exhaustive]
1021
+ #[ derive( Copy , Clone , Debug , PartialEq ) ]
1022
+ pub enum ExceptionVector {
1023
+ /// Error during Division
1024
+ Division = 0x00 ,
1025
+
1026
+ /// Debug
1027
+ Debug = 0x01 ,
1028
+
1029
+ /// Non-Maskable Interrupt
1030
+ NonMaskableInterrupt = 0x02 ,
1031
+
1032
+ /// Breakpoint
1033
+ Breakpoint = 0x03 ,
1034
+
1035
+ /// Overflow
1036
+ Overflow = 0x04 ,
1037
+
1038
+ /// Bound Range Exceeded
1039
+ BoundRange = 0x05 ,
1040
+
1041
+ /// Invalid Opcode
1042
+ InvalidOpcode = 0x06 ,
1043
+
1044
+ /// Device Not Available
1045
+ DeviceNotAvailable = 0x07 ,
1046
+
1047
+ /// Double Fault
1048
+ Double = 0x08 ,
1049
+
1050
+ /// Invalid TSS
1051
+ InvalidTss = 0x0A ,
1052
+
1053
+ /// Segment Not Present
1054
+ SegmentNotPresent = 0x0B ,
1055
+
1056
+ /// Stack Fault
1057
+ Stack = 0x0C ,
1058
+
1059
+ /// General Protection Fault
1060
+ GeneralProtection = 0x0D ,
1061
+
1062
+ /// Page Fault
1063
+ Page = 0x0E ,
1064
+
1065
+ /// x87 Floating-Point Exception
1066
+ X87FloatingPoint = 0x10 ,
1067
+
1068
+ /// Alignment Check
1069
+ AlignmentCheck = 0x11 ,
1070
+
1071
+ /// Machine Check
1072
+ MachineCheck = 0x12 ,
1073
+
1074
+ /// SIMD Floating-Point Exception
1075
+ SimdFloatingPoint = 0x13 ,
1076
+
1077
+ /// Virtualization Exception (Intel-only)
1078
+ Virtualization = 0x14 ,
1079
+
1080
+ /// Control Protection Exception
1081
+ ControlProtection = 0x15 ,
1082
+
1083
+ /// Hypervisor Injection (AMD-only)
1084
+ HypervisorInjection = 0x1C ,
1085
+
1086
+ /// VMM Communication (AMD-only)
1087
+ VmmCommunication = 0x1D ,
1088
+
1089
+ /// Security Exception
1090
+ Security = 0x1E ,
1091
+ }
1092
+
995
1093
#[ cfg( test) ]
996
1094
mod test {
997
1095
use super :: * ;
0 commit comments