diff options
| author | djm <> | 2012-10-13 21:23:57 +0000 |
|---|---|---|
| committer | djm <> | 2012-10-13 21:23:57 +0000 |
| commit | 0f4e59be0458751f14ec603610fb285ff9737a1c (patch) | |
| tree | 51d00d308f46148b4b341133936e44706703ad8b /src/lib/libcrypto/perlasm/x86masm.pl | |
| parent | 050e39dc2dfd5d05183a7283530fcaf13f832ba2 (diff) | |
| download | openbsd-0f4e59be0458751f14ec603610fb285ff9737a1c.tar.gz openbsd-0f4e59be0458751f14ec603610fb285ff9737a1c.tar.bz2 openbsd-0f4e59be0458751f14ec603610fb285ff9737a1c.zip | |
import OpenSSL-1.0.1c
Diffstat (limited to 'src/lib/libcrypto/perlasm/x86masm.pl')
| -rw-r--r-- | src/lib/libcrypto/perlasm/x86masm.pl | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/lib/libcrypto/perlasm/x86masm.pl b/src/lib/libcrypto/perlasm/x86masm.pl index 3d50e4a786..96b1b73e1a 100644 --- a/src/lib/libcrypto/perlasm/x86masm.pl +++ b/src/lib/libcrypto/perlasm/x86masm.pl | |||
| @@ -14,9 +14,11 @@ sub ::generic | |||
| 14 | { my ($opcode,@arg)=@_; | 14 | { my ($opcode,@arg)=@_; |
| 15 | 15 | ||
| 16 | # fix hexadecimal constants | 16 | # fix hexadecimal constants |
| 17 | for (@arg) { s/0x([0-9a-f]+)/0$1h/oi; } | 17 | for (@arg) { s/(?<![\w\$\.])0x([0-9a-f]+)/0$1h/oi; } |
| 18 | 18 | ||
| 19 | if ($opcode !~ /movq/) | 19 | if ($opcode =~ /lea/ && @arg[1] =~ s/.*PTR\s+(\(.*\))$/OFFSET $1/) # no [] |
| 20 | { $opcode="mov"; } | ||
| 21 | elsif ($opcode !~ /movq/) | ||
| 20 | { # fix xmm references | 22 | { # fix xmm references |
| 21 | $arg[0] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[1]=~/\bxmm[0-7]\b/i); | 23 | $arg[0] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[1]=~/\bxmm[0-7]\b/i); |
| 22 | $arg[1] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[0]=~/\bxmm[0-7]\b/i); | 24 | $arg[1] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[0]=~/\bxmm[0-7]\b/i); |
| @@ -65,6 +67,7 @@ sub get_mem | |||
| 65 | $ret; | 67 | $ret; |
| 66 | } | 68 | } |
| 67 | sub ::BP { &get_mem("BYTE",@_); } | 69 | sub ::BP { &get_mem("BYTE",@_); } |
| 70 | sub ::WP { &get_mem("WORD",@_); } | ||
| 68 | sub ::DWP { &get_mem("DWORD",@_); } | 71 | sub ::DWP { &get_mem("DWORD",@_); } |
| 69 | sub ::QWP { &get_mem("QWORD",@_); } | 72 | sub ::QWP { &get_mem("QWORD",@_); } |
| 70 | sub ::BC { "@_"; } | 73 | sub ::BC { "@_"; } |
| @@ -129,7 +132,7 @@ ___ | |||
| 129 | if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out) | 132 | if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out) |
| 130 | { my $comm=<<___; | 133 | { my $comm=<<___; |
| 131 | .bss SEGMENT 'BSS' | 134 | .bss SEGMENT 'BSS' |
| 132 | COMM ${nmdecor}OPENSSL_ia32cap_P:DWORD | 135 | COMM ${nmdecor}OPENSSL_ia32cap_P:QWORD |
| 133 | .bss ENDS | 136 | .bss ENDS |
| 134 | ___ | 137 | ___ |
| 135 | # comment out OPENSSL_ia32cap_P declarations | 138 | # comment out OPENSSL_ia32cap_P declarations |
| @@ -156,6 +159,9 @@ sub ::public_label | |||
| 156 | sub ::data_byte | 159 | sub ::data_byte |
| 157 | { push(@out,("DB\t").join(',',@_)."\n"); } | 160 | { push(@out,("DB\t").join(',',@_)."\n"); } |
| 158 | 161 | ||
| 162 | sub ::data_short | ||
| 163 | { push(@out,("DW\t").join(',',@_)."\n"); } | ||
| 164 | |||
| 159 | sub ::data_word | 165 | sub ::data_word |
| 160 | { push(@out,("DD\t").join(',',@_)."\n"); } | 166 | { push(@out,("DD\t").join(',',@_)."\n"); } |
| 161 | 167 | ||
| @@ -181,4 +187,11 @@ ___ | |||
| 181 | sub ::dataseg | 187 | sub ::dataseg |
| 182 | { push(@out,"$segment\tENDS\n_DATA\tSEGMENT\n"); $segment="_DATA"; } | 188 | { push(@out,"$segment\tENDS\n_DATA\tSEGMENT\n"); $segment="_DATA"; } |
| 183 | 189 | ||
| 190 | sub ::safeseh | ||
| 191 | { my $nm=shift; | ||
| 192 | push(@out,"IF \@Version GE 710\n"); | ||
| 193 | push(@out,".SAFESEH ".&::LABEL($nm,$nmdecor.$nm)."\n"); | ||
| 194 | push(@out,"ENDIF\n"); | ||
| 195 | } | ||
| 196 | |||
| 184 | 1; | 197 | 1; |
