1 // Copyright 2004-2017 The OpenSSL Project Authors. All Rights Reserved.
3 // Licensed under the OpenSSL license (the "License"). You may not use
4 // this file except in compliance with the License. You can obtain a copy
5 // in the file LICENSE in the source distribution or at
6 // https://www.openssl.org/source/license.html
7 // Works on all IA-64 platforms: Linux, HP-UX, Win64i...
8 // On Win64i compile with ias.exe.
11 #if defined(_HPUX_SOURCE) && !defined(_LP64)
17 .global OPENSSL_cpuid_setup#
18 .proc OPENSSL_cpuid_setup#
20 { .mib; br.ret.sptk.many b0 };;
21 .endp OPENSSL_cpuid_setup#
23 .global OPENSSL_rdtsc#
27 br.ret.sptk.many b0 };;
30 .global OPENSSL_atomic_add#
31 .proc OPENSSL_atomic_add#
42 cmpxchg4.acq r2=[r32],r8,ar.ccv
44 { .mib; cmp.ne p6,p0=r2,r3
46 (p6) br.dpnt .Lspin };;
49 br.ret.sptk.many b0 };;
50 .endp OPENSSL_atomic_add#
52 // Returns a structure comprising pointer to the top of stack of
53 // the caller and pointer beyond backing storage for the current
54 // register frame. The latter is required, because it might be
55 // insufficient to wipe backing storage for the current frame
56 // (as this procedure does), one might have to go further, toward
57 // higher addresses to reach for whole "retroactively" saved
59 .global OPENSSL_wipe_cpu#
60 .proc OPENSSL_wipe_cpu#
67 { .mib; alloc r2=ar.pfs,0,96,0,96
69 brp.loop.imp .L_wipe_top,.L_wipe_end-16
75 { .mii; add r9=96*8-8,r9
78 // One can sweep double as fast, but then we can't guarantee
79 // that backing storage is wiped...
81 { .mfi; st8 [r9]=r0,-8
86 br.ctop.sptk .L_wipe_top };;
134 { .mfi; add r9=96*8+8,r9
140 .endp OPENSSL_wipe_cpu#
142 .global OPENSSL_cleanse#
143 .proc OPENSSL_cleanse#
145 { .mib; cmp.eq p6,p0=0,r33 // len==0
147 (p6) br.ret.spnt b0 };;
149 cmp.leu p6,p0=15,r33 // len>=15
150 (p6) br.cond.dptk .Lot };;
153 { .mib; st1 [r32]=r0,1
154 cmp.ltu p6,p7=1,r33 } // len>1
155 { .mbb; add r33=-1,r33 // len--
156 (p6) br.cond.dptk .Little
157 (p7) br.ret.sptk.many b0 };;
160 { .mib; cmp.eq p6,p0=0,r2
161 (p6) br.cond.dptk .Laligned };;
162 { .mmi; st1 [r32]=r0,1;;
164 { .mib; add r33=-1,r33
168 { .mmi; st8 [r32]=r0,8
169 and r2=-8,r33 // len&~7
170 add r33=-8,r33 };; // len-=8
171 { .mib; cmp.ltu p6,p0=8,r2 // ((len+8)&~7)>8
172 (p6) br.cond.dptk .Laligned };;
174 { .mbb; cmp.eq p6,p7=r0,r33
175 (p7) br.cond.dpnt .Little
176 (p6) br.ret.sptk.many b0 };;
177 .endp OPENSSL_cleanse#
179 .global CRYPTO_memcmp#
186 cmp.eq p6,p0=0,r34 // len==0?
187 (p6) br.ret.spnt b0 };;
189 { .mib; alloc r2=ar.pfs,3,5,0,8
192 brp.loop.imp .Loop_cmp_ctop,.Loop_cmp_cend-16
194 { .mib; sub r10=r34,r0,1
197 { .mii; ADDP r16=0,r32
200 { .mib; ADDP r17=0,r33
204 { .mib; (p16) ld1 r32=[r16],1
205 (p18) xor r34=r34,r38 }
206 { .mib; (p16) ld1 r36=[r17],1
208 br.ctop.sptk .Loop_cmp_ctop };;
211 { .mib; cmp.ne p6,p0=0,r8
216 br.ret.sptk.many b0 };;
219 .global OPENSSL_instrument_bus#
220 .proc OPENSSL_instrument_bus#
221 OPENSSL_instrument_bus:
224 { .mmi; mov r8=ar.itc;;
233 { .mmi; cmpxchg4.acq r3=[r32],r8,ar.ccv
236 { .mmi; mov r8=ar.itc;;
237 sub r10=r8,r9 // diff=tick-lasttick
238 mov r9=r8 };; // lasttick=tick
244 { .mmi; cmpxchg4.acq r3=[r32],r8,ar.ccv
247 { .mib; cmp4.ne p6,p0=0,r33
248 (p6) br.cond.dptk .Loop };;
250 { .mib; sub r8=r2,r33
251 br.ret.sptk.many b0 };;
252 .endp OPENSSL_instrument_bus#
254 .global OPENSSL_instrument_bus2#
255 .proc OPENSSL_instrument_bus2#
256 OPENSSL_instrument_bus2:
257 { .mmi; mov r2=r33 // put aside cnt
259 { .mmi; mov r8=ar.itc;;
268 { .mmi; cmpxchg4.acq r3=[r32],r8,ar.ccv
271 { .mmi; mov r8=ar.itc;;
275 { .mmi; mov r11=r10 // lastdiff=diff
276 add r34=-1,r34 };; // --max
279 cmp4.eq p6,p0=0,r34 };;
283 { .mmb; cmpxchg4.acq r3=[r32],r8,ar.ccv
284 (p6) br.cond.spnt .Ldone2 };;
286 { .mmi; mov r8=ar.itc;;
287 sub r10=r8,r9 // diff=tick-lasttick
288 mov r9=r8 };; // lasttick=tick
289 { .mmi; cmp.ne p6,p0=r10,r11;; // diff!=lastdiff
290 (p6) add r33=-1,r33 };; // conditional --cnt
291 { .mib; cmp4.ne p7,p0=0,r33
292 (p6) add r32=4,r32 // conditional ++out
293 (p7) br.cond.dptk .Loop2 };;
295 { .mib; sub r8=r2,r33
296 br.ret.sptk.many b0 };;
297 .endp OPENSSL_instrument_bus2#