diff options
author | miod <> | 2016-11-04 17:30:30 +0000 |
---|---|---|
committer | miod <> | 2016-11-04 17:30:30 +0000 |
commit | 723502d9588ba0e1cc08af1b12654917da74d440 (patch) | |
tree | 77b413175d422148cfb0ef7b2062340230aa5413 /src/lib/libcrypto/perlasm | |
parent | 391f8ce21bb7929810460a73e2fde2c80540848d (diff) | |
download | openbsd-723502d9588ba0e1cc08af1b12654917da74d440.tar.gz openbsd-723502d9588ba0e1cc08af1b12654917da74d440.tar.bz2 openbsd-723502d9588ba0e1cc08af1b12654917da74d440.zip |
Replace all uses of magic numbers when operating on OPENSSL_ia32_P[] by
meaningful constants in a private header file, so that reviewers can actually
get a chance to figure out what the code is attempting to do without knowing
all cpuid bits.
While there, turn it from an array of two 32-bit ints into a properly aligned
64-bit int.
Use of OPENSSL_ia32_P is now restricted to the assembler parts. C code will
now always use OPENSSL_cpu_caps() and check for the proper bits in the
whole 64-bit word it returns.
i386 tests and ok jsing@
Diffstat (limited to 'src/lib/libcrypto/perlasm')
-rwxr-xr-x | src/lib/libcrypto/perlasm/x86_64-xlate.pl | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/perlasm/x86asm.pl | 1 | ||||
-rw-r--r-- | src/lib/libcrypto/perlasm/x86gas.pl | 6 |
3 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/libcrypto/perlasm/x86_64-xlate.pl b/src/lib/libcrypto/perlasm/x86_64-xlate.pl index 4bd53da33d..a8393d2730 100755 --- a/src/lib/libcrypto/perlasm/x86_64-xlate.pl +++ b/src/lib/libcrypto/perlasm/x86_64-xlate.pl | |||
@@ -393,7 +393,7 @@ my %globals; | |||
393 | } | 393 | } |
394 | } | 394 | } |
395 | } | 395 | } |
396 | { package expr; # pick up expressioins | 396 | { package expr; # pick up expressions |
397 | sub re { | 397 | sub re { |
398 | my $self = shift; # single instance is enough... | 398 | my $self = shift; # single instance is enough... |
399 | local *line = shift; | 399 | local *line = shift; |
@@ -777,6 +777,8 @@ ___ | |||
777 | OPTION DOTNAME | 777 | OPTION DOTNAME |
778 | ___ | 778 | ___ |
779 | } | 779 | } |
780 | print "#include \"x86_arch.h\"\n"; | ||
781 | |||
780 | while($line=<>) { | 782 | while($line=<>) { |
781 | 783 | ||
782 | chomp($line); | 784 | chomp($line); |
diff --git a/src/lib/libcrypto/perlasm/x86asm.pl b/src/lib/libcrypto/perlasm/x86asm.pl index 5916ea4f89..e039382e00 100644 --- a/src/lib/libcrypto/perlasm/x86asm.pl +++ b/src/lib/libcrypto/perlasm/x86asm.pl | |||
@@ -248,6 +248,7 @@ EOF | |||
248 | $pic=0; | 248 | $pic=0; |
249 | for (@ARGV) { $pic=1 if (/\-[fK]PIC/i); } | 249 | for (@ARGV) { $pic=1 if (/\-[fK]PIC/i); } |
250 | 250 | ||
251 | ::emitraw("#include \"x86_arch.h\"\n"); | ||
251 | ::emitraw("#include <machine/asm.h>\n") if $openbsd; | 252 | ::emitraw("#include <machine/asm.h>\n") if $openbsd; |
252 | $filename =~ s/\.pl$//; | 253 | $filename =~ s/\.pl$//; |
253 | &file($filename); | 254 | &file($filename); |
diff --git a/src/lib/libcrypto/perlasm/x86gas.pl b/src/lib/libcrypto/perlasm/x86gas.pl index d4baea514b..84d24edbbd 100644 --- a/src/lib/libcrypto/perlasm/x86gas.pl +++ b/src/lib/libcrypto/perlasm/x86gas.pl | |||
@@ -157,10 +157,8 @@ sub ::file_end | |||
157 | } | 157 | } |
158 | } | 158 | } |
159 | if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out) { | 159 | if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out) { |
160 | my $tmp=".comm\t${nmdecor}OPENSSL_ia32cap_P,8"; | 160 | push (@out, ".extern\t${nmdecor}OPENSSL_ia32cap_P\n"); |
161 | if ($::macosx) { push (@out,"$tmp,2\n"); } | 161 | push (@out, ".hidden\t${nmdecor}OPENSSL_ia32cap_P\n"); |
162 | elsif ($::elf) { push (@out,"$tmp,4\n"); } | ||
163 | else { push (@out,"$tmp\n"); } | ||
164 | } | 162 | } |
165 | push(@out,$initseg) if ($initseg); | 163 | push(@out,$initseg) if ($initseg); |
166 | } | 164 | } |