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