2 # Copyright 2007-2016 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the OpenSSL license (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
12 $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
13 ( $xlate="${dir}ppc-xlate.pl" and -f $xlate ) or
14 ( $xlate="${dir}perlasm/ppc-xlate.pl" and -f $xlate) or
15 die "can't locate ppc-xlate.pl";
17 open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!";
33 .globl .OPENSSL_fpu_probe
39 .byte 0,12,0x14,0,0,0,0,0
40 .size .OPENSSL_fpu_probe,.-.OPENSSL_fpu_probe
41 .globl .OPENSSL_ppc64_probe
48 .byte 0,12,0x14,0,0,0,0,0
49 .size .OPENSSL_ppc64_probe,.-.OPENSSL_ppc64_probe
51 .globl .OPENSSL_altivec_probe
53 .OPENSSL_altivec_probe:
54 .long 0x10000484 # vor v0,v0,v0
57 .byte 0,12,0x14,0,0,0,0,0
58 .size .OPENSSL_altivec_probe,.-..OPENSSL_altivec_probe
60 .globl .OPENSSL_crypto207_probe
62 .OPENSSL_crypto207_probe:
67 .byte 0,12,0x14,0,0,0,0,0
68 .size .OPENSSL_crypto207_probe,.-.OPENSSL_crypto207_probe
70 .globl .OPENSSL_madd300_probe
72 .OPENSSL_madd300_probe:
78 .byte 0,12,0x14,0,0,0,0,0
80 .globl .OPENSSL_wipe_cpu
110 .byte 0,12,0x14,0,0,0,0,0
111 .size .OPENSSL_wipe_cpu,.-.OPENSSL_wipe_cpu
113 .globl .OPENSSL_atomic_add
123 .byte 0,12,0x14,0,0,0,2,0
125 .size .OPENSSL_atomic_add,.-.OPENSSL_atomic_add
127 .globl .OPENSSL_rdtsc
131 $code.=<<___ if ($flavour =~ /64/);
134 $code.=<<___ if ($flavour !~ /64/);
145 .byte 0,12,0x14,0,0,0,0,0
146 .size .OPENSSL_rdtsc,.-.OPENSSL_rdtsc
148 .globl .OPENSSL_cleanse
177 .byte 0,12,0x14,0,0,0,2,0
179 .size .OPENSSL_cleanse,.-.OPENSSL_cleanse
203 .byte 0,12,0x14,0,0,0,3,0
205 .size .CRYPTO_memcmp,.-.CRYPTO_memcmp
208 my ($out,$cnt,$max)=("r3","r4","r5");
209 my ($tick,$lasttick)=("r6","r7");
210 my ($diff,$lastdiff)=("r8","r9");
213 .globl .OPENSSL_instrument_bus
215 .OPENSSL_instrument_bus:
218 mftb $lasttick # collect 1st tick
221 dcbf 0,$out # flush cache line
222 lwarx $tick,0,$out # load and lock
223 add $tick,$tick,$diff
228 sub $diff,$tick,$lasttick
230 dcbf 0,$out # flush cache line
231 lwarx $tick,0,$out # load and lock
232 add $tick,$tick,$diff
235 addi $out,$out,4 # ++$out
241 .byte 0,12,0x14,0,0,0,2,0
243 .size .OPENSSL_instrument_bus,.-.OPENSSL_instrument_bus
245 .globl .OPENSSL_instrument_bus2
247 .OPENSSL_instrument_bus2:
251 mftb $lasttick # collect 1st tick
254 dcbf 0,$out # flush cache line
255 lwarx $tick,0,$out # load and lock
256 add $tick,$tick,$diff
260 mftb $tick # collect 1st diff
261 sub $diff,$tick,$lasttick
265 dcbf 0,$out # flush cache line
266 lwarx $tick,0,$out # load and lock
267 add $tick,$tick,$diff
275 sub $diff,$tick,$lasttick
277 cmplw 7,$diff,$lastdiff
281 not $tick,$tick # flip bits
282 rlwinm $tick,$tick,1,29,29 # isolate flipped eq bit and scale
284 sub. $cnt,$cnt,$tick # conditional --$cnt
285 add $out,$out,$tick # conditional ++$out
293 .byte 0,12,0x14,0,0,0,3,0
295 .size .OPENSSL_instrument_bus2,.-.OPENSSL_instrument_bus2
299 $code =~ s/\`([^\`]*)\`/eval $1/gem;