OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_OSX_CRASH_FILTER_H_ | 7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_OSX_MACH_THREAD_TRUSTED_STATE_
H_ |
8 #define NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_OSX_CRASH_FILTER_H_ 1 | 8 #define NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_OSX_MACH_THREAD_TRUSTED_STATE_
H_ 1 |
9 | 9 |
10 | 10 |
11 #include <mach/port.h> | 11 #include <mach/mach.h> |
12 | 12 |
13 #include "native_client/src/include/nacl_base.h" | 13 #include "native_client/src/include/nacl_base.h" |
14 | 14 |
15 EXTERN_C_BEGIN | 15 EXTERN_C_BEGIN |
16 | 16 |
| 17 #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_x86 |
| 18 |
17 /* | 19 /* |
18 * This function is intended for use by Chromium's embedding of | 20 * This function is intended for use by Chromium's embedding of |
19 * Breakpad crash reporting. Given the Mach port for a thread in this | 21 * Breakpad crash reporting. Given the Mach port for a thread in this |
20 * process that has crashed (and is suspended), this function returns | 22 * process that has crashed (and is suspended), this function returns |
21 * whether the thread crashed inside NaCl untrusted code. This is | 23 * whether the thread crashed inside NaCl untrusted code. This is |
22 * used for deciding whether to report the crash. | 24 * used for deciding whether to report the crash. |
23 */ | 25 */ |
24 int NaClMachThreadIsInUntrusted(mach_port_t thread_port); | 26 int NaClMachThreadIsInUntrusted(mach_port_t thread_port); |
25 | 27 |
| 28 /* |
| 29 * The internal implementation of NaClMachThreadIsInUntrusted. This function |
| 30 * may be called by Native Client's own Mach exception handler to determine |
| 31 * whether an exception occurred in untrusted code. |
| 32 * |
| 33 * Determining whether code is untrusted, for the purposes of this function, |
| 34 * considers only the executing code based on the code segment (32-bit x86) or |
| 35 * instruction pointer (x86_64). This is sufficient for determining whether |
| 36 * the executing code is untrusted. Callers that are concerned that trusted |
| 37 * code may have jumped to untrusted code may also want to consider |
| 38 * natp->suspend_state before deciding how to proceed. |
| 39 */ |
| 40 int NaClMachThreadStateIsInUntrusted(x86_thread_state_t *state, |
| 41 size_t nacl_thread_index); |
| 42 |
| 43 #endif /* NACL_ARCH(NACL_BUILD_ARCH) */ |
| 44 |
26 EXTERN_C_END | 45 EXTERN_C_END |
27 | 46 |
28 | 47 |
29 #endif | 48 #endif /* NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_OSX_MACH_THREAD_TRUSTED_STA
TE_H_ */ |
OLD | NEW |