2 # Copyright 2007-2022 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the Apache License 2.0 (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
10 # $output is the last argument if it looks like a file (it has an extension)
11 # $flavour is the first argument if it doesn't look like a file
12 $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m
|\
.\w
+$| ?
pop : undef;
13 $flavour = $#ARGV >= 0 && $ARGV[0] !~ m
|\
.| ?
shift : undef;
15 $0 =~ m/(.*[\/\\])[^\
/\\]+$/; $dir=$1;
16 ( $xlate="${dir}ppc-xlate.pl" and -f
$xlate ) or
17 ( $xlate="${dir}perlasm/ppc-xlate.pl" and -f
$xlate) or
18 die "can't locate ppc-xlate.pl";
20 open STDOUT
,"| $^X $xlate $flavour \"$output\""
21 or die "can't call $xlate: $!";
37 .globl
.OPENSSL_fpu_probe
43 .byte
0,12,0x14,0,0,0,0,0
44 .size
.OPENSSL_fpu_probe
,.-.OPENSSL_fpu_probe
45 .globl
.OPENSSL_ppc64_probe
52 .byte
0,12,0x14,0,0,0,0,0
53 .size
.OPENSSL_ppc64_probe
,.-.OPENSSL_ppc64_probe
55 .globl
.OPENSSL_altivec_probe
57 .OPENSSL_altivec_probe
:
58 .long
0x10000484 # vor v0,v0,v0
61 .byte
0,12,0x14,0,0,0,0,0
62 .size
.OPENSSL_altivec_probe
,.-..OPENSSL_altivec_probe
64 .globl
.OPENSSL_crypto207_probe
66 .OPENSSL_crypto207_probe
:
71 .byte
0,12,0x14,0,0,0,0,0
72 .size
.OPENSSL_crypto207_probe
,.-.OPENSSL_crypto207_probe
74 .globl
.OPENSSL_madd300_probe
76 .OPENSSL_madd300_probe
:
82 .byte
0,12,0x14,0,0,0,0,0
84 .globl
.OPENSSL_brd31_probe
91 .byte
0,12,0x14,0,0,0,0,0
92 .size
.OPENSSL_brd31_probe
,.-.OPENSSL_brd31_probe
95 .globl
.OPENSSL_wipe_cpu
125 .byte
0,12,0x14,0,0,0,0,0
126 .size
.OPENSSL_wipe_cpu
,.-.OPENSSL_wipe_cpu
128 .globl
.OPENSSL_atomic_add
138 .byte
0,12,0x14,0,0,0,2,0
140 .size
.OPENSSL_atomic_add
,.-.OPENSSL_atomic_add
142 .globl
.OPENSSL_rdtsc_mftb
148 .byte
0,12,0x14,0,0,0,0,0
149 .size
.OPENSSL_rdtsc_mftb
,.-.OPENSSL_rdtsc_mftb
151 .globl
.OPENSSL_rdtsc_mfspr268
153 .OPENSSL_rdtsc_mfspr268
:
157 .byte
0,12,0x14,0,0,0,0,0
158 .size
.OPENSSL_rdtsc_mfspr268
,.-.OPENSSL_rdtsc_mfspr268
160 .globl
.OPENSSL_cleanse
189 .byte
0,12,0x14,0,0,0,2,0
191 .size
.OPENSSL_cleanse
,.-.OPENSSL_cleanse
215 .byte
0,12,0x14,0,0,0,3,0
217 .size
.CRYPTO_memcmp
,.-.CRYPTO_memcmp
220 my ($out,$cnt,$max)=("r3","r4","r5");
221 my ($tick,$lasttick)=("r6","r7");
222 my ($diff,$lastdiff)=("r8","r9");
225 .globl
.OPENSSL_instrument_bus_mftb
227 .OPENSSL_instrument_bus_mftb
:
230 mftb
$lasttick # collect 1st tick
233 dcbf
0,$out # flush cache line
234 lwarx
$tick,0,$out # load and lock
235 add
$tick,$tick,$diff
240 sub $diff,$tick,$lasttick
242 dcbf
0,$out # flush cache line
243 lwarx
$tick,0,$out # load and lock
244 add
$tick,$tick,$diff
247 addi
$out,$out,4 # ++$out
253 .byte
0,12,0x14,0,0,0,2,0
255 .size
.OPENSSL_instrument_bus_mftb
,.-.OPENSSL_instrument_bus_mftb
257 .globl
.OPENSSL_instrument_bus2_mftb
259 .OPENSSL_instrument_bus2_mftb
:
263 mftb
$lasttick # collect 1st tick
266 dcbf
0,$out # flush cache line
267 lwarx
$tick,0,$out # load and lock
268 add
$tick,$tick,$diff
272 mftb
$tick # collect 1st diff
273 sub $diff,$tick,$lasttick
277 dcbf
0,$out # flush cache line
278 lwarx
$tick,0,$out # load and lock
279 add
$tick,$tick,$diff
287 sub $diff,$tick,$lasttick
289 cmplw
7,$diff,$lastdiff
293 not $tick,$tick # flip bits
294 rlwinm
$tick,$tick,1,29,29 # isolate flipped eq bit and scale
296 sub. $cnt,$cnt,$tick # conditional --$cnt
297 add
$out,$out,$tick # conditional ++$out
305 .byte
0,12,0x14,0,0,0,3,0
307 .size
.OPENSSL_instrument_bus2_mftb
,.-.OPENSSL_instrument_bus2_mftb
309 .globl
.OPENSSL_instrument_bus_mfspr268
311 .OPENSSL_instrument_bus_mfspr268
:
314 mfspr
$lasttick,268 # collect 1st tick
317 dcbf
0,$out # flush cache line
318 lwarx
$tick,0,$out # load and lock
319 add
$tick,$tick,$diff
323 Loop3
: mfspr
$tick,268
324 sub $diff,$tick,$lasttick
326 dcbf
0,$out # flush cache line
327 lwarx
$tick,0,$out # load and lock
328 add
$tick,$tick,$diff
331 addi
$out,$out,4 # ++$out
337 .byte
0,12,0x14,0,0,0,2,0
339 .size
.OPENSSL_instrument_bus_mfspr268
,.-.OPENSSL_instrument_bus_mfspr268
341 .globl
.OPENSSL_instrument_bus2_mfspr268
343 .OPENSSL_instrument_bus2_mfspr268
:
347 mfspr
$lasttick,268 # collect 1st tick
350 dcbf
0,$out # flush cache line
351 lwarx
$tick,0,$out # load and lock
352 add
$tick,$tick,$diff
356 mfspr
$tick,268 # collect 1st diff
357 sub $diff,$tick,$lasttick
361 dcbf
0,$out # flush cache line
362 lwarx
$tick,0,$out # load and lock
363 add
$tick,$tick,$diff
371 sub $diff,$tick,$lasttick
373 cmplw
7,$diff,$lastdiff
377 not $tick,$tick # flip bits
378 rlwinm
$tick,$tick,1,29,29 # isolate flipped eq bit and scale
380 sub. $cnt,$cnt,$tick # conditional --$cnt
381 add
$out,$out,$tick # conditional ++$out
389 .byte
0,12,0x14,0,0,0,3,0
391 .size
.OPENSSL_instrument_bus2_mfspr268
,.-.OPENSSL_instrument_bus2_mfspr268
395 $code =~ s/\`([^\`]*)\`/eval $1/gem;
397 close STDOUT
or die "error closing STDOUT: $!";