1 | .text
|
---|
2 | .globl bn_mul_mont
|
---|
3 | .type bn_mul_mont,@function
|
---|
4 | .align 16
|
---|
5 | bn_mul_mont:
|
---|
6 | .L_bn_mul_mont_begin:
|
---|
7 | .byte 243,15,30,251
|
---|
8 | pushl %ebp
|
---|
9 | pushl %ebx
|
---|
10 | pushl %esi
|
---|
11 | pushl %edi
|
---|
12 | xorl %eax,%eax
|
---|
13 | movl 40(%esp),%edi
|
---|
14 | cmpl $4,%edi
|
---|
15 | jl .L000just_leave
|
---|
16 | leal 20(%esp),%esi
|
---|
17 | leal 24(%esp),%edx
|
---|
18 | addl $2,%edi
|
---|
19 | negl %edi
|
---|
20 | leal -32(%esp,%edi,4),%ebp
|
---|
21 | negl %edi
|
---|
22 | movl %ebp,%eax
|
---|
23 | subl %edx,%eax
|
---|
24 | andl $2047,%eax
|
---|
25 | subl %eax,%ebp
|
---|
26 | xorl %ebp,%edx
|
---|
27 | andl $2048,%edx
|
---|
28 | xorl $2048,%edx
|
---|
29 | subl %edx,%ebp
|
---|
30 | andl $-64,%ebp
|
---|
31 | movl %esp,%eax
|
---|
32 | subl %ebp,%eax
|
---|
33 | andl $-4096,%eax
|
---|
34 | movl %esp,%edx
|
---|
35 | leal (%ebp,%eax,1),%esp
|
---|
36 | movl (%esp),%eax
|
---|
37 | cmpl %ebp,%esp
|
---|
38 | ja .L001page_walk
|
---|
39 | jmp .L002page_walk_done
|
---|
40 | .align 16
|
---|
41 | .L001page_walk:
|
---|
42 | leal -4096(%esp),%esp
|
---|
43 | movl (%esp),%eax
|
---|
44 | cmpl %ebp,%esp
|
---|
45 | ja .L001page_walk
|
---|
46 | .L002page_walk_done:
|
---|
47 | movl (%esi),%eax
|
---|
48 | movl 4(%esi),%ebx
|
---|
49 | movl 8(%esi),%ecx
|
---|
50 | movl 12(%esi),%ebp
|
---|
51 | movl 16(%esi),%esi
|
---|
52 | movl (%esi),%esi
|
---|
53 | movl %eax,4(%esp)
|
---|
54 | movl %ebx,8(%esp)
|
---|
55 | movl %ecx,12(%esp)
|
---|
56 | movl %ebp,16(%esp)
|
---|
57 | movl %esi,20(%esp)
|
---|
58 | leal -3(%edi),%ebx
|
---|
59 | movl %edx,24(%esp)
|
---|
60 | movl 8(%esp),%esi
|
---|
61 | leal 1(%ebx),%ebp
|
---|
62 | movl 12(%esp),%edi
|
---|
63 | xorl %ecx,%ecx
|
---|
64 | movl %esi,%edx
|
---|
65 | andl $1,%ebp
|
---|
66 | subl %edi,%edx
|
---|
67 | leal 4(%edi,%ebx,4),%eax
|
---|
68 | orl %edx,%ebp
|
---|
69 | movl (%edi),%edi
|
---|
70 | jz .L003bn_sqr_mont
|
---|
71 | movl %eax,28(%esp)
|
---|
72 | movl (%esi),%eax
|
---|
73 | xorl %edx,%edx
|
---|
74 | .align 16
|
---|
75 | .L004mull:
|
---|
76 | movl %edx,%ebp
|
---|
77 | mull %edi
|
---|
78 | addl %eax,%ebp
|
---|
79 | leal 1(%ecx),%ecx
|
---|
80 | adcl $0,%edx
|
---|
81 | movl (%esi,%ecx,4),%eax
|
---|
82 | cmpl %ebx,%ecx
|
---|
83 | movl %ebp,28(%esp,%ecx,4)
|
---|
84 | jl .L004mull
|
---|
85 | movl %edx,%ebp
|
---|
86 | mull %edi
|
---|
87 | movl 20(%esp),%edi
|
---|
88 | addl %ebp,%eax
|
---|
89 | movl 16(%esp),%esi
|
---|
90 | adcl $0,%edx
|
---|
91 | imull 32(%esp),%edi
|
---|
92 | movl %eax,32(%esp,%ebx,4)
|
---|
93 | xorl %ecx,%ecx
|
---|
94 | movl %edx,36(%esp,%ebx,4)
|
---|
95 | movl %ecx,40(%esp,%ebx,4)
|
---|
96 | movl (%esi),%eax
|
---|
97 | mull %edi
|
---|
98 | addl 32(%esp),%eax
|
---|
99 | movl 4(%esi),%eax
|
---|
100 | adcl $0,%edx
|
---|
101 | incl %ecx
|
---|
102 | jmp .L0052ndmadd
|
---|
103 | .align 16
|
---|
104 | .L0061stmadd:
|
---|
105 | movl %edx,%ebp
|
---|
106 | mull %edi
|
---|
107 | addl 32(%esp,%ecx,4),%ebp
|
---|
108 | leal 1(%ecx),%ecx
|
---|
109 | adcl $0,%edx
|
---|
110 | addl %eax,%ebp
|
---|
111 | movl (%esi,%ecx,4),%eax
|
---|
112 | adcl $0,%edx
|
---|
113 | cmpl %ebx,%ecx
|
---|
114 | movl %ebp,28(%esp,%ecx,4)
|
---|
115 | jl .L0061stmadd
|
---|
116 | movl %edx,%ebp
|
---|
117 | mull %edi
|
---|
118 | addl 32(%esp,%ebx,4),%eax
|
---|
119 | movl 20(%esp),%edi
|
---|
120 | adcl $0,%edx
|
---|
121 | movl 16(%esp),%esi
|
---|
122 | addl %eax,%ebp
|
---|
123 | adcl $0,%edx
|
---|
124 | imull 32(%esp),%edi
|
---|
125 | xorl %ecx,%ecx
|
---|
126 | addl 36(%esp,%ebx,4),%edx
|
---|
127 | movl %ebp,32(%esp,%ebx,4)
|
---|
128 | adcl $0,%ecx
|
---|
129 | movl (%esi),%eax
|
---|
130 | movl %edx,36(%esp,%ebx,4)
|
---|
131 | movl %ecx,40(%esp,%ebx,4)
|
---|
132 | mull %edi
|
---|
133 | addl 32(%esp),%eax
|
---|
134 | movl 4(%esi),%eax
|
---|
135 | adcl $0,%edx
|
---|
136 | movl $1,%ecx
|
---|
137 | .align 16
|
---|
138 | .L0052ndmadd:
|
---|
139 | movl %edx,%ebp
|
---|
140 | mull %edi
|
---|
141 | addl 32(%esp,%ecx,4),%ebp
|
---|
142 | leal 1(%ecx),%ecx
|
---|
143 | adcl $0,%edx
|
---|
144 | addl %eax,%ebp
|
---|
145 | movl (%esi,%ecx,4),%eax
|
---|
146 | adcl $0,%edx
|
---|
147 | cmpl %ebx,%ecx
|
---|
148 | movl %ebp,24(%esp,%ecx,4)
|
---|
149 | jl .L0052ndmadd
|
---|
150 | movl %edx,%ebp
|
---|
151 | mull %edi
|
---|
152 | addl 32(%esp,%ebx,4),%ebp
|
---|
153 | adcl $0,%edx
|
---|
154 | addl %eax,%ebp
|
---|
155 | adcl $0,%edx
|
---|
156 | movl %ebp,28(%esp,%ebx,4)
|
---|
157 | xorl %eax,%eax
|
---|
158 | movl 12(%esp),%ecx
|
---|
159 | addl 36(%esp,%ebx,4),%edx
|
---|
160 | adcl 40(%esp,%ebx,4),%eax
|
---|
161 | leal 4(%ecx),%ecx
|
---|
162 | movl %edx,32(%esp,%ebx,4)
|
---|
163 | cmpl 28(%esp),%ecx
|
---|
164 | movl %eax,36(%esp,%ebx,4)
|
---|
165 | je .L007common_tail
|
---|
166 | movl (%ecx),%edi
|
---|
167 | movl 8(%esp),%esi
|
---|
168 | movl %ecx,12(%esp)
|
---|
169 | xorl %ecx,%ecx
|
---|
170 | xorl %edx,%edx
|
---|
171 | movl (%esi),%eax
|
---|
172 | jmp .L0061stmadd
|
---|
173 | .align 16
|
---|
174 | .L003bn_sqr_mont:
|
---|
175 | movl %ebx,(%esp)
|
---|
176 | movl %ecx,12(%esp)
|
---|
177 | movl %edi,%eax
|
---|
178 | mull %edi
|
---|
179 | movl %eax,32(%esp)
|
---|
180 | movl %edx,%ebx
|
---|
181 | shrl $1,%edx
|
---|
182 | andl $1,%ebx
|
---|
183 | incl %ecx
|
---|
184 | .align 16
|
---|
185 | .L008sqr:
|
---|
186 | movl (%esi,%ecx,4),%eax
|
---|
187 | movl %edx,%ebp
|
---|
188 | mull %edi
|
---|
189 | addl %ebp,%eax
|
---|
190 | leal 1(%ecx),%ecx
|
---|
191 | adcl $0,%edx
|
---|
192 | leal (%ebx,%eax,2),%ebp
|
---|
193 | shrl $31,%eax
|
---|
194 | cmpl (%esp),%ecx
|
---|
195 | movl %eax,%ebx
|
---|
196 | movl %ebp,28(%esp,%ecx,4)
|
---|
197 | jl .L008sqr
|
---|
198 | movl (%esi,%ecx,4),%eax
|
---|
199 | movl %edx,%ebp
|
---|
200 | mull %edi
|
---|
201 | addl %ebp,%eax
|
---|
202 | movl 20(%esp),%edi
|
---|
203 | adcl $0,%edx
|
---|
204 | movl 16(%esp),%esi
|
---|
205 | leal (%ebx,%eax,2),%ebp
|
---|
206 | imull 32(%esp),%edi
|
---|
207 | shrl $31,%eax
|
---|
208 | movl %ebp,32(%esp,%ecx,4)
|
---|
209 | leal (%eax,%edx,2),%ebp
|
---|
210 | movl (%esi),%eax
|
---|
211 | shrl $31,%edx
|
---|
212 | movl %ebp,36(%esp,%ecx,4)
|
---|
213 | movl %edx,40(%esp,%ecx,4)
|
---|
214 | mull %edi
|
---|
215 | addl 32(%esp),%eax
|
---|
216 | movl %ecx,%ebx
|
---|
217 | adcl $0,%edx
|
---|
218 | movl 4(%esi),%eax
|
---|
219 | movl $1,%ecx
|
---|
220 | .align 16
|
---|
221 | .L0093rdmadd:
|
---|
222 | movl %edx,%ebp
|
---|
223 | mull %edi
|
---|
224 | addl 32(%esp,%ecx,4),%ebp
|
---|
225 | adcl $0,%edx
|
---|
226 | addl %eax,%ebp
|
---|
227 | movl 4(%esi,%ecx,4),%eax
|
---|
228 | adcl $0,%edx
|
---|
229 | movl %ebp,28(%esp,%ecx,4)
|
---|
230 | movl %edx,%ebp
|
---|
231 | mull %edi
|
---|
232 | addl 36(%esp,%ecx,4),%ebp
|
---|
233 | leal 2(%ecx),%ecx
|
---|
234 | adcl $0,%edx
|
---|
235 | addl %eax,%ebp
|
---|
236 | movl (%esi,%ecx,4),%eax
|
---|
237 | adcl $0,%edx
|
---|
238 | cmpl %ebx,%ecx
|
---|
239 | movl %ebp,24(%esp,%ecx,4)
|
---|
240 | jl .L0093rdmadd
|
---|
241 | movl %edx,%ebp
|
---|
242 | mull %edi
|
---|
243 | addl 32(%esp,%ebx,4),%ebp
|
---|
244 | adcl $0,%edx
|
---|
245 | addl %eax,%ebp
|
---|
246 | adcl $0,%edx
|
---|
247 | movl %ebp,28(%esp,%ebx,4)
|
---|
248 | movl 12(%esp),%ecx
|
---|
249 | xorl %eax,%eax
|
---|
250 | movl 8(%esp),%esi
|
---|
251 | addl 36(%esp,%ebx,4),%edx
|
---|
252 | adcl 40(%esp,%ebx,4),%eax
|
---|
253 | movl %edx,32(%esp,%ebx,4)
|
---|
254 | cmpl %ebx,%ecx
|
---|
255 | movl %eax,36(%esp,%ebx,4)
|
---|
256 | je .L007common_tail
|
---|
257 | movl 4(%esi,%ecx,4),%edi
|
---|
258 | leal 1(%ecx),%ecx
|
---|
259 | movl %edi,%eax
|
---|
260 | movl %ecx,12(%esp)
|
---|
261 | mull %edi
|
---|
262 | addl 32(%esp,%ecx,4),%eax
|
---|
263 | adcl $0,%edx
|
---|
264 | movl %eax,32(%esp,%ecx,4)
|
---|
265 | xorl %ebp,%ebp
|
---|
266 | cmpl %ebx,%ecx
|
---|
267 | leal 1(%ecx),%ecx
|
---|
268 | je .L010sqrlast
|
---|
269 | movl %edx,%ebx
|
---|
270 | shrl $1,%edx
|
---|
271 | andl $1,%ebx
|
---|
272 | .align 16
|
---|
273 | .L011sqradd:
|
---|
274 | movl (%esi,%ecx,4),%eax
|
---|
275 | movl %edx,%ebp
|
---|
276 | mull %edi
|
---|
277 | addl %ebp,%eax
|
---|
278 | leal (%eax,%eax,1),%ebp
|
---|
279 | adcl $0,%edx
|
---|
280 | shrl $31,%eax
|
---|
281 | addl 32(%esp,%ecx,4),%ebp
|
---|
282 | leal 1(%ecx),%ecx
|
---|
283 | adcl $0,%eax
|
---|
284 | addl %ebx,%ebp
|
---|
285 | adcl $0,%eax
|
---|
286 | cmpl (%esp),%ecx
|
---|
287 | movl %ebp,28(%esp,%ecx,4)
|
---|
288 | movl %eax,%ebx
|
---|
289 | jle .L011sqradd
|
---|
290 | movl %edx,%ebp
|
---|
291 | addl %edx,%edx
|
---|
292 | shrl $31,%ebp
|
---|
293 | addl %ebx,%edx
|
---|
294 | adcl $0,%ebp
|
---|
295 | .L010sqrlast:
|
---|
296 | movl 20(%esp),%edi
|
---|
297 | movl 16(%esp),%esi
|
---|
298 | imull 32(%esp),%edi
|
---|
299 | addl 32(%esp,%ecx,4),%edx
|
---|
300 | movl (%esi),%eax
|
---|
301 | adcl $0,%ebp
|
---|
302 | movl %edx,32(%esp,%ecx,4)
|
---|
303 | movl %ebp,36(%esp,%ecx,4)
|
---|
304 | mull %edi
|
---|
305 | addl 32(%esp),%eax
|
---|
306 | leal -1(%ecx),%ebx
|
---|
307 | adcl $0,%edx
|
---|
308 | movl $1,%ecx
|
---|
309 | movl 4(%esi),%eax
|
---|
310 | jmp .L0093rdmadd
|
---|
311 | .align 16
|
---|
312 | .L007common_tail:
|
---|
313 | movl 16(%esp),%ebp
|
---|
314 | movl 4(%esp),%edi
|
---|
315 | leal 32(%esp),%esi
|
---|
316 | movl (%esi),%eax
|
---|
317 | movl %ebx,%ecx
|
---|
318 | xorl %edx,%edx
|
---|
319 | .align 16
|
---|
320 | .L012sub:
|
---|
321 | sbbl (%ebp,%edx,4),%eax
|
---|
322 | movl %eax,(%edi,%edx,4)
|
---|
323 | decl %ecx
|
---|
324 | movl 4(%esi,%edx,4),%eax
|
---|
325 | leal 1(%edx),%edx
|
---|
326 | jge .L012sub
|
---|
327 | sbbl $0,%eax
|
---|
328 | movl $-1,%edx
|
---|
329 | xorl %eax,%edx
|
---|
330 | jmp .L013copy
|
---|
331 | .align 16
|
---|
332 | .L013copy:
|
---|
333 | movl 32(%esp,%ebx,4),%esi
|
---|
334 | movl (%edi,%ebx,4),%ebp
|
---|
335 | movl %ecx,32(%esp,%ebx,4)
|
---|
336 | andl %eax,%esi
|
---|
337 | andl %edx,%ebp
|
---|
338 | orl %esi,%ebp
|
---|
339 | movl %ebp,(%edi,%ebx,4)
|
---|
340 | decl %ebx
|
---|
341 | jge .L013copy
|
---|
342 | movl 24(%esp),%esp
|
---|
343 | movl $1,%eax
|
---|
344 | .L000just_leave:
|
---|
345 | popl %edi
|
---|
346 | popl %esi
|
---|
347 | popl %ebx
|
---|
348 | popl %ebp
|
---|
349 | ret
|
---|
350 | .size bn_mul_mont,.-.L_bn_mul_mont_begin
|
---|
351 | .byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105
|
---|
352 | .byte 112,108,105,99,97,116,105,111,110,32,102,111,114,32,120,56
|
---|
353 | .byte 54,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121
|
---|
354 | .byte 32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46
|
---|
355 | .byte 111,114,103,62,0
|
---|
356 |
|
---|
357 | .section ".note.gnu.property", "a"
|
---|
358 | .p2align 2
|
---|
359 | .long 1f - 0f
|
---|
360 | .long 4f - 1f
|
---|
361 | .long 5
|
---|
362 | 0:
|
---|
363 | .asciz "GNU"
|
---|
364 | 1:
|
---|
365 | .p2align 2
|
---|
366 | .long 0xc0000002
|
---|
367 | .long 3f - 2f
|
---|
368 | 2:
|
---|
369 | .long 3
|
---|
370 | 3:
|
---|
371 | .p2align 2
|
---|
372 | 4:
|
---|