| 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 "native_client/tests/thread_capture/thread_capture_test_injection.h" | 7 #include "native_client/tests/thread_capture/thread_capture_test_injection.h" |
| 8 | 8 |
| 9 #include "native_client/src/include/portability.h" | 9 #include "native_client/src/include/portability.h" |
| 10 #include "native_client/src/trusted/service_runtime/include/bits/nacl_syscalls.h
" | 10 #include "native_client/src/trusted/service_runtime/include/bits/nacl_syscalls.h
" |
| 11 #include "native_client/src/trusted/service_runtime/nacl_app_thread.h" | 11 #include "native_client/src/trusted/service_runtime/nacl_app_thread.h" |
| 12 #include "native_client/src/trusted/service_runtime/nacl_copy.h" | 12 #include "native_client/src/trusted/service_runtime/nacl_copy.h" |
| 13 #include "native_client/src/trusted/service_runtime/nacl_syscall_common.h" | 13 #include "native_client/src/trusted/service_runtime/nacl_syscall_common.h" |
| 14 #include "native_client/src/trusted/service_runtime/sel_ldr.h" | 14 #include "native_client/src/trusted/service_runtime/sel_ldr.h" |
| 15 #include "native_client/src/trusted/service_runtime/sel_rt.h" | 15 #include "native_client/src/trusted/service_runtime/sel_rt.h" |
| 16 #include "native_client/src/trusted/validator/x86/nacl_cpuid.h" | 16 #include "native_client/src/trusted/cpu_features/arch/x86/cpu_x86.h" |
| 17 | 17 |
| 18 static int32_t TestSyscall(struct NaClAppThread *natp) { | 18 static int32_t TestSyscall(struct NaClAppThread *natp) { |
| 19 /* TODO(mcgrathr): Use a safe cast here. */ | 19 /* TODO(mcgrathr): Use a safe cast here. */ |
| 20 NaClCPUFeaturesX86 *features = (NaClCPUFeaturesX86 *) natp->nap->cpu_features; | 20 NaClCPUFeaturesX86 *features = (NaClCPUFeaturesX86 *) natp->nap->cpu_features; |
| 21 if (NaClGetCPUFeatureX86(features, NaClCPUFeatureX86_SSE)) { | 21 if (NaClGetCPUFeatureX86(features, NaClCPUFeatureX86_SSE)) { |
| 22 g_nacl_syscall_thread_capture_fault_addr = | 22 g_nacl_syscall_thread_capture_fault_addr = |
| 23 (uintptr_t) &NaClSyscallThreadCaptureFaultSSE; | 23 (uintptr_t) &NaClSyscallThreadCaptureFaultSSE; |
| 24 } else { | 24 } else { |
| 25 g_nacl_syscall_thread_capture_fault_addr = | 25 g_nacl_syscall_thread_capture_fault_addr = |
| 26 (uintptr_t) &NaClSyscallThreadCaptureFaultNoSSE; | 26 (uintptr_t) &NaClSyscallThreadCaptureFaultNoSSE; |
| 27 } | 27 } |
| 28 | 28 |
| 29 NaClCopyInDropLock(natp->nap); | 29 NaClCopyInDropLock(natp->nap); |
| 30 | 30 |
| 31 natp->user.gs = natp->user.trusted_gs; | 31 natp->user.gs = natp->user.trusted_gs; |
| 32 | 32 |
| 33 return 0; | 33 return 0; |
| 34 } | 34 } |
| 35 | 35 |
| 36 void NaClInjectThreadCaptureSyscall(struct NaClApp *nap) { | 36 void NaClInjectThreadCaptureSyscall(struct NaClApp *nap) { |
| 37 UNREFERENCED_PARAMETER(nap); | 37 UNREFERENCED_PARAMETER(nap); |
| 38 | 38 |
| 39 NaClAddSyscall(NACL_sys_test_syscall_1, TestSyscall); | 39 NaClAddSyscall(NACL_sys_test_syscall_1, TestSyscall); |
| 40 } | 40 } |
| OLD | NEW |