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
182 my ($out,$cnt,$max)=("r3","r4","r5");
183 my ($tick,$lasttick)=("r6","r7");
184 my ($diff,$lastdiff)=("r8","r9");
187 .globl .OPENSSL_instrument_bus
189 .OPENSSL_instrument_bus:
192 mftb $lasttick # collect 1st tick
195 dcbf 0,$out # flush cache line
196 lwarx $tick,0,$out # load and lock
197 add $tick,$tick,$diff
202 sub $diff,$tick,$lasttick
204 dcbf 0,$out # flush cache line
205 lwarx $tick,0,$out # load and lock
206 add $tick,$tick,$diff
209 addi $out,$out,4 # ++$out
215 .byte 0,12,0x14,0,0,0,2,0
217 .size .OPENSSL_instrument_bus,.-.OPENSSL_instrument_bus
219 .globl .OPENSSL_instrument_bus2
221 .OPENSSL_instrument_bus2:
225 mftb $lasttick # collect 1st tick
228 dcbf 0,$out # flush cache line
229 lwarx $tick,0,$out # load and lock
230 add $tick,$tick,$diff
234 mftb $tick # collect 1st diff
235 sub $diff,$tick,$lasttick
239 dcbf 0,$out # flush cache line
240 lwarx $tick,0,$out # load and lock
241 add $tick,$tick,$diff
249 sub $diff,$tick,$lasttick
251 cmplw 7,$diff,$lastdiff
255 not $tick,$tick # flip bits
256 rlwinm $tick,$tick,1,29,29 # isolate flipped eq bit and scale
258 sub. $cnt,$cnt,$tick # conditional --$cnt
259 add $out,$out,$tick # conditional ++$out
267 .byte 0,12,0x14,0,0,0,3,0
269 .size .OPENSSL_instrument_bus2,.-.OPENSSL_instrument_bus2
273 $code =~ s/\`([^\`]*)\`/eval $1/gem;