1 #if defined(__SUNPRO_C) && defined(__sparcv9)
2 # define ABI64 /* They've said -xarch=v9 at command line */
3 #elif defined(__GNUC__) && defined(__arch64__)
4 # define ABI64 /* They've said -m64 at command line */
19 .global OPENSSL_wipe_cpu
20 .type OPENSSL_wipe_cpu,#function
21 ! Keep in mind that this does not excuse us from wiping the stack!
22 ! This routine wipes registers, but not the backing store [which
23 ! resides on the stack, toward lower addresses]. To facilitate for
24 ! stack wiping I return pointer to the top of stack of the *caller*.
41 ! Following is V9 "rd %ccr,%o0" instruction. However! V8
42 ! specification says that it ("rd %asr2,%o0" in V8 terms) does
43 ! not cause illegal_instruction trap. It therefore can be used
44 ! to determine if the CPU the code is executing on is V8- or
45 ! V9-compliant, as V9 returns a distinct value of 0x99,
46 ! "negative" and "borrow" bits set in both %icc and %xcc.
47 .word 0x91408000 !rd %ccr,%o0
51 ! Even though we do not use %fp register bank,
52 ! we wipe it as memcpy might have used it...
53 .word 0xbfa00040 !fmovd %f0,%f62
68 .word 0x83a00040 !fmovd %f0,%f32
126 add %fp,BIAS,%i0 ! return pointer to callerĀ“s top of stack
136 .global walk_reg_wins
137 .type walk_reg_wins,#function
145 cmp %o7,0 ! compiler never cleans %o7...
146 be 1f ! could have been a leaf function...
163 add %o0,1,%i0 ! used for debugging
166 .size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
168 .global OPENSSL_atomic_add
169 .type OPENSSL_atomic_add,#function
174 .word 0x95408000 !rd %ccr,%o2, see comment above
182 ! Note that you don't have to link with libthread to call thr_yield,
183 ! as libc provides a stub, which is overloaded the moment you link
184 ! with *either* libpthread or libthread...
185 #define YIELD_CPU thr_yield
187 ! applies at least to Linux and FreeBSD... Feedback expected...
188 #define YIELD_CPU sched_yield
190 .spin: call YIELD_CPU
209 .word 0xd7e2100a !cas [%o0],%o2,%o3, compare [%o0] with %o2 and swap %o3
212 mov %o3,%o2 ! cas is always fetching to dest. register
213 add %o1,%o2,%o0 ! OpenSSL expects the new value
215 sra %o0,%g0,%o0 ! we return signed int, remember?
216 .size OPENSSL_atomic_add,.-OPENSSL_atomic_add
218 .global _sparcv9_rdtick
222 .word 0x91408000 !rd %ccr,%o0
226 .word 0x91410000 !rd %tick,%o0
228 .word 0x93323020 !srlx %o2,32,%o1
232 .type _sparcv9_rdtick,#function
233 .size _sparcv9_rdtick,.-_sparcv9_rdtick
235 .global OPENSSL_cleanse
262 ! see above for explanation
263 .word 0x83408000 !rd %ccr,%g1
269 .v9lot: andcc %o0,7,%g0
278 .word 0xc0720000 !stx %g0,[%o0]
282 .word 0x126ffffd !bnz %xcc,.v9aligned
284 .word 0x124ffffd !bnz %icc,.v9aligned
294 .v8lot: andcc %o0,3,%g0
315 .type OPENSSL_cleanse,#function
316 .size OPENSSL_cleanse,.-OPENSSL_cleanse
318 .section ".init",#alloc,#execinstr
319 call OPENSSL_cpuid_setup