Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 | 37 |
| 38 exception_mask_t ExcMaskAll() { | 38 exception_mask_t ExcMaskAll() { |
| 39 // This is necessary because of the way that the kernel validates | 39 // This is necessary because of the way that the kernel validates |
| 40 // exception_mask_t arguments to | 40 // exception_mask_t arguments to |
| 41 // {host,task,thread}_{get,set,swap}_exception_ports(). It is strict, | 41 // {host,task,thread}_{get,set,swap}_exception_ports(). It is strict, |
| 42 // rejecting attempts to operate on any bits that it does not recognize. See | 42 // rejecting attempts to operate on any bits that it does not recognize. See |
| 43 // 10.9.4 xnu-2422.110.17/osfmk/mach/ipc_host.c and | 43 // 10.9.4 xnu-2422.110.17/osfmk/mach/ipc_host.c and |
| 44 // xnu-2422.110.17/osfmk/mach/ipc_tt.c. | 44 // xnu-2422.110.17/osfmk/mach/ipc_tt.c. |
| 45 | 45 |
| 46 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9 | 46 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9 |
| 47 int mac_os_x_minor_version = MacOSXMinorVersion(); | 47 const int mac_os_x_minor_version = MacOSXMinorVersion(); |
| 48 #endif | 48 #endif |
| 49 | 49 |
| 50 // See 10.6.8 xnu-1504.15.3/osfmk/mach/exception_types.h. 10.7 uses the same | 50 // See 10.6.8 xnu-1504.15.3/osfmk/mach/exception_types.h. 10.7 uses the same |
| 51 // definition as 10.6. See 10.7.5 xnu-1699.32.7/osfmk/mach/exception_types.h | 51 // definition as 10.6. See 10.7.5 xnu-1699.32.7/osfmk/mach/exception_types.h |
| 52 const exception_mask_t kExcMaskAll_10_6 = | 52 const exception_mask_t kExcMaskAll_10_6 = |
| 53 EXC_MASK_BAD_ACCESS | EXC_MASK_BAD_INSTRUCTION | EXC_MASK_ARITHMETIC | | 53 EXC_MASK_BAD_ACCESS | |
| 54 EXC_MASK_EMULATION | EXC_MASK_SOFTWARE | EXC_MASK_BREAKPOINT | | 54 EXC_MASK_BAD_INSTRUCTION | |
| 55 EXC_MASK_SYSCALL | EXC_MASK_MACH_SYSCALL | EXC_MASK_RPC_ALERT | | 55 EXC_MASK_ARITHMETIC | |
| 56 EXC_MASK_EMULATION | | |
| 57 EXC_MASK_SOFTWARE | | |
| 58 EXC_MASK_BREAKPOINT | | |
| 59 EXC_MASK_SYSCALL | | |
| 60 EXC_MASK_MACH_SYSCALL | | |
| 61 EXC_MASK_RPC_ALERT | | |
| 56 EXC_MASK_MACHINE; | 62 EXC_MASK_MACHINE; |
| 57 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_7 | 63 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8 |
| 58 if (mac_os_x_minor_version <= 7) { | 64 if (mac_os_x_minor_version < 8) { |
| 59 return kExcMaskAll_10_6; | 65 return kExcMaskAll_10_6; |
| 60 } | 66 } |
| 61 #endif | 67 #endif |
| 62 | 68 |
| 63 // 10.8 added EXC_MASK_RESOURCE. See 10.8.5 | 69 // 10.8 added EXC_MASK_RESOURCE. See 10.8.5 |
| 64 // xnu-2050.48.11/osfmk/mach/exception_types.h. | 70 // xnu-2050.48.11/osfmk/mach/exception_types.h. |
| 65 const exception_mask_t kExcMaskAll_10_8 = | 71 const exception_mask_t kExcMaskAll_10_8 = |
| 66 kExcMaskAll_10_6 | EXC_MASK_RESOURCE; | 72 kExcMaskAll_10_6 | EXC_MASK_RESOURCE; |
| 67 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_8 | 73 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9 |
| 68 if (mac_os_x_minor_version <= 8) { | 74 if (mac_os_x_minor_version < 9) { |
| 69 return kExcMaskAll_10_8; | 75 return kExcMaskAll_10_8; |
| 70 } | 76 } |
| 71 #endif | 77 #endif |
| 72 | 78 |
| 73 // 10.9 added EXC_MASK_GUARD. See 10.9.4 | 79 // 10.9 added EXC_MASK_GUARD. See 10.9.4 |
| 74 // xnu-2422.110.17/osfmk/mach/exception_types.h. | 80 // xnu-2422.110.17/osfmk/mach/exception_types.h. |
| 75 const exception_mask_t kExcMaskAll_10_9 = kExcMaskAll_10_8 | EXC_MASK_GUARD; | 81 const exception_mask_t kExcMaskAll_10_9 = kExcMaskAll_10_8 | EXC_MASK_GUARD; |
| 76 return kExcMaskAll_10_9; | 82 return kExcMaskAll_10_9; |
| 77 } | 83 } |
| 78 | 84 |
| 85 exception_mask_t ExcMaskValid() { | |
| 86 const exception_mask_t kExcMaskValid_10_6 = ExcMaskAll() | EXC_MASK_CRASH; | |
| 87 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_11 | |
| 88 if (MacOSXMinorVersion() < 11) { | |
| 89 return kExcMaskValid_10_6; | |
| 90 } | |
| 91 #endif | |
| 92 | |
| 93 const exception_mask_t kExcMaskValid_10_11 = | |
|
Robert Sesek
2015/09/04 17:29:49
Add a comment "10.11 added EXC_MASK_CORPSE_NOTIFY…
| |
| 94 kExcMaskValid_10_6 | EXC_MASK_CORPSE_NOTIFY; | |
| 95 return kExcMaskValid_10_11; | |
| 96 } | |
| 97 | |
| 79 } // namespace crashpad | 98 } // namespace crashpad |
| OLD | NEW |