| 1 |
#![allow(non_camel_case_types)] |
| 2 |
#![allow(non_upper_case_globals)] |
| 3 |
|
| 4 |
use num_derive::FromPrimitive; |
| 5 |
|
| 6 |
/// Values for |
| 7 |
/// [`MINIDUMP_EXCEPTION::exception_code`](crate::format::MINIDUMP_EXCEPTION::exception_code) |
| 8 |
/// for crashes on macOS. |
| 9 |
/// |
| 10 |
/// Based on Darwin/macOS' [osfmk/mach/exception_types.h][header]. This is what macOS calls an "exception", |
| 11 |
/// not a "code". |
| 12 |
/// |
| 13 |
/// [header]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/mach/exception_types.h#L64-L105 |
| 14 |
#[repr(u32)] |
| 15 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 16 |
pub enum ExceptionCodeMac { |
| 17 |
/// code can be a kern_return_t |
| 18 |
EXC_BAD_ACCESS = 1, |
| 19 |
/// code is CPU-specific |
| 20 |
EXC_BAD_INSTRUCTION = 2, |
| 21 |
/// code is CPU-specific |
| 22 |
EXC_ARITHMETIC = 3, |
| 23 |
/// code is CPU-specific |
| 24 |
EXC_EMULATION = 4, |
| 25 |
EXC_SOFTWARE = 5, |
| 26 |
/// code is CPU-specific |
| 27 |
EXC_BREAKPOINT = 6, |
| 28 |
EXC_SYSCALL = 7, |
| 29 |
EXC_MACH_SYSCALL = 8, |
| 30 |
EXC_RPC_ALERT = 9, |
| 31 |
EXC_RESOURCE = 11, |
| 32 |
EXC_GUARD = 12, |
| 33 |
/// Fake exception code used by Crashpad's SimulateCrash ('CPsx') |
| 34 |
SIMULATED = 0x43507378, |
| 35 |
} |
| 36 |
|
| 37 |
/// Mac/iOS Kernel Bad Access Exceptions |
| 38 |
/// |
| 39 |
/// These are the relevant kern_return_t values from [osfmk/mach/kern_return.h][header] |
| 40 |
/// |
| 41 |
/// [header]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/mach/kern_return.h#L70-L340 |
| 42 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 43 |
pub enum ExceptionCodeMacBadAccessKernType { |
| 44 |
KERN_INVALID_ADDRESS = 1, |
| 45 |
KERN_PROTECTION_FAILURE = 2, |
| 46 |
KERN_FAILURE = 5, |
| 47 |
KERN_NO_ACCESS = 8, |
| 48 |
KERN_MEMORY_FAILURE = 9, |
| 49 |
KERN_MEMORY_ERROR = 10, |
| 50 |
KERN_CODESIGN_ERROR = 50, |
| 51 |
} |
| 52 |
|
| 53 |
/// Mac/iOS ARM Userland Bad Accesses Exceptions |
| 54 |
/// |
| 55 |
/// See the [osfmk/mach/arm/exception.h][header] header in Apple's kernel sources |
| 56 |
/// |
| 57 |
/// [header]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/mach/arm/exception.h#L66-L75 |
| 58 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 59 |
pub enum ExceptionCodeMacBadAccessArmType { |
| 60 |
EXC_ARM_DA_ALIGN = 0x0101, |
| 61 |
EXC_ARM_DA_DEBUG = 0x0102, |
| 62 |
EXC_ARM_SP_ALIGN = 0x0103, |
| 63 |
EXC_ARM_SWP = 0x0104, |
| 64 |
EXC_ARM_PAC_FAIL = 0x0105, |
| 65 |
} |
| 66 |
|
| 67 |
/// Mac/iOS PowerPC Userland Bad Access Exceptions |
| 68 |
/// |
| 69 |
/// See the [osfmk/mach/ppc/exception.h][header] header in Apple's kernel sources |
| 70 |
/// |
| 71 |
/// [header]: https://github.com/apple/darwin-xnu/blob/b472f0612b8556cd1c6eb1c285ec1953de759e35/osfmk/mach/ppc/exception.h#L71-L78 |
| 72 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 73 |
pub enum ExceptionCodeMacBadAccessPpcType { |
| 74 |
EXC_PPC_VM_PROT_READ = 0x0101, |
| 75 |
EXC_PPC_BADSPACE = 0x0102, |
| 76 |
EXC_PPC_UNALIGNED = 0x0103, |
| 77 |
} |
| 78 |
|
| 79 |
/// Mac/iOS x86 Userland Bad Access Exceptions |
| 80 |
/// |
| 81 |
/// See the [osfmk/mach/i386/exception.h][header] header in Apple's kernel sources |
| 82 |
/// |
| 83 |
/// [header]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/mach/i386/exception.h#L122 |
| 84 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 85 |
pub enum ExceptionCodeMacBadAccessX86Type { |
| 86 |
EXC_I386_GPFLT = 13, |
| 87 |
} |
| 88 |
|
| 89 |
/// Mac/iOS ARM Bad Instruction Exceptions |
| 90 |
/// |
| 91 |
/// See the [osfmk/mach/arm/exception.h][header] header in Apple's kernel sources |
| 92 |
/// |
| 93 |
/// [header]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/mach/arm/exception.h#L48-L52 |
| 94 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 95 |
pub enum ExceptionCodeMacBadInstructionArmType { |
| 96 |
EXC_ARM_UNDEFINED = 1, |
| 97 |
} |
| 98 |
|
| 99 |
/// Mac/iOS PowerPC Bad Instruction Exceptions |
| 100 |
/// |
| 101 |
/// See the [osfmk/mach/ppc/exception.h][header] header in Apple's kernel sources |
| 102 |
/// |
| 103 |
/// [header]: https://github.com/apple/darwin-xnu/blob/b472f0612b8556cd1c6eb1c285ec1953de759e35/osfmk/mach/ppc/exception.h#L60-L69 |
| 104 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 105 |
pub enum ExceptionCodeMacBadInstructionPpcType { |
| 106 |
EXC_PPC_INVALID_SYSCALL = 1, |
| 107 |
EXC_PPC_UNIPL_INST = 2, |
| 108 |
EXC_PPC_PRIVINST = 3, |
| 109 |
EXC_PPC_PRIVREG = 4, |
| 110 |
EXC_PPC_TRACE = 5, |
| 111 |
EXC_PPC_PERFMON = 6, |
| 112 |
} |
| 113 |
|
| 114 |
/// Mac/iOS x86 Bad Instruction Exceptions |
| 115 |
/// |
| 116 |
/// See the [osfmk/mach/i386/exception.h][header] header in Apple's kernel sources |
| 117 |
/// |
| 118 |
/// [header]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/mach/i386/exception.h#L74-L78 |
| 119 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 120 |
pub enum ExceptionCodeMacBadInstructionX86Type { |
| 121 |
/// Invalid Operation |
| 122 |
EXC_I386_INVOP = 1, |
| 123 |
|
| 124 |
// The rest of these are raw x86 interrupt codes. |
| 125 |
/// Invalid Task State Segment |
| 126 |
EXC_I386_INVTSSFLT = 10, |
| 127 |
/// Segment Not Present |
| 128 |
EXC_I386_SEGNPFLT = 11, |
| 129 |
/// Stack Fault |
| 130 |
EXC_I386_STKFLT = 12, |
| 131 |
/// General Protection Fault |
| 132 |
EXC_I386_GPFLT = 13, |
| 133 |
/// Alignment Fault |
| 134 |
EXC_I386_ALIGNFLT = 17, |
| 135 |
// For sake of completeness, here's the interrupt codes that won't show up here (and why): |
| 136 |
|
| 137 |
// EXC_I386_DIVERR = 0: mapped to EXC_ARITHMETIC/EXC_I386_DIV |
| 138 |
// EXC_I386_SGLSTP = 1: mapped to EXC_BREAKPOINT/EXC_I386_SGL |
| 139 |
// EXC_I386_NMIFLT = 2: should not occur in user space |
| 140 |
// EXC_I386_BPTFLT = 3: mapped to EXC_BREAKPOINT/EXC_I386_BPT |
| 141 |
// EXC_I386_INTOFLT = 4: mapped to EXC_ARITHMETIC/EXC_I386_INTO |
| 142 |
// EXC_I386_BOUNDFLT = 5: mapped to EXC_ARITHMETIC/EXC_I386_BOUND |
| 143 |
// EXC_I386_INVOPFLT = 6: mapped to EXC_BAD_INSTRUCTION/EXC_I386_INVOP |
| 144 |
// EXC_I386_NOEXTFLT = 7: should be handled by the kernel |
| 145 |
// EXC_I386_DBLFLT = 8: should be handled (if possible) by the kernel |
| 146 |
// EXC_I386_EXTOVRFLT = 9: mapped to EXC_BAD_ACCESS/(PROT_READ|PROT_EXEC) |
| 147 |
// EXC_I386_PGFLT = 14: should not occur in user space |
| 148 |
// EXC_I386_EXTERRFLT = 16: mapped to EXC_ARITHMETIC/EXC_I386_EXTERR |
| 149 |
// EXC_I386_ENOEXTFLT = 32: should be handled by the kernel |
| 150 |
// EXC_I386_ENDPERR = 33: should not occur |
| 151 |
} |
| 152 |
|
| 153 |
/// Mac/iOS ARM Arithmetic Exceptions |
| 154 |
/// |
| 155 |
/// See the [osfmk/mach/arm/exception.h][header] header in Apple's kernel sources |
| 156 |
/// |
| 157 |
/// [header]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/mach/arm/exception.h#L54-L64 |
| 158 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 159 |
pub enum ExceptionCodeMacArithmeticArmType { |
| 160 |
EXC_ARM_FP_IO = 1, |
| 161 |
EXC_ARM_FP_DZ = 2, |
| 162 |
EXC_ARM_FP_OF = 3, |
| 163 |
EXC_ARM_FP_UF = 4, |
| 164 |
EXC_ARM_FP_IX = 5, |
| 165 |
EXC_ARM_FP_ID = 6, |
| 166 |
} |
| 167 |
|
| 168 |
/// Mac/iOS PowerPC Arithmetic Exceptions |
| 169 |
/// |
| 170 |
/// See the [osfmk/mach/ppc/exception.h][header] header in Apple's kernel sources |
| 171 |
/// |
| 172 |
/// [header]: https://github.com/apple/darwin-xnu/blob/b472f0612b8556cd1c6eb1c285ec1953de759e35/osfmk/mach/ppc/exception.h#L80-L90 |
| 173 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 174 |
pub enum ExceptionCodeMacArithmeticPpcType { |
| 175 |
/// Integer ovrflow |
| 176 |
EXC_PPC_OVERFLOW = 1, |
| 177 |
/// Integer Divide-By-Zero |
| 178 |
EXC_PPC_ZERO_DIVIDE = 2, |
| 179 |
/// Float Inexact |
| 180 |
EXC_FLT_INEXACT = 3, |
| 181 |
/// Float Divide-By-Zero |
| 182 |
EXC_PPC_FLT_ZERO_DIVIDE = 4, |
| 183 |
/// Float Underflow |
| 184 |
EXC_PPC_FLT_UNDERFLOW = 5, |
| 185 |
/// Float Overflow |
| 186 |
EXC_PPC_FLT_OVERFLOW = 6, |
| 187 |
/// Float Not A Number |
| 188 |
EXC_PPC_FLT_NOT_A_NUMBER = 7, |
| 189 |
|
| 190 |
// NOTE: comments in breakpad suggest these two are actually supposed to be |
| 191 |
// for ExceptionCodeMac::EXC_EMULATION, but for now let's duplicate breakpad. |
| 192 |
EXC_PPC_NOEMULATION = 8, |
| 193 |
EXC_PPC_ALTIVECASSIST = 9, |
| 194 |
} |
| 195 |
|
| 196 |
/// Mac/iOS x86 Arithmetic Exceptions |
| 197 |
/// |
| 198 |
/// See the [osfmk/mach/i386/exception.h][header] header in Apple's kernel sources |
| 199 |
/// |
| 200 |
/// [header]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/mach/i386/exception.h#L80-L91 |
| 201 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 202 |
pub enum ExceptionCodeMacArithmeticX86Type { |
| 203 |
EXC_I386_DIV = 1, |
| 204 |
EXC_I386_INTO = 2, |
| 205 |
EXC_I386_NOEXT = 3, |
| 206 |
EXC_I386_EXTOVR = 4, |
| 207 |
EXC_I386_EXTERR = 5, |
| 208 |
EXC_I386_EMERR = 6, |
| 209 |
EXC_I386_BOUND = 7, |
| 210 |
EXC_I386_SSEEXTERR = 8, |
| 211 |
} |
| 212 |
|
| 213 |
/// Mac/iOS "Software" Exceptions |
| 214 |
/// |
| 215 |
/// See the [bsd/sys/ux_exception.h][header1] and [osfmk/mach/ppc/exception.h][header2] |
| 216 |
/// headers in Apple's kernel sources |
| 217 |
/// |
| 218 |
/// [header1]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/sys/ux_exception.h#L48-L52 |
| 219 |
/// [header2]: https://github.com/apple/darwin-xnu/blob/b472f0612b8556cd1c6eb1c285ec1953de759e35/osfmk/mach/ppc/exception.h#L100-L105 |
| 220 |
#[repr(u32)] |
| 221 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 222 |
pub enum ExceptionCodeMacSoftwareType { |
| 223 |
SIGABRT = 0x00010002u32, |
| 224 |
UNCAUGHT_NS_EXCEPTION = 0xDEADC0DE, |
| 225 |
EXC_PPC_TRAP = 0x00000001, |
| 226 |
EXC_PPC_MIGRATE = 0x00010100, |
| 227 |
// Breakpad also defines these doesn't use them for Software crashes |
| 228 |
// SIGSYS = 0x00010000, |
| 229 |
// SIGPIPE = 0x00010001, |
| 230 |
} |
| 231 |
|
| 232 |
/// Mac/iOS ARM Breakpoint Exceptions |
| 233 |
/// |
| 234 |
/// See the [osfmk/mach/arm/exception.h][header] header in Apple's kernel sources |
| 235 |
/// |
| 236 |
/// [header]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/mach/arm/exception.h#L77-L81 |
| 237 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 238 |
pub enum ExceptionCodeMacBreakpointArmType { |
| 239 |
EXC_ARM_BREAKPOINT = 1, |
| 240 |
} |
| 241 |
|
| 242 |
/// Mac/iOS PowerPC Breakpoint Exceptions |
| 243 |
/// |
| 244 |
/// See the [osfmk/mach/ppc/exception.h][header] header in Apple's kernel sources |
| 245 |
/// |
| 246 |
/// [header]: https://github.com/apple/darwin-xnu/blob/b472f0612b8556cd1c6eb1c285ec1953de759e35/osfmk/mach/ppc/exception.h#L108-L112 |
| 247 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 248 |
pub enum ExceptionCodeMacBreakpointPpcType { |
| 249 |
EXC_PPC_BREAKPOINT = 1, |
| 250 |
} |
| 251 |
|
| 252 |
/// Mac/iOS x86 Breakpoint Exceptions |
| 253 |
/// |
| 254 |
/// See the [osfmk/mach/i386/exception.h][header] header in Apple's kernel sources |
| 255 |
/// |
| 256 |
/// [header]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/mach/i386/exception.h#L102-L107 |
| 257 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 258 |
pub enum ExceptionCodeMacBreakpointX86Type { |
| 259 |
EXC_I386_SGL = 1, |
| 260 |
EXC_I386_BPT = 2, |
| 261 |
} |
| 262 |
|
| 263 |
/// Mac/iOS Resource exception types |
| 264 |
/// |
| 265 |
/// See the [osfmk/kern/exc_resource.h][header] header in Apple's kernel sources |
| 266 |
/// |
| 267 |
/// [header]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/kern/exc_resource.h#L60-L65 |
| 268 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 269 |
pub enum ExceptionCodeMacResourceType { |
| 270 |
RESOURCE_TYPE_CPU = 1, |
| 271 |
RESOURCE_TYPE_WAKEUPS = 2, |
| 272 |
RESOURCE_TYPE_MEMORY = 3, |
| 273 |
RESOURCE_TYPE_IO = 4, |
| 274 |
RESOURCE_TYPE_THREADS = 5, |
| 275 |
} |
| 276 |
|
| 277 |
/// Mac/iOS CPU resource exception flavors |
| 278 |
/// |
| 279 |
/// See the [osfmk/kern/exc_resource.h][header] header in Apple's kernel sources |
| 280 |
/// |
| 281 |
/// [header]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/kern/exc_resource.h#L67-L69 |
| 282 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 283 |
pub enum ExceptionCodeMacResourceCpuFlavor { |
| 284 |
FLAVOR_CPU_MONITOR = 1, |
| 285 |
FLAVOR_CPU_MONITOR_FATAL = 2, |
| 286 |
} |
| 287 |
|
| 288 |
/// Mac/iOS wakeups resource exception flavors |
| 289 |
/// |
| 290 |
/// See the [osfmk/kern/exc_resource.h][header] header in Apple's kernel sources |
| 291 |
/// |
| 292 |
/// [header]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/kern/exc_resource.h#L67-L69 |
| 293 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 294 |
pub enum ExceptionCodeMacResourceWakeupsFlavor { |
| 295 |
FLAVOR_WAKEUPS_MONITOR = 1, |
| 296 |
} |
| 297 |
|
| 298 |
/// Mac/iOS memory resource exception flavors |
| 299 |
/// |
| 300 |
/// See the [osfmk/kern/exc_resource.h][header] header in Apple's kernel sources |
| 301 |
/// |
| 302 |
/// [header]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/kern/exc_resource.h#L102-L103 |
| 303 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 304 |
pub enum ExceptionCodeMacResourceMemoryFlavor { |
| 305 |
FLAVOR_HIGH_WATERMARK = 1, |
| 306 |
} |
| 307 |
|
| 308 |
/// Mac/iOS I/O resource exception flavors |
| 309 |
/// |
| 310 |
/// See the [osfmk/kern/exc_resource.h][header] header in Apple's kernel sources |
| 311 |
/// |
| 312 |
/// [header]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/kern/exc_resource.h#L164-L166 |
| 313 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 314 |
pub enum ExceptionCodeMacResourceIOFlavor { |
| 315 |
FLAVOR_IO_PHYSICAL_WRITES = 1, |
| 316 |
FLAVOR_IO_LOGICAL_WRITES = 2, |
| 317 |
} |
| 318 |
|
| 319 |
/// Mac/iOS threads resource exception flavors |
| 320 |
/// |
| 321 |
/// See the [osfmk/kern/exc_resource.h][header] header in Apple's kernel sources |
| 322 |
/// |
| 323 |
/// [header]: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/kern/exc_resource.h#L136-L137 |
| 324 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 325 |
pub enum ExceptionCodeMacResourceThreadsFlavor { |
| 326 |
FLAVOR_THREADS_HIGH_WATERMARK = 1, |
| 327 |
} |
| 328 |
|
| 329 |
/// Mac/iOS Guard exception types |
| 330 |
/// |
| 331 |
/// See the [osfmk/kern/exc_guard.h][header] header in Apple's kernel sources |
| 332 |
/// |
| 333 |
/// [header]: https://github.com/apple-oss-distributions/xnu/blob/main/osfmk/kern/exc_guard.h |
| 334 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 335 |
pub enum ExceptionCodeMacGuardType { |
| 336 |
GUARD_TYPE_NONE = 0, |
| 337 |
GUARD_TYPE_MACH_PORT = 1, |
| 338 |
GUARD_TYPE_FD = 2, |
| 339 |
GUARD_TYPE_USER = 3, |
| 340 |
GUARD_TYPE_VN = 4, |
| 341 |
GUARD_TYPE_VIRT_MEMORY = 5, |
| 342 |
GUARD_TYPE_REJECTED_SC = 6, |
| 343 |
} |
| 344 |
|
| 345 |
/// Mac/iOS Mach port guard exception flavors |
| 346 |
/// |
| 347 |
/// See the [osfmk/mach/port.h][header] header in Apple's kernel sources |
| 348 |
/// |
| 349 |
/// [header]: https://github.com/apple-oss-distributions/xnu/blob/main/osfmk/mach/port.h |
| 350 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 351 |
pub enum ExceptionCodeMacGuardMachPortFlavor { |
| 352 |
GUARD_EXC_DESTROY = 1, |
| 353 |
GUARD_EXC_MOD_REFS = 2, |
| 354 |
GUARD_EXC_INVALID_OPTIONS = 3, |
| 355 |
GUARD_EXC_SET_CONTEXT = 4, |
| 356 |
GUARD_EXC_THREAD_SET_STATE = 5, |
| 357 |
GUARD_EXC_UNGUARDED = 0x00000008, |
| 358 |
GUARD_EXC_INCORRECT_GUARD = 0x00000010, |
| 359 |
GUARD_EXC_IMMOVABLE = 0x00000020, |
| 360 |
GUARD_EXC_STRICT_REPLY = 0x00000040, |
| 361 |
GUARD_EXC_MSG_FILTERED = 0x00000080, |
| 362 |
GUARD_EXC_INVALID_RIGHT = 0x00000100, |
| 363 |
GUARD_EXC_INVALID_NAME = 0x00000200, |
| 364 |
GUARD_EXC_INVALID_VALUE = 0x00000400, |
| 365 |
GUARD_EXC_INVALID_ARGUMENT = 0x00000800, |
| 366 |
GUARD_EXC_RIGHT_EXISTS = 0x00001000, |
| 367 |
GUARD_EXC_KERN_NO_SPACE = 0x00002000, |
| 368 |
GUARD_EXC_KERN_FAILURE = 0x00004000, |
| 369 |
GUARD_EXC_KERN_RESOURCE = 0x00008000, |
| 370 |
GUARD_EXC_SEND_INVALID_REPLY = 0x00010000, |
| 371 |
GUARD_EXC_SEND_INVALID_VOUCHER = 0x00020000, |
| 372 |
GUARD_EXC_SEND_INVALID_RIGHT = 0x00040000, |
| 373 |
GUARD_EXC_RCV_INVALID_NAME = 0x00080000, |
| 374 |
GUARD_EXC_RCV_GUARDED_DESC = 0x00100000, |
| 375 |
GUARD_EXC_MOD_REFS_NON_FATAL = 0x00200000, |
| 376 |
GUARD_EXC_IMMOVABLE_NON_FATAL = 0x00400000, |
| 377 |
GUARD_EXC_REQUIRE_REPLY_PORT_SEMANTICS = 0x00800000, |
| 378 |
GUARD_EXC_EXCEPTION_BEHAVIOR_ENFORCE = 0x01000000, |
| 379 |
} |
| 380 |
|
| 381 |
/// Mac/iOS fd guard exception flavors |
| 382 |
/// |
| 383 |
/// See the [bsd/sys/guarded.h][header] header in Apple's kernel sources |
| 384 |
/// |
| 385 |
/// [header]: https://github.com/apple/darwin-xnu/blob/main/bsd/sys/guarded.h |
| 386 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 387 |
pub enum ExceptionCodeMacGuardFDFlavor { |
| 388 |
GUARD_EXC_CLOSE = 0x00000001, |
| 389 |
GUARD_EXC_DUP = 0x00000002, |
| 390 |
GUARD_EXC_NOCLOEXEC = 0x00000004, |
| 391 |
GUARD_EXC_SOCKET_IPC = 0x00000008, |
| 392 |
GUARD_EXC_FILEPORT = 0x00000010, |
| 393 |
GUARD_EXC_MISMATCH = 0x00000020, |
| 394 |
GUARD_EXC_WRITE = 0x00000040, |
| 395 |
} |
| 396 |
|
| 397 |
/// Mac/iOS vnode guard exception flavors |
| 398 |
/// |
| 399 |
/// See the [bsd/sys/guarded.h][header] header in Apple's kernel sources |
| 400 |
/// |
| 401 |
/// [header]: https://github.com/apple/darwin-xnu/blob/main/bsd/sys/guarded.h |
| 402 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 403 |
pub enum ExceptionCodeMacGuardVNFlavor { |
| 404 |
GUARD_EXC_RENAME_TO = 0x00000001, |
| 405 |
GUARD_EXC_RENAME_FROM = 0x00000002, |
| 406 |
GUARD_EXC_UNLINK = 0x00000004, |
| 407 |
GUARD_EXC_WRITE_OTHER = 0x00000008, |
| 408 |
GUARD_EXC_TRUNC_OTHER = 0x00000010, |
| 409 |
GUARD_EXC_LINK = 0x00000020, |
| 410 |
GUARD_EXC_EXCHDATA = 0x00000040, |
| 411 |
} |
| 412 |
|
| 413 |
/// Mac/iOS virtual memory guard exception flavors |
| 414 |
/// |
| 415 |
/// See the [osfmk/mach/vm_statistics.h][header] header in Apple's kernel sources |
| 416 |
/// |
| 417 |
/// [header]: https://github.com/apple/darwin-xnu/blob/main/osfmk/mach/vm_statistics.h |
| 418 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 419 |
pub enum ExceptionCodeMacGuardVirtMemoryFlavor { |
| 420 |
GUARD_EXC_DEALLOC_GAP = 0x00000001, |
| 421 |
} |
| 422 |
|
| 423 |
/// Mac/iOS rejected syscall guard exception flavors |
| 424 |
/// |
| 425 |
/// See the [osfmk/kern/exc_guard.h][header] header in Apple's kernel sources |
| 426 |
/// |
| 427 |
/// [header]: https://github.com/apple-oss-distributions/xnu/blob/1031c584a5e37aff177559b9f69dbd3c8c3fd30a/osfmk/kern/exc_guard.h#L149-L163 |
| 428 |
#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)] |
| 429 |
pub enum ExceptionCodeMacGuardRejecteSysCallFlavor { |
| 430 |
GUARD_EXC_MACH_TRAP = 0x00000000, |
| 431 |
} |