2 # Copyright 2009-2018 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 open STDOUT,">$output";
14 if ($flavour =~ /64/) {
31 .SUBSPA \$CODE\$,QUAD=0,ALIGN=8,ACCESS=0x2C,CODE_ONLY
33 .EXPORT OPENSSL_cpuid_setup,ENTRY
44 .EXPORT OPENSSL_rdtsc,ENTRY
56 .EXPORT OPENSSL_wipe_cpu,ENTRY
101 .EXPORT OPENSSL_cleanse,ENTRY,ARGW0=GR,ARGW1=GR
107 cmpib,*= 0,$len,L\$done
109 cmpib,*>>= 15,$len,L\$ittle
113 and,*<> $inp,%r1,%r28
124 addib,*<> -$SIZE_T,%r28,L\$ot
125 ldo $SIZE_T($inp),$inp
127 and,*<> $len,%r1,$len
131 addib,*<> -1,$len,L\$ittle
141 my ($in1,$in2,$len)=("%r26","%r25","%r24");
144 .EXPORT CRYPTO_memcmp,ENTRY,ARGW0=GR,ARGW1=GR,ARGW1=GR
150 cmpib,*= 0,$len,L\$no_data
159 addib,*<> -1,$len,L\$oop_cmp
172 my ($out,$cnt,$max)=("%r26","%r25","%r24");
173 my ($tick,$lasttick)=("%r23","%r22");
174 my ($diff,$lastdiff)=("%r21","%r20");
177 .EXPORT OPENSSL_instrument_bus,ENTRY,ARGW0=GR,ARGW1=GR
179 OPENSSL_instrument_bus
190 add $diff,$tick,$tick
194 sub $tick,$lasttick,$diff
199 add $diff,$tick,$tick
202 addib,<> -1,$cnt,L\$oop
210 .EXPORT OPENSSL_instrument_bus2,ENTRY,ARGW0=GR,ARGW1=GR
212 OPENSSL_instrument_bus2
225 add $diff,$tick,$tick
229 sub $tick,$lasttick,$diff
235 add $diff,$tick,$tick
238 addib,= -1,$max,L\$done2
242 sub $tick,$lasttick,$diff
244 cmpclr,<> $lastdiff,$diff,$tick
249 addb,<> $tick,$cnt,L\$oop2
250 shladd,l $tick,2,$out,$out
259 if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`
260 =~ /GNU assembler/) {
264 foreach(split("\n",$code)) {
266 s/(\.LEVEL\s+2\.0)W/$1w/ if ($gnuas && $SIZE_T==8);
267 s/\.SPACE\s+\$TEXT\$/.text/ if ($gnuas && $SIZE_T==8);
268 s/\.SUBSPA.*// if ($gnuas && $SIZE_T==8);
269 s/cmpib,\*/comib,/ if ($SIZE_T==4);
270 s/,\*/,/ if ($SIZE_T==4);
271 s/\bbv\b/bve/ if ($SIZE_T==8);