5 $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
6 ( $xlate="${dir}ppc-xlate.pl" and -f $xlate ) or
7 ( $xlate="${dir}perlasm/ppc-xlate.pl" and -f $xlate) or
8 die "can't locate ppc-xlate.pl";
10 open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!";
26 .globl .OPENSSL_fpu_probe
32 .byte 0,12,0x14,0,0,0,0,0
33 .size .OPENSSL_fpu_probe,.-.OPENSSL_fpu_probe
34 .globl .OPENSSL_ppc64_probe
41 .byte 0,12,0x14,0,0,0,0,0
42 .size .OPENSSL_ppc64_probe,.-.OPENSSL_ppc64_probe
44 .globl .OPENSSL_altivec_probe
46 .OPENSSL_altivec_probe:
47 .long 0x10000484 # vor v0,v0,v0
50 .byte 0,12,0x14,0,0,0,0,0
51 .size .OPENSSL_altivec_probe,.-..OPENSSL_altivec_probe
53 .globl .OPENSSL_crypto207_probe
55 .OPENSSL_crypto207_probe:
60 .byte 0,12,0x14,0,0,0,0,0
61 .size .OPENSSL_crypto207_probe,.-.OPENSSL_crypto207_probe
63 .globl .OPENSSL_madd300_probe
65 .OPENSSL_madd300_probe:
71 .byte 0,12,0x14,0,0,0,0,0
73 .globl .OPENSSL_wipe_cpu
103 .byte 0,12,0x14,0,0,0,0,0
104 .size .OPENSSL_wipe_cpu,.-.OPENSSL_wipe_cpu
106 .globl .OPENSSL_atomic_add
116 .byte 0,12,0x14,0,0,0,2,0
118 .size .OPENSSL_atomic_add,.-.OPENSSL_atomic_add
120 .globl .OPENSSL_rdtsc
124 $code.=<<___ if ($flavour =~ /64/);
127 $code.=<<___ if ($flavour !~ /64/);
138 .byte 0,12,0x14,0,0,0,0,0
139 .size .OPENSSL_rdtsc,.-.OPENSSL_rdtsc
141 .globl .OPENSSL_cleanse
170 .byte 0,12,0x14,0,0,0,2,0
172 .size .OPENSSL_cleanse,.-.OPENSSL_cleanse
175 my ($out,$cnt,$max)=("r3","r4","r5");
176 my ($tick,$lasttick)=("r6","r7");
177 my ($diff,$lastdiff)=("r8","r9");
180 .globl .OPENSSL_instrument_bus
182 .OPENSSL_instrument_bus:
185 mftb $lasttick # collect 1st tick
188 dcbf 0,$out # flush cache line
189 lwarx $tick,0,$out # load and lock
190 add $tick,$tick,$diff
195 sub $diff,$tick,$lasttick
197 dcbf 0,$out # flush cache line
198 lwarx $tick,0,$out # load and lock
199 add $tick,$tick,$diff
202 addi $out,$out,4 # ++$out
208 .byte 0,12,0x14,0,0,0,2,0
210 .size .OPENSSL_instrument_bus,.-.OPENSSL_instrument_bus
212 .globl .OPENSSL_instrument_bus2
214 .OPENSSL_instrument_bus2:
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
227 mftb $tick # collect 1st diff
228 sub $diff,$tick,$lasttick
232 dcbf 0,$out # flush cache line
233 lwarx $tick,0,$out # load and lock
234 add $tick,$tick,$diff
242 sub $diff,$tick,$lasttick
244 cmplw 7,$diff,$lastdiff
248 not $tick,$tick # flip bits
249 rlwinm $tick,$tick,1,29,29 # isolate flipped eq bit and scale
251 sub. $cnt,$cnt,$tick # conditional --$cnt
252 add $out,$out,$tick # conditional ++$out
260 .byte 0,12,0x14,0,0,0,3,0
262 .size .OPENSSL_instrument_bus2,.-.OPENSSL_instrument_bus2
266 $code =~ s/\`([^\`]*)\`/eval $1/gem;