Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: src/trusted/service_runtime/arch/mips/nacl_syscall.S

Issue 11368024: [MIPS] Restore the trusted stack in NaClSyscallSeg. (Closed) Base URL: http://git.chromium.org/native_client/src/native_client.git@master
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698