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*.
40 ! Following is V9 "rd %ccr,%o0" instruction. However! V8
41 ! specification says that it ("rd %asr2,%o0" in V8 terms) does
42 ! not cause illegal_instruction trap. It therefore can be used
43 ! to determine if the CPU the code is executing on is V8- or
44 ! V9-compliant, as V9 returns a distinct value of 0x99,
45 ! "negative" and "borrow" bits set in both %icc and %xcc.
46 .word 0x91408000 !rd %ccr,%o0
50 ! Even though we do not use %fp register bank,
51 ! we wipe it as memcpy might have used it...
52 .word 0xbfa00040 !fmovd %f0,%f62
67 .word 0x83a00040 !fmovd %f0,%f32
125 add %fp,BIAS,%i0 ! return pointer to callerĀ“s top of stack
135 .global walk_reg_wins
136 .type walk_reg_wins,#function
144 cmp %o7,0 ! compiler never cleans %o7...
145 be 1f ! could have been a leaf function...
162 add %o0,1,%i0 ! used for debugging
165 .size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
167 .global OPENSSL_atomic_add
168 .type OPENSSL_atomic_add,#function
172 .word 0x95408000 !rd %ccr,%o2, see comment above
180 ! Note that you don't have to link with libthread to call thr_yield,
181 ! as libc provides a stub, which is overloaded the moment you link
182 ! with *either* libpthread or libthread...
183 #define YIELD_CPU thr_yield
185 ! applies at least to Linux and FreeBSD... Feedback expected...
186 #define YIELD_CPU sched_yield
188 .spin: call YIELD_CPU
207 .word 0xd7e2100a !cas [%o0],%o2,%o3, compare [%o0] with %o2 and swap %o3
210 mov %o3,%o2 ! cas is always fetching to dest. register
211 add %o1,%o2,%o0 ! OpenSSL expects the new value
213 sra %o0,%g0,%o0 ! we return signed int, remember?
214 .size OPENSSL_atomic_add,.-OPENSSL_atomic_add
216 .global OPENSSL_rdtsc
218 .word 0x91408000 !rd %ccr,%o0
222 save %sp,FRAME-16,%sp
223 mov 513,%o0 !SI_PLATFORM
238 .type OPENSSL_rdtsc,#function
239 .size OPENSSL_rdtsc,.-OPENSSL_atomic_add