Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Native Client Authors. All rights reserved. | 2 * Copyright 2012 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
| 4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include "native_client/src/trusted/service_runtime/arch/mips/sel_rt.h" | 7 #include "native_client/src/trusted/service_runtime/arch/mips/sel_rt.h" |
| 8 #include "native_client/src/trusted/service_runtime/nacl_config.h" | 8 #include "native_client/src/trusted/service_runtime/nacl_config.h" |
| 9 | 9 |
| 10 .text | 10 .text |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 | 99 |
| 100 sw $s0, NACL_THREAD_CONTEXT_OFFSET_S0($a1) | 100 sw $s0, NACL_THREAD_CONTEXT_OFFSET_S0($a1) |
| 101 sw $s1, NACL_THREAD_CONTEXT_OFFSET_S1($a1) | 101 sw $s1, NACL_THREAD_CONTEXT_OFFSET_S1($a1) |
| 102 sw $s2, NACL_THREAD_CONTEXT_OFFSET_S2($a1) | 102 sw $s2, NACL_THREAD_CONTEXT_OFFSET_S2($a1) |
| 103 sw $s3, NACL_THREAD_CONTEXT_OFFSET_S3($a1) | 103 sw $s3, NACL_THREAD_CONTEXT_OFFSET_S3($a1) |
| 104 sw $s4, NACL_THREAD_CONTEXT_OFFSET_S4($a1) | 104 sw $s4, NACL_THREAD_CONTEXT_OFFSET_S4($a1) |
| 105 sw $s5, NACL_THREAD_CONTEXT_OFFSET_S5($a1) | 105 sw $s5, NACL_THREAD_CONTEXT_OFFSET_S5($a1) |
| 106 sw $s6, NACL_THREAD_CONTEXT_OFFSET_S6($a1) | 106 sw $s6, NACL_THREAD_CONTEXT_OFFSET_S6($a1) |
| 107 sw $s7, NACL_THREAD_CONTEXT_OFFSET_S7($a1) | 107 sw $s7, NACL_THREAD_CONTEXT_OFFSET_S7($a1) |
| 108 sw $t8, NACL_THREAD_CONTEXT_OFFSET_T8($a1) | 108 sw $t8, NACL_THREAD_CONTEXT_OFFSET_T8($a1) |
| 109 sw $gp, NACL_THREAD_CONTEXT_OFFSET_GLOBAL_PTR($a1) | 109 sw $gp, NACL_THREAD_CONTEXT_OFFSET_GLOBAL_PTR($a1) |
|
Mark Seaborn
2012/11/01 01:47:41
Does this mean untrusted code is allowed to modify
petarj
2012/11/01 17:06:40
Untrusted code can modify $gp, yet saving $gp is a
| |
| 110 sw $sp, NACL_THREAD_CONTEXT_OFFSET_STACK_PTR($a1) | 110 sw $sp, NACL_THREAD_CONTEXT_OFFSET_STACK_PTR($a1) |
| 111 sw $fp, NACL_THREAD_CONTEXT_OFFSET_FRAME_PTR($a1) | 111 sw $fp, NACL_THREAD_CONTEXT_OFFSET_FRAME_PTR($a1) |
| 112 | 112 |
| 113 /* Restore the thread index. */ | 113 /* Restore the thread index. */ |
| 114 srl $a0, $a0, 2 | 114 srl $a0, $a0, 2 |
| 115 | 115 |
| 116 /* Reserve 16-byte for arguments (o32 ABI) */ | 116 /* Restore the trusted stack */ |
|
Mark Seaborn
2012/11/01 01:47:41
Should you change NaClStartThreadInApp() to explic
petarj
2012/11/01 17:06:40
The 16 bytes are already reserved at that point. N
Mark Seaborn
2012/11/01 18:01:57
OK, good point.
| |
| 117 addiu $sp, $sp, -16 | 117 lw $sp, NACL_THREAD_CONTEXT_OFFSET_TRUSTED_STACK_PTR($a1) |
| 118 | |
| 118 lw $t9,%call16(NaClSyscallCSegHook)($gp) | 119 lw $t9,%call16(NaClSyscallCSegHook)($gp) |
| 119 jr $t9 | 120 jr $t9 |
| 120 nop | 121 nop |
| 121 | 122 |
| 122 /* NOTREACHED */ | 123 /* NOTREACHED */ |
| 123 | 124 |
| 124 /* | 125 /* |
| 125 * If the thread returns, which must not happen, it will be halted | 126 * If the thread returns, which must not happen, it will be halted |
| 126 * by the following instruction | 127 * by the following instruction |
| 127 */ | 128 */ |
| 128 | 129 |
| 129 NACL_HALT | 130 NACL_HALT |
| 130 | 131 |
| OLD | NEW |