Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/uefi/src/proto/debug/exception.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / uefi / src / proto / debug / exception.rs` 188 lines ยท 7347 bytes Raw Blame History 1 // SPDX-License-Identifier: MIT OR Apache-2.0 2 3 /// Represents supported CPU exceptions. 4 #[repr(C)] 5 #[derive(Debug)] 6 pub struct ExceptionType(isize); 7 8 impl ExceptionType { 9 /// Undefined Exception 10 pub const EXCEPT_EBC_UNDEFINED: Self = Self(0); 11 /// Divide-by-zero Error 12 pub const EXCEPT_EBC_DIVIDE_ERROR: Self = Self(1); 13 /// Debug Exception 14 pub const EXCEPT_EBC_DEBUG: Self = Self(2); 15 /// Breakpoint 16 pub const EXCEPT_EBC_BREAKPOINT: Self = Self(3); 17 /// Overflow 18 pub const EXCEPT_EBC_OVERFLOW: Self = Self(4); 19 /// Invalid Opcode 20 pub const EXCEPT_EBC_INVALID_OPCODE: Self = Self(5); 21 /// Stack-Segment Fault 22 pub const EXCEPT_EBC_STACK_FAULT: Self = Self(6); 23 /// Alignment Check 24 pub const EXCEPT_EBC_ALIGNMENT_CHECK: Self = Self(7); 25 /// Instruction Encoding Exception 26 pub const EXCEPT_EBC_INSTRUCTION_ENCODING: Self = Self(8); 27 /// Bad Breakpoint Exception 28 pub const EXCEPT_EBC_BAD_BREAK: Self = Self(9); 29 /// Single Step Exception 30 pub const EXCEPT_EBC_SINGLE_STEP: Self = Self(10); 31 } 32 33 #[cfg(target_arch = "x86")] 34 impl ExceptionType { 35 /// Divide-by-zero Error 36 pub const EXCEPT_IA32_DIVIDE_ERROR: Self = Self(0); 37 /// Debug Exception 38 pub const EXCEPT_IA32_DEBUG: Self = Self(1); 39 /// Non-maskable Interrupt 40 pub const EXCEPT_IA32_NMI: Self = Self(2); 41 /// Breakpoint 42 pub const EXCEPT_IA32_BREAKPOINT: Self = Self(3); 43 /// Overflow 44 pub const EXCEPT_IA32_OVERFLOW: Self = Self(4); 45 /// Bound Range Exceeded 46 pub const EXCEPT_IA32_BOUND: Self = Self(5); 47 /// Invalid Opcode 48 pub const EXCEPT_IA32_INVALID_OPCODE: Self = Self(6); 49 /// Double Fault 50 pub const EXCEPT_IA32_DOUBLE_FAULT: Self = Self(8); 51 /// Invalid TSS 52 pub const EXCEPT_IA32_INVALID_TSS: Self = Self(10); 53 /// Segment Not Present 54 pub const EXCEPT_IA32_SEG_NOT_PRESENT: Self = Self(11); 55 /// Stack-Segment Fault 56 pub const EXCEPT_IA32_STACK_FAULT: Self = Self(12); 57 /// General Protection Fault 58 pub const EXCEPT_IA32_GP_FAULT: Self = Self(13); 59 /// Page Fault 60 pub const EXCEPT_IA32_PAGE_FAULT: Self = Self(14); 61 /// x87 Floating-Point Exception 62 pub const EXCEPT_IA32_FP_ERROR: Self = Self(16); 63 /// Alignment Check 64 pub const EXCEPT_IA32_ALIGNMENT_CHECK: Self = Self(17); 65 /// Machine Check 66 pub const EXCEPT_IA32_MACHINE_CHECK: Self = Self(18); 67 /// SIMD Floating-Point Exception 68 pub const EXCEPT_IA32_SIMD: Self = Self(19); 69 } 70 71 #[cfg(target_arch = "x86_64")] 72 impl ExceptionType { 73 /// Divide-by-zero Error 74 pub const EXCEPT_X64_DIVIDE_ERROR: Self = Self(0); 75 /// Debug Exception 76 pub const EXCEPT_X64_DEBUG: Self = Self(1); 77 /// Non-maskable Interrupt 78 pub const EXCEPT_X64_NMI: Self = Self(2); 79 /// Breakpoint 80 pub const EXCEPT_X64_BREAKPOINT: Self = Self(3); 81 /// Overflow 82 pub const EXCEPT_X64_OVERFLOW: Self = Self(4); 83 /// Bound Range Exceeded 84 pub const EXCEPT_X64_BOUND: Self = Self(5); 85 /// Invalid Opcode 86 pub const EXCEPT_X64_INVALID_OPCODE: Self = Self(6); 87 /// Double Fault 88 pub const EXCEPT_X64_DOUBLE_FAULT: Self = Self(8); 89 /// Invalid TSS 90 pub const EXCEPT_X64_INVALID_TSS: Self = Self(10); 91 /// Segment Not Present 92 pub const EXCEPT_X64_SEG_NOT_PRESENT: Self = Self(11); 93 /// Stack-Segment Fault 94 pub const EXCEPT_X64_STACK_FAULT: Self = Self(12); 95 /// General Protection Fault 96 pub const EXCEPT_X64_GP_FAULT: Self = Self(13); 97 /// Page Fault 98 pub const EXCEPT_X64_PAGE_FAULT: Self = Self(14); 99 /// x87 Floating-Point Exception 100 pub const EXCEPT_X64_FP_ERROR: Self = Self(16); 101 /// Alignment Check 102 pub const EXCEPT_X64_ALIGNMENT_CHECK: Self = Self(17); 103 /// Machine Check 104 pub const EXCEPT_X64_MACHINE_CHECK: Self = Self(18); 105 /// SIMD Floating-Point Exception 106 pub const EXCEPT_X64_SIMD: Self = Self(19); 107 } 108 109 #[cfg(target_arch = "arm")] 110 impl ExceptionType { 111 /// Processor reset 112 pub const EXCEPT_ARM_RESET: Self = Self(0); 113 /// Undefined instruction 114 pub const EXCEPT_ARM_UNDEFINED_INSTRUCTION: Self = Self(1); 115 /// Software Interrupt 116 pub const EXCEPT_ARM_SOFTWARE_INTERRUPT: Self = Self(2); 117 /// Prefetch aborted 118 pub const EXCEPT_ARM_PREFETCH_ABORT: Self = Self(3); 119 /// Data access memory abort 120 pub const EXCEPT_ARM_DATA_ABORT: Self = Self(4); 121 /// Reserved 122 pub const EXCEPT_ARM_RESERVED: Self = Self(5); 123 /// Normal interrupt 124 pub const EXCEPT_ARM_IRQ: Self = Self(6); 125 /// Fast interrupt 126 pub const EXCEPT_ARM_FIQ: Self = Self(7); 127 /// In the UEFI spec for "convenience", unsure if we'll need it. Set to `EXCEPT_ARM_FIQ` 128 pub const MAX_ARM_EXCEPTION: Self = Self::EXCEPT_ARM_FIQ; 129 } 130 131 #[cfg(target_arch = "aarch64")] 132 impl ExceptionType { 133 /// Synchronous exception, such as attempting to execute an invalid instruction 134 pub const EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS: Self = Self(0); 135 /// Normal interrupt 136 pub const EXCEPT_AARCH64_IRQ: Self = Self(1); 137 /// Fast interrupt 138 pub const EXCEPT_AARCH64_FIQ: Self = Self(2); 139 /// System Error 140 pub const EXCEPT_AARCH64_SERROR: Self = Self(3); 141 /// In the UEFI spec for "convenience", unsure if we'll need it. Set to `EXCEPT_AARCH64_SERROR` 142 pub const MAX_AARCH64_EXCEPTION: Self = Self::EXCEPT_AARCH64_SERROR; 143 } 144 145 #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))] 146 impl ExceptionType { 147 /// Instruction misaligned 148 pub const EXCEPT_RISCV_INST_MISALIGNED: Self = Self(0); 149 /// Instruction access fault 150 pub const EXCEPT_RISCV_INST_ACCESS_FAULT: Self = Self(1); 151 /// Illegal instruction 152 pub const EXCEPT_RISCV_ILLEGAL_INST: Self = Self(2); 153 /// Breakpoint 154 pub const EXCEPT_RISCV_BREAKPOINT: Self = Self(3); 155 /// Load address misaligned 156 pub const EXCEPT_RISCV_LOAD_ADDRESS_MISALIGNED: Self = Self(4); 157 /// Load accept fault 158 pub const EXCEPT_RISCV_LOAD_ACCESS_FAULT: Self = Self(5); 159 /// Store AMO address misaligned 160 pub const EXCEPT_RISCV_STORE_AMO_ADDRESS_MISALIGNED: Self = Self(6); 161 /// Store AMO access fault 162 pub const EXCEPT_RISCV_STORE_AMO_ACCESS_FAULT: Self = Self(7); 163 /// ECALL from User mode 164 pub const EXCEPT_RISCV_ENV_CALL_FROM_UMODE: Self = Self(8); 165 /// ECALL from Supervisor mode 166 pub const EXCEPT_RISCV_ENV_CALL_FROM_SMODE: Self = Self(9); 167 /// ECALL from Machine mode 168 pub const EXCEPT_RISCV_ENV_CALL_FROM_MMODE: Self = Self(11); 169 /// Instruction page fault 170 pub const EXCEPT_RISCV_INST_PAGE_FAULT: Self = Self(12); 171 /// Load page fault 172 pub const EXCEPT_RISCV_LOAD_PAGE_FAULT: Self = Self(13); 173 /// Store AMO page fault 174 pub const EXCEPT_RISCV_STORE_AMO_PAGE_FAULT: Self = Self(15); 175 // RISC-V interrupt types 176 /// Supervisor software interrupt 177 pub const EXCEPT_RISCV_SUPERVISOR_SOFTWARE_INT: Self = Self(1); 178 /// Machine software interrupt 179 pub const EXCEPT_RISCV_MACHINE_SOFTWARE_INT: Self = Self(3); 180 /// Supervisor timer interrupt 181 pub const EXCEPT_RISCV_SUPERVISOR_TIMER_INT: Self = Self(5); 182 /// Machine timer interrupt 183 pub const EXCEPT_RISCV_MACHINE_TIMER_INT: Self = Self(7); 184 /// Supervisor external interrupt 185 pub const EXCEPT_RISCV_SUPERVISOR_EXTERNAL_INT: Self = Self(9); 186 /// Machine external interrupt 187 pub const EXCEPT_RISCV_MACHINE_EXTERNAL_INT: Self = Self(11); 188 }