1 // Works on all IA-64 platforms: Linux, HP-UX, Win64i...
2 // On Win64i compile with ias.exe.
5 .global OPENSSL_cpuid_setup#
6 .proc OPENSSL_cpuid_setup#
8 { .mib; br.ret.sptk.many b0 };;
9 .endp OPENSSL_cpuid_setup#
11 .global OPENSSL_rdtsc#
15 br.ret.sptk.many b0 };;
18 .global OPENSSL_atomic_add#
19 .proc OPENSSL_atomic_add#
30 cmpxchg4.acq r2=[r32],r8,ar.ccv
32 { .mib; cmp.ne p6,p0=r2,r3
34 (p6) br.dpnt .Lspin };;
37 br.ret.sptk.many b0 };;
38 .endp OPENSSL_atomic_add#
40 // Returns a structure comprising pointer to the top of stack of
41 // the caller and pointer beyond backing storage for the current
42 // register frame. The latter is required, because it might be
43 // insufficient to wipe backing storage for the current frame
44 // (as this procedure does), one might have to go further, toward
45 // higher addresses to reach for whole "retroactively" saved
47 .global OPENSSL_wipe_cpu#
48 .proc OPENSSL_wipe_cpu#
55 { .mib; alloc r2=ar.pfs,0,96,0,96
57 brp.loop.imp .L_wipe_top,.L_wipe_end-16
63 { .mii; add r9=96*8-8,r9
66 // One can sweep double as fast, but then we can't quarantee
67 // that backing storage is wiped...
69 { .mfi; st8 [r9]=r0,-8
74 br.ctop.sptk .L_wipe_top };;
122 { .mfi; add r9=96*8+8,r9
128 .endp OPENSSL_wipe_cpu#
130 .global OPENSSL_cleanse#
131 .proc OPENSSL_cleanse#
133 { .mib; cmp.eq p6,p0=0,r33 // len==0
134 #if defined(_HPUX_SOURCE) && !defined(_LP64)
137 (p6) br.ret.spnt b0 };;
139 cmp.leu p6,p0=15,r33 // len>=15
140 (p6) br.cond.dptk .Lot };;
143 { .mib; st1 [r32]=r0,1
144 cmp.ltu p6,p7=1,r33 } // len>1
145 { .mbb; add r33=-1,r33 // len--
146 (p6) br.cond.dptk .Little
147 (p7) br.ret.sptk.many b0 };;
150 { .mib; cmp.eq p6,p0=0,r2
151 (p6) br.cond.dptk .Laligned };;
152 { .mmi; st1 [r32]=r0,1;;
154 { .mib; add r33=-1,r33
158 { .mmi; st8 [r32]=r0,8
159 and r2=-8,r33 // len&~7
160 add r33=-8,r33 };; // len-=8
161 { .mib; cmp.ltu p6,p0=8,r2 // ((len+8)&~7)>8
162 (p6) br.cond.dptk .Laligned };;
164 { .mbb; cmp.eq p6,p7=r0,r33
165 (p7) br.cond.dpnt .Little
166 (p6) br.ret.sptk.many b0 };;
167 .endp OPENSSL_cleanse#
169 .global OPENSSL_instrument_bus#
170 .proc OPENSSL_instrument_bus#
171 OPENSSL_instrument_bus:
173 #if defined(_HPUX_SOURCE) && !defined(_LP64)
177 { .mmi; mov r8=ar.itc;;
186 { .mmi; cmpxchg4.acq r3=[r32],r8,ar.ccv
189 { .mmi; mov r8=ar.itc;;
190 sub r10=r8,r9 // diff=tick-lasttick
191 mov r9=r8 };; // lasttick=tick
197 { .mmi; cmpxchg4.acq r3=[r32],r8,ar.ccv
200 { .mib; cmp4.ne p6,p0=0,r33
201 (p6) br.cond.dptk .Loop };;
203 { .mib; sub r8=r2,r33
204 br.ret.sptk.many b0 };;
205 .endp OPENSSL_instrument_bus#
207 .global OPENSSL_instrument_bus2#
208 .proc OPENSSL_instrument_bus2#
209 OPENSSL_instrument_bus2:
210 { .mmi; mov r2=r33 // put aside cnt
211 #if defined(_HPUX_SOURCE) && !defined(_LP64)
215 { .mmi; mov r8=ar.itc;;
224 { .mmi; cmpxchg4.acq r3=[r32],r8,ar.ccv
227 { .mmi; mov r8=ar.itc;;
231 { .mmi; mov r11=r10 // lastdiff=diff
232 add r34=-1,r34 };; // --max
235 cmp4.eq p6,p0=0,r34 };;
239 { .mmb; cmpxchg4.acq r3=[r32],r8,ar.ccv
240 (p6) br.cond.spnt .Ldone2 };;
242 { .mmi; mov r8=ar.itc;;
243 sub r10=r8,r9 // diff=tick-lasttick
244 mov r9=r8 };; // lasttick=tick
245 { .mmi; cmp.ne p6,p0=r10,r11;; // diff!=lastdiff
246 (p6) add r33=-1,r33 };; // conditional --cnt
247 { .mib; cmp4.ne p7,p0=0,r33
248 (p6) add r32=4,r32 // conditional ++out
249 (p7) br.cond.dptk .Loop2 };;
251 { .mib; sub r8=r2,r33
252 br.ret.sptk.many b0 };;
253 .endp OPENSSL_instrument_bus2#