OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 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 #include <signal.h> | 7 #include <signal.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <sys/ucontext.h> | 10 #include <sys/ucontext.h> |
11 | 11 |
12 #include "native_client/src/include/build_config.h" | 12 #include "native_client/src/include/build_config.h" |
13 #include "native_client/src/include/nacl_macros.h" | 13 #include "native_client/src/include/nacl_macros.h" |
14 #include "native_client/src/shared/platform/nacl_check.h" | 14 #include "native_client/src/shared/platform/nacl_check.h" |
15 #include "native_client/src/trusted/service_runtime/nacl_config.h" | 15 #include "native_client/src/trusted/service_runtime/nacl_config.h" |
16 #include "native_client/src/trusted/service_runtime/sel_main.h" | 16 #include "native_client/src/trusted/service_runtime/sel_main.h" |
17 #include "native_client/src/trusted/fault_injection/test_injection.h" | 17 #include "native_client/src/trusted/fault_injection/test_injection.h" |
18 #include "native_client/tests/thread_capture/thread_capture_test_injection.h" | 18 #include "native_client/tests/thread_capture/thread_capture_test_injection.h" |
19 | 19 |
20 #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm | 20 #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm |
21 static const int kExpectedSignal = SIGILL; | 21 static const int kExpectedSignal = SIGILL; |
| 22 #elif NACL_ARCH(NACL_BUILD_ARCH) == NACL_mips |
| 23 static const int kExpectedSignal = SIGTRAP; |
22 #else | 24 #else |
23 static const int kExpectedSignal = SIGSEGV; | 25 static const int kExpectedSignal = SIGSEGV; |
24 #endif | 26 #endif |
25 | 27 |
26 uintptr_t g_nacl_syscall_thread_capture_fault_addr; | 28 uintptr_t g_nacl_syscall_thread_capture_fault_addr; |
27 | 29 |
28 void NaClSignalHandler(int signum, siginfo_t *info, void *other) { | 30 void NaClSignalHandler(int signum, siginfo_t *info, void *other) { |
29 uintptr_t faulting_pc; | 31 uintptr_t faulting_pc; |
30 ucontext_t *ucp; | 32 ucontext_t *ucp; |
31 | 33 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 static struct NaClTestInjectionTable const g_test_injection_functions = { | 101 static struct NaClTestInjectionTable const g_test_injection_functions = { |
100 NaClInjectThreadCaptureSyscall, /* ChangeTrampolines */ | 102 NaClInjectThreadCaptureSyscall, /* ChangeTrampolines */ |
101 NaClSetSignalHandler, /* BeforeMainThreadLaunches */ | 103 NaClSetSignalHandler, /* BeforeMainThreadLaunches */ |
102 }; | 104 }; |
103 | 105 |
104 int main(int argc, char **argv) { | 106 int main(int argc, char **argv) { |
105 NaClTestInjectionSetInjectionTable(&g_test_injection_functions); | 107 NaClTestInjectionSetInjectionTable(&g_test_injection_functions); |
106 (void) NaClSelLdrMain(argc, argv); | 108 (void) NaClSelLdrMain(argc, argv); |
107 return 1; /* fail! */ | 109 return 1; /* fail! */ |
108 } | 110 } |
OLD | NEW |