2 # Copyright 2009-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 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
258 $code =~ s/cmpib,\*/comib,/gm if ($SIZE_T==4);
259 $code =~ s/,\*/,/gm if ($SIZE_T==4);
260 $code =~ s/\bbv\b/bve/gm if ($SIZE_T==8);