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

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

Issue 2521263002: [MIPS] Remove explicit masks from assembly code (Closed)
Patch Set: Minor change. Created 4 years 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 | tests/infoleak/test_infoleak_mips.S » ('j') | 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 (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 "nacl_mips_defs.h" 7 #include "nacl_mips_defs.h"
8 8
9 .text 9 .text
10 .p2align 4 10 .p2align 4
11 .align NACL_BLOCK_SHIFT 11 .align NACL_BLOCK_SHIFT
12 .globl setjmp 12 .globl setjmp
13 .ent setjmp 13 .ent setjmp
14 .frame $sp, 0, $31 14 .frame $sp, 0, $31
15 .set noreorder 15 .set noreorder
16 16
17 /* int setjmp(jmp_buf env) */ 17 /* int setjmp(jmp_buf env) */
18 setjmp: 18 setjmp:
19 19
20 /* The code here is grouped by instruction bundle. */ 20 /* The code here is grouped by instruction bundle. */
Mark Seaborn 2016/11/22 19:41:40 You should remove this comment.
petarj 2016/11/23 16:04:17 Done.
21 21
22 /* NACL_CALLEE_SAVE_LIST BEGIN */ 22 /* NACL_CALLEE_SAVE_LIST BEGIN */
23 and $a0, $a0, STORE_MASK 23 sw $s0, 0($a0)
24 sw $s0, 0($a0) 24 sw $s1, 4($a0)
25 and $a0, $a0, STORE_MASK 25 sw $s2, 8($a0)
26 sw $s1, 4($a0) 26 sw $s3, 12($a0)
27 27 sw $s4, 16($a0)
28 and $a0, $a0, STORE_MASK 28 sw $s5, 20($a0)
29 sw $s2, 8($a0) 29 sw $s6, 24($a0)
30 and $a0, $a0, STORE_MASK 30 sw $s7, 28($a0)
31 sw $s3, 12($a0) 31 sw $sp, 32($a0)
32 32 sw $fp, 36($a0)
33 and $a0, $a0, STORE_MASK 33 sw $ra, 40($a0)
34 sw $s4, 16($a0)
35 and $a0, $a0, STORE_MASK
36 sw $s5, 20($a0)
37
38 and $a0, $a0, STORE_MASK
39 sw $s6, 24($a0)
40 and $a0, $a0, STORE_MASK
41 sw $s7, 28($a0)
42
43 and $a0, $a0, STORE_MASK
44 sw $sp, 32($a0)
45 and $a0, $a0, STORE_MASK
46 sw $fp, 36($a0)
47
48 and $a0, $a0, STORE_MASK
49 sw $ra, 40($a0)
50 and $a0, $a0, STORE_MASK
51 swc1 $f20, 44($a0) 34 swc1 $f20, 44($a0)
52
53 and $a0, $a0, STORE_MASK
54 swc1 $f21, 48($a0) 35 swc1 $f21, 48($a0)
55 and $a0, $a0, STORE_MASK
56 swc1 $f22, 52($a0) 36 swc1 $f22, 52($a0)
57
58 and $a0, $a0, STORE_MASK
59 swc1 $f23, 56($a0) 37 swc1 $f23, 56($a0)
60 and $a0, $a0, STORE_MASK
61 swc1 $f24, 60($a0) 38 swc1 $f24, 60($a0)
62
63 and $a0, $a0, STORE_MASK
64 swc1 $f25, 64($a0) 39 swc1 $f25, 64($a0)
65 and $a0, $a0, STORE_MASK
66 swc1 $f26, 68($a0) 40 swc1 $f26, 68($a0)
67
68 and $a0, $a0, STORE_MASK
69 swc1 $f27, 72($a0) 41 swc1 $f27, 72($a0)
70 and $a0, $a0, STORE_MASK
71 swc1 $f28, 76($a0) 42 swc1 $f28, 76($a0)
72
73 and $a0, $a0, STORE_MASK
74 swc1 $f29, 80($a0) 43 swc1 $f29, 80($a0)
75 and $a0, $a0, STORE_MASK
76 swc1 $f30, 84($a0) 44 swc1 $f30, 84($a0)
77
78 and $a0, $a0, STORE_MASK
79 swc1 $f31, 88($a0) 45 swc1 $f31, 88($a0)
80 /* NACL_CALLEE_SAVE_LIST END */ 46 /* NACL_CALLEE_SAVE_LIST END */
81 move $v0, $zero 47 move $v0, $zero
82 nop 48 nop
83
84 and $ra, $ra, JUMP_MASK
85 j $ra 49 j $ra
86 nop 50 nop
87 nop
88 51
89 .end setjmp 52 .end setjmp
90 53
91 .text 54 .text
92 .p2align 4 55 .p2align 4
93 .align NACL_BLOCK_SHIFT 56 .align 4
Mark Seaborn 2016/11/22 19:41:40 Code above still has NACL_BLOCK_SHIFT. I suggest
petarj 2016/11/23 16:04:17 Done.
94 .globl longjmp 57 .globl longjmp
95 .ent longjmp 58 .ent longjmp
96 .set noreorder 59 .set noreorder
97 60
98 /* void longjmp(jmp_buf env, int val) */ 61 /* void longjmp(jmp_buf env, int val) */
99 longjmp: 62 longjmp:
100 63
101 /* NACL_CALLEE_LOAD_LIST BEGIN */ 64 /* NACL_CALLEE_LOAD_LIST BEGIN */
102 and $a0, $a0, STORE_MASK 65 lw $s0, 0($a0)
103 lw $s0, 0($a0) 66 lw $s1, 4($a0)
104 and $a0, $a0, STORE_MASK 67 lw $s2, 8($a0)
105 lw $s1, 4($a0) 68 lw $s3, 12($a0)
106 69 lw $s4, 16($a0)
107 and $a0, $a0, STORE_MASK 70 lw $s5, 20($a0)
108 lw $s2, 8($a0) 71 lw $s6, 24($a0)
109 and $a0, $a0, STORE_MASK 72 lw $s7, 28($a0)
110 lw $s3, 12($a0) 73 lw $sp, 32($a0)
111
112 and $a0, $a0, STORE_MASK
113 lw $s4, 16($a0)
114 and $a0, $a0, STORE_MASK
115 lw $s5, 20($a0)
116
117 and $a0, $a0, STORE_MASK
118 lw $s6, 24($a0)
119 and $a0, $a0, STORE_MASK
120 lw $s7, 28($a0)
121
122 and $a0, $a0, STORE_MASK
123 lw $sp, 32($a0)
124 and $sp, $sp, STORE_MASK
125 nop 74 nop
Mark Seaborn 2016/11/22 19:41:40 Not needed now?
petarj 2016/11/23 16:04:17 Done.
126 75 lw $fp, 36($a0)
127 and $a0, $a0, STORE_MASK 76 lw $ra, 40($a0)
128 lw $fp, 36($a0)
129 and $a0, $a0, STORE_MASK
130 lw $ra, 40($a0)
131
132 and $a0, $a0, STORE_MASK
133 lwc1 $f20, 44($a0) 77 lwc1 $f20, 44($a0)
134 and $a0, $a0, STORE_MASK
135 lwc1 $f21, 48($a0) 78 lwc1 $f21, 48($a0)
136
137 and $a0, $a0, STORE_MASK
138 lwc1 $f22, 52($a0) 79 lwc1 $f22, 52($a0)
139 and $a0, $a0, STORE_MASK
140 lwc1 $f23, 56($a0) 80 lwc1 $f23, 56($a0)
141
142 and $a0, $a0, STORE_MASK
143 lwc1 $f24, 60($a0) 81 lwc1 $f24, 60($a0)
144 and $a0, $a0, STORE_MASK
145 lwc1 $f25, 64($a0) 82 lwc1 $f25, 64($a0)
146
147 and $a0, $a0, STORE_MASK
148 lwc1 $f26, 68($a0) 83 lwc1 $f26, 68($a0)
149 and $a0, $a0, STORE_MASK
150 lwc1 $f27, 72($a0) 84 lwc1 $f27, 72($a0)
151
152 and $a0, $a0, STORE_MASK
153 lwc1 $f28, 76($a0) 85 lwc1 $f28, 76($a0)
154 and $a0, $a0, STORE_MASK
155 lwc1 $f29, 80($a0) 86 lwc1 $f29, 80($a0)
156
157 and $a0, $a0, STORE_MASK
158 lwc1 $f30, 84($a0) 87 lwc1 $f30, 84($a0)
159 and $a0, $a0, STORE_MASK
160 lwc1 $f31, 88($a0) 88 lwc1 $f31, 88($a0)
161 /* NACL_CALLEE_LOAD_LIST END */ 89 /* NACL_CALLEE_LOAD_LIST END */
162 90
163 bne $a1, $zero, 1f 91 bne $a1, $zero, 1f
164 nop 92 nop
Mark Seaborn 2016/11/22 19:41:40 Same with these other nops? Maybe comment which o
165 ori $a1, $zero, 1 93 ori $a1, $zero, 1
166 1: 94 1:
167 move $v0, $a1 95 move $v0, $a1
168
169 and $ra, $ra, JUMP_MASK
170 j $ra 96 j $ra
171 nop 97 nop
172 nop 98 nop
173 99
174 .end longjmp 100 .end longjmp
175 101
OLDNEW
« no previous file with comments | « no previous file | tests/infoleak/test_infoleak_mips.S » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698