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

Side by Side Diff: pnacl/support/setjmp_mips32.S

Issue 11039026: [MIPS] Untrusted versions of setjmp and longjmp. (Closed) Base URL: http://src.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 years, 2 months 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
OLDNEW
(Empty)
1 /*
Mark Seaborn 2012/10/03 00:46:33 Surely this file should be "setjmp_mips.S"? The o
petarj 2012/10/03 16:50:01 Well, the other mips files are not compiled with "
Mark Seaborn 2012/10/03 20:02:54 Hmm. Given that build.sh is already munging '-' t
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
4 * found in the LICENSE file.
5 */
6
7 #include "nacl_mips_defs.h"
8
9 .text
10 .p2align 4
11 .align NACL_BLOCK_SHIFT
12 .globl setjmp
13 .ent setjmp
Mark Seaborn 2012/10/03 00:46:33 BTW, you didn't use .ent in tls_get_addr.S
14 .frame $sp, 0, $31
15 .set noreorder
16
17 /* int setjmp(jmp_buf env) */
18 setjmp:
19
20 /* NACL_CALLEE_SAVE_LIST BEGIN */
21 and $a0, $a0, STORE_MASK
22 sw $s0, 0($a0)
23 and $a0, $a0, STORE_MASK
24 sw $s1, 4($a0)
25
Mark Seaborn 2012/10/03 00:46:33 It's a little odd that the empty lines group this
petarj 2012/10/03 16:50:01 Normally, we would group it by type of registers (
Mark Seaborn 2012/10/03 20:02:54 Ah, I see. Maybe add a comment like /* The code h
petarj 2012/10/05 17:26:44 Done.
26 and $a0, $a0, STORE_MASK
27 sw $s2, 8($a0)
28 and $a0, $a0, STORE_MASK
29 sw $s3, 12($a0)
30
31 and $a0, $a0, STORE_MASK
32 sw $s4, 16($a0)
33 and $a0, $a0, STORE_MASK
34 sw $s5, 20($a0)
35
36 and $a0, $a0, STORE_MASK
37 sw $s6, 24($a0)
38 and $a0, $a0, STORE_MASK
39 sw $s7, 28($a0)
40
41 and $a0, $a0, STORE_MASK
42 sw $sp, 32($a0)
43 and $a0, $a0, STORE_MASK
44 sw $fp, 36($a0)
45
46 and $a0, $a0, STORE_MASK
47 sw $ra, 40($a0)
48 and $a0, $a0, STORE_MASK
49 swc1 $f20, 44($a0)
50
51 and $a0, $a0, STORE_MASK
52 swc1 $f21, 48($a0)
53 and $a0, $a0, STORE_MASK
54 swc1 $f22, 52($a0)
55
56 and $a0, $a0, STORE_MASK
57 swc1 $f23, 56($a0)
58 and $a0, $a0, STORE_MASK
59 swc1 $f24, 60($a0)
60
61 and $a0, $a0, STORE_MASK
62 swc1 $f25, 64($a0)
63 and $a0, $a0, STORE_MASK
64 swc1 $f26, 68($a0)
65
66 and $a0, $a0, STORE_MASK
67 swc1 $f27, 72($a0)
68 and $a0, $a0, STORE_MASK
69 swc1 $f28, 76($a0)
70
71 and $a0, $a0, STORE_MASK
72 swc1 $f29, 80($a0)
73 and $a0, $a0, STORE_MASK
74 swc1 $f30, 84($a0)
75
76 and $a0, $a0, STORE_MASK
77 swc1 $f31, 88($a0)
78 /* NACL_CALLEE_SAVE_LIST END */
79 move $v0, $zero
80 nop
81
82 and $ra, $ra, JUMP_MASK
83 j $ra
84 nop
85 nop
86
87 .end setjmp
88
89 .text
90 .p2align 4
91 .align NACL_BLOCK_SHIFT
92 .globl longjmp
93 .ent longjmp
94 .set noreorder
95
96 /* void longjmp(jmp_buf env, int val) */
97 longjmp:
98
99 /* NACL_CALLEE_LOAD_LIST BEGIN */
100 and $a0, $a0, STORE_MASK
101 lw $s0, 0($a0)
102 and $a0, $a0, STORE_MASK
103 lw $s1, 4($a0)
104
105 and $a0, $a0, STORE_MASK
106 lw $s2, 8($a0)
107 and $a0, $a0, STORE_MASK
108 lw $s3, 12($a0)
109
110 and $a0, $a0, STORE_MASK
111 lw $s4, 16($a0)
112 and $a0, $a0, STORE_MASK
113 lw $s5, 20($a0)
114
115 and $a0, $a0, STORE_MASK
116 lw $s6, 24($a0)
117 and $a0, $a0, STORE_MASK
118 lw $s7, 28($a0)
119
120 and $a0, $a0, STORE_MASK
121 lw $sp, 32($a0)
122 and $sp, $sp, STORE_MASK
123 nop
124
125 and $a0, $a0, STORE_MASK
126 lw $fp, 36($a0)
127 and $a0, $a0, STORE_MASK
128 lw $ra, 40($a0)
129
130 and $a0, $a0, STORE_MASK
131 lwc1 $f20, 44($a0)
132 and $a0, $a0, STORE_MASK
133 lwc1 $f21, 48($a0)
134
135 and $a0, $a0, STORE_MASK
136 lwc1 $f22, 52($a0)
137 and $a0, $a0, STORE_MASK
138 lwc1 $f23, 56($a0)
139
140 and $a0, $a0, STORE_MASK
141 lwc1 $f24, 60($a0)
142 and $a0, $a0, STORE_MASK
143 lwc1 $f25, 64($a0)
144
145 and $a0, $a0, STORE_MASK
146 lwc1 $f26, 68($a0)
147 and $a0, $a0, STORE_MASK
148 lwc1 $f27, 72($a0)
149
150 and $a0, $a0, STORE_MASK
151 lwc1 $f28, 76($a0)
152 and $a0, $a0, STORE_MASK
153 lwc1 $f29, 80($a0)
154
155 and $a0, $a0, STORE_MASK
156 lwc1 $f30, 84($a0)
157 and $a0, $a0, STORE_MASK
158 lwc1 $f31, 88($a0)
159 /* NACL_CALLEE_LOAD_LIST END */
160
161 bne $a1, $zero, 1f
162 nop
163 ori $a1, $zero, 1
164 1:
165 move $v0, $a1
166
167 and $ra, $ra, JUMP_MASK
168 j $ra
169 nop
170 nop
171
172 .end longjmp
173
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698