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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 * stack frame (o32 ABI), and place return address on top of that. | 79 * stack frame (o32 ABI), and place return address on top of that. |
80 */ | 80 */ |
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 add $a0, $t8, -NACL_THREAD_CONTEXT_OFFSET_TLS_VALUE1 |
89 | 90 |
90 /* Load the __thread variable's offset into a3. */ | 91 lw $t2, NACL_THREAD_CONTEXT_OFFSET_GUARD_TOKEN($a0) |
91 lui $a3, %tprel_hi(nacl_current_thread) | 92 la $t3, nacl_guard_token |
92 addiu $a3, $a3, %tprel_lo(nacl_current_thread) | 93 lw $t3, 0($t3) |
| 94 bne $t2, $t3, NaClSyscallThreadCaptureFault |
| 95 nop |
93 | 96 |
94 /* Fetch the thread-local variable: set a0 = nacl_current_thread */ | |
95 rdhwr $v1, $29 | |
96 addu $a3, $v1, $a3 | |
97 lw $a0, 0($a3) | |
98 | |
99 DEFINE_GLOBAL_HIDDEN_LOCATION(NaClSyscallThreadCaptureFault): | |
100 sw $s0, NACL_THREAD_CONTEXT_OFFSET_S0($a0) | 97 sw $s0, NACL_THREAD_CONTEXT_OFFSET_S0($a0) |
101 sw $s1, NACL_THREAD_CONTEXT_OFFSET_S1($a0) | 98 sw $s1, NACL_THREAD_CONTEXT_OFFSET_S1($a0) |
102 sw $s2, NACL_THREAD_CONTEXT_OFFSET_S2($a0) | 99 sw $s2, NACL_THREAD_CONTEXT_OFFSET_S2($a0) |
103 sw $s3, NACL_THREAD_CONTEXT_OFFSET_S3($a0) | 100 sw $s3, NACL_THREAD_CONTEXT_OFFSET_S3($a0) |
104 sw $s4, NACL_THREAD_CONTEXT_OFFSET_S4($a0) | 101 sw $s4, NACL_THREAD_CONTEXT_OFFSET_S4($a0) |
105 sw $s5, NACL_THREAD_CONTEXT_OFFSET_S5($a0) | 102 sw $s5, NACL_THREAD_CONTEXT_OFFSET_S5($a0) |
106 sw $s6, NACL_THREAD_CONTEXT_OFFSET_S6($a0) | 103 sw $s6, NACL_THREAD_CONTEXT_OFFSET_S6($a0) |
107 sw $s7, NACL_THREAD_CONTEXT_OFFSET_S7($a0) | 104 sw $s7, NACL_THREAD_CONTEXT_OFFSET_S7($a0) |
108 sw $t8, NACL_THREAD_CONTEXT_OFFSET_T8($a0) | 105 sw $t8, NACL_THREAD_CONTEXT_OFFSET_T8($a0) |
109 sw $sp, NACL_THREAD_CONTEXT_OFFSET_STACK_PTR($a0) | 106 sw $sp, NACL_THREAD_CONTEXT_OFFSET_STACK_PTR($a0) |
(...skipping 15 matching lines...) Expand all Loading... |
125 lw $t9,%call16(NaClSwitch)($s0) | 122 lw $t9,%call16(NaClSwitch)($s0) |
126 jr $t9 | 123 jr $t9 |
127 move $a0, $v0 /* delay slot */ | 124 move $a0, $v0 /* delay slot */ |
128 | 125 |
129 /* NOTREACHED */ | 126 /* NOTREACHED */ |
130 | 127 |
131 /* | 128 /* |
132 * If the thread returns, which must not happen, it will be halted | 129 * If the thread returns, which must not happen, it will be halted |
133 * by the following instruction. | 130 * by the following instruction. |
134 */ | 131 */ |
135 | 132 DEFINE_GLOBAL_HIDDEN_LOCATION(NaClSyscallThreadCaptureFault): |
136 .word NACL_HALT_WORD | 133 .word NACL_HALT_WORD |
OLD | NEW |