| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 The Native Client Authors. All rights reserved. | 2 * Copyright 2014 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 <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include "native_client/src/nonsfi/linux/linux_syscall_defines.h" | 9 #include "native_client/src/nonsfi/linux/linux_syscall_defines.h" |
| 10 #include "native_client/src/nonsfi/linux/linux_syscall_structs.h" | 10 #include "native_client/src/nonsfi/linux/linux_syscall_structs.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 __asm__ __volatile__("svc #0\n" | 88 __asm__ __volatile__("svc #0\n" |
| 89 /* | 89 /* |
| 90 * If the return value of clone is non-zero, we are | 90 * If the return value of clone is non-zero, we are |
| 91 * in the parent thread of clone. | 91 * in the parent thread of clone. |
| 92 */ | 92 */ |
| 93 "cmp r0, #0\n" | 93 "cmp r0, #0\n" |
| 94 "bne 0f\n" | 94 "bne 0f\n" |
| 95 /* | 95 /* |
| 96 * In child thread. Clear the frame pointer to | 96 * In child thread. Clear the frame pointer to |
| 97 * prevent debuggers from unwinding beyond this, | 97 * prevent debuggers from unwinding beyond this, |
| 98 * pop the stack to get start_func and call it. | 98 * load start_func from the stack and call it. |
| 99 */ | 99 */ |
| 100 "mov fp, #0\n" | 100 "mov fp, #0\n" |
| 101 "pop {r0}\n" | 101 "ldr r0, [sp]\n" |
| 102 "blx r0\n" | 102 "blx r0\n" |
| 103 /* start_func never finishes. */ | 103 /* start_func never finishes. */ |
| 104 "bkpt #0\n" | 104 "bkpt #0\n" |
| 105 "0:\n" | 105 "0:\n" |
| 106 : "=r"(result) | 106 : "=r"(result) |
| 107 : "r"(sysno), | 107 : "r"(sysno), |
| 108 "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5) | 108 "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5) |
| 109 : "memory"); | 109 : "memory"); |
| 110 #else | 110 #else |
| 111 # error Unsupported architecture | 111 # error Unsupported architecture |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 } | 150 } |
| 151 | 151 |
| 152 void __nc_initialize_interfaces(void) { | 152 void __nc_initialize_interfaces(void) { |
| 153 const struct nacl_irt_thread init = { | 153 const struct nacl_irt_thread init = { |
| 154 nacl_irt_thread_create, | 154 nacl_irt_thread_create, |
| 155 nacl_irt_thread_exit, | 155 nacl_irt_thread_exit, |
| 156 nacl_irt_thread_nice, | 156 nacl_irt_thread_nice, |
| 157 }; | 157 }; |
| 158 __libnacl_irt_thread = init; | 158 __libnacl_irt_thread = init; |
| 159 } | 159 } |
| OLD | NEW |