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/src/trusted/service_runtime/arch/mips/sel_ldr_mips.h" | 7 #include "native_client/src/trusted/service_runtime/arch/mips/sel_ldr_mips.h" |
8 #include "native_client/src/trusted/service_runtime/arch/mips/sel_rt.h" | 8 #include "native_client/src/trusted/service_runtime/arch/mips/sel_rt.h" |
9 #include "native_client/src/trusted/service_runtime/nacl_config.h" | 9 #include "native_client/src/trusted/service_runtime/nacl_config.h" |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 sw $a3, 12($sp) | 81 sw $a3, 12($sp) |
82 sw $a2, 8($sp) | 82 sw $a2, 8($sp) |
83 sw $a1, 4($sp) | 83 sw $a1, 4($sp) |
84 sw $a0, 0($sp) | 84 sw $a0, 0($sp) |
85 /* Save return address for returning to untrusted code. */ | 85 /* Save return address for returning to untrusted code. */ |
86 sw $ra, -4($sp) | 86 sw $ra, -4($sp) |
87 /* Save return address that indicates which trampoline was called. */ | 87 /* Save return address that indicates which trampoline was called. */ |
88 sw $t5, -8($sp) | 88 sw $t5, -8($sp) |
89 | 89 |
90 /* Load the __thread variable's offset into a3. */ | 90 /* Load the __thread variable's offset into a3. */ |
91 lui $a3, %tprel_hi(gNaClThreadIdx) | 91 lui $a3, %tprel_hi(nacl_current_thread) |
92 addiu $a3, $a3, %tprel_lo(gNaClThreadIdx) | 92 addiu $a3, $a3, %tprel_lo(nacl_current_thread) |
93 | 93 |
94 /* Fetch the thread-local variable holding the thread index. */ | 94 /* Fetch the thread-local variable: set a0 = nacl_current_thread */ |
95 rdhwr $v1, $29 | 95 rdhwr $v1, $29 |
96 addu $a3, $v1, $a3 | 96 addu $a3, $v1, $a3 |
97 lw $a1, 0($a3) | 97 lw $a0, 0($a3) |
98 | |
99 /* | |
100 * Load the nacl_user entry of this thread. | |
101 * a0 = nacl_user[a1*4] | |
102 */ | |
103 lw $a0,%got(nacl_user)($28) | |
104 sll $a1, $a1, 2 | |
105 addu $a0, $a0, $a1 | |
106 lw $a0, 0($a0) | |
107 | 98 |
108 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaClSyscallThreadCaptureFault): | 99 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaClSyscallThreadCaptureFault): |
109 sw $s0, NACL_THREAD_CONTEXT_OFFSET_S0($a0) | 100 sw $s0, NACL_THREAD_CONTEXT_OFFSET_S0($a0) |
110 sw $s1, NACL_THREAD_CONTEXT_OFFSET_S1($a0) | 101 sw $s1, NACL_THREAD_CONTEXT_OFFSET_S1($a0) |
111 sw $s2, NACL_THREAD_CONTEXT_OFFSET_S2($a0) | 102 sw $s2, NACL_THREAD_CONTEXT_OFFSET_S2($a0) |
112 sw $s3, NACL_THREAD_CONTEXT_OFFSET_S3($a0) | 103 sw $s3, NACL_THREAD_CONTEXT_OFFSET_S3($a0) |
113 sw $s4, NACL_THREAD_CONTEXT_OFFSET_S4($a0) | 104 sw $s4, NACL_THREAD_CONTEXT_OFFSET_S4($a0) |
114 sw $s5, NACL_THREAD_CONTEXT_OFFSET_S5($a0) | 105 sw $s5, NACL_THREAD_CONTEXT_OFFSET_S5($a0) |
115 sw $s6, NACL_THREAD_CONTEXT_OFFSET_S6($a0) | 106 sw $s6, NACL_THREAD_CONTEXT_OFFSET_S6($a0) |
116 sw $s7, NACL_THREAD_CONTEXT_OFFSET_S7($a0) | 107 sw $s7, NACL_THREAD_CONTEXT_OFFSET_S7($a0) |
(...skipping 10 matching lines...) Expand all Loading... |
127 | 118 |
128 /* NOTREACHED */ | 119 /* NOTREACHED */ |
129 | 120 |
130 /* | 121 /* |
131 * If the thread returns, which must not happen, it will be halted | 122 * If the thread returns, which must not happen, it will be halted |
132 * by the following instruction. | 123 * by the following instruction. |
133 */ | 124 */ |
134 | 125 |
135 .word NACL_HALT_WORD | 126 .word NACL_HALT_WORD |
136 | 127 |
OLD | NEW |