diff options
| author | markus <> | 2003-05-12 02:18:40 +0000 |
|---|---|---|
| committer | markus <> | 2003-05-12 02:18:40 +0000 |
| commit | d4fcd82bb7f6d603bd61e19a81ba97337b89dfca (patch) | |
| tree | d52e3a0f1f08f65ad283027e560e17ed0d720462 /src/lib/libcrypto/perlasm | |
| parent | 582bbd139cd2afd58d10dc051c5b0b989b441074 (diff) | |
| download | openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.tar.gz openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.tar.bz2 openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.zip | |
merge 0.9.7b with local changes; crank majors for libssl/libcrypto
Diffstat (limited to 'src/lib/libcrypto/perlasm')
| -rw-r--r-- | src/lib/libcrypto/perlasm/cbc.pl | 41 | ||||
| -rw-r--r-- | src/lib/libcrypto/perlasm/x86asm.pl | 9 | ||||
| -rw-r--r-- | src/lib/libcrypto/perlasm/x86ms.pl | 15 | ||||
| -rw-r--r-- | src/lib/libcrypto/perlasm/x86nasm.pl | 15 | ||||
| -rw-r--r-- | src/lib/libcrypto/perlasm/x86unix.pl | 53 |
5 files changed, 103 insertions, 30 deletions
diff --git a/src/lib/libcrypto/perlasm/cbc.pl b/src/lib/libcrypto/perlasm/cbc.pl index 0145c4f0cc..22149c680e 100644 --- a/src/lib/libcrypto/perlasm/cbc.pl +++ b/src/lib/libcrypto/perlasm/cbc.pl | |||
| @@ -146,9 +146,15 @@ sub cbc | |||
| 146 | &mov($count, &wparam(2)); # length | 146 | &mov($count, &wparam(2)); # length |
| 147 | &and($count, 7); | 147 | &and($count, 7); |
| 148 | &jz(&label("finish")); | 148 | &jz(&label("finish")); |
| 149 | &call(&label("PIC_point")); | ||
| 150 | &set_label("PIC_point"); | ||
| 151 | &blindpop("edx"); | ||
| 152 | &lea("ecx",&DWP(&label("cbc_enc_jmp_table")."-".&label("PIC_point"),"edx")); | ||
| 153 | &mov($count,&DWP(0,"ecx",$count,4)) | ||
| 154 | &add($count,"edx"); | ||
| 149 | &xor("ecx","ecx"); | 155 | &xor("ecx","ecx"); |
| 150 | &xor("edx","edx"); | 156 | &xor("edx","edx"); |
| 151 | &mov($count,&DWP(&label("cbc_enc_jmp_table"),"",$count,4)); | 157 | #&mov($count,&DWP(&label("cbc_enc_jmp_table"),"",$count,4)); |
| 152 | &jmp_ptr($count); | 158 | &jmp_ptr($count); |
| 153 | 159 | ||
| 154 | &set_label("ej7"); | 160 | &set_label("ej7"); |
| @@ -318,22 +324,23 @@ sub cbc | |||
| 318 | 324 | ||
| 319 | &set_label("cbc_enc_jmp_table",1); | 325 | &set_label("cbc_enc_jmp_table",1); |
| 320 | &data_word("0"); | 326 | &data_word("0"); |
| 321 | &data_word(&label("ej1")); | 327 | &data_word(&label("ej1")."-".&label("PIC_point")); |
| 322 | &data_word(&label("ej2")); | 328 | &data_word(&label("ej2")."-".&label("PIC_point")); |
| 323 | &data_word(&label("ej3")); | 329 | &data_word(&label("ej3")."-".&label("PIC_point")); |
| 324 | &data_word(&label("ej4")); | 330 | &data_word(&label("ej4")."-".&label("PIC_point")); |
| 325 | &data_word(&label("ej5")); | 331 | &data_word(&label("ej5")."-".&label("PIC_point")); |
| 326 | &data_word(&label("ej6")); | 332 | &data_word(&label("ej6")."-".&label("PIC_point")); |
| 327 | &data_word(&label("ej7")); | 333 | &data_word(&label("ej7")."-".&label("PIC_point")); |
| 328 | &set_label("cbc_dec_jmp_table",1); | 334 | # not used |
| 329 | &data_word("0"); | 335 | #&set_label("cbc_dec_jmp_table",1); |
| 330 | &data_word(&label("dj1")); | 336 | #&data_word("0"); |
| 331 | &data_word(&label("dj2")); | 337 | #&data_word(&label("dj1")."-".&label("PIC_point")); |
| 332 | &data_word(&label("dj3")); | 338 | #&data_word(&label("dj2")."-".&label("PIC_point")); |
| 333 | &data_word(&label("dj4")); | 339 | #&data_word(&label("dj3")."-".&label("PIC_point")); |
| 334 | &data_word(&label("dj5")); | 340 | #&data_word(&label("dj4")."-".&label("PIC_point")); |
| 335 | &data_word(&label("dj6")); | 341 | #&data_word(&label("dj5")."-".&label("PIC_point")); |
| 336 | &data_word(&label("dj7")); | 342 | #&data_word(&label("dj6")."-".&label("PIC_point")); |
| 343 | #&data_word(&label("dj7")."-".&label("PIC_point")); | ||
| 337 | 344 | ||
| 338 | &function_end_B($name); | 345 | &function_end_B($name); |
| 339 | 346 | ||
diff --git a/src/lib/libcrypto/perlasm/x86asm.pl b/src/lib/libcrypto/perlasm/x86asm.pl index 9a3d85b098..1cb96e914a 100644 --- a/src/lib/libcrypto/perlasm/x86asm.pl +++ b/src/lib/libcrypto/perlasm/x86asm.pl | |||
| @@ -18,9 +18,9 @@ sub main'asm_init | |||
| 18 | ($type,$fn,$i386)=@_; | 18 | ($type,$fn,$i386)=@_; |
| 19 | $filename=$fn; | 19 | $filename=$fn; |
| 20 | 20 | ||
| 21 | $cpp=$sol=$aout=$win32=$gaswin=0; | 21 | $elf=$cpp=$sol=$aout=$win32=$gaswin=0; |
| 22 | if ( ($type eq "elf")) | 22 | if ( ($type eq "elf")) |
| 23 | { require "x86unix.pl"; } | 23 | { $elf=1; require "x86unix.pl"; } |
| 24 | elsif ( ($type eq "a.out")) | 24 | elsif ( ($type eq "a.out")) |
| 25 | { $aout=1; require "x86unix.pl"; } | 25 | { $aout=1; require "x86unix.pl"; } |
| 26 | elsif ( ($type eq "gaswin")) | 26 | elsif ( ($type eq "gaswin")) |
| @@ -47,6 +47,9 @@ EOF | |||
| 47 | exit(1); | 47 | exit(1); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | $pic=0; | ||
| 51 | for (@ARGV) { $pic=1 if (/\-[fK]PIC/i); } | ||
| 52 | |||
| 50 | &asm_init_output(); | 53 | &asm_init_output(); |
| 51 | 54 | ||
| 52 | &comment("Don't even think of reading this code"); | 55 | &comment("Don't even think of reading this code"); |
| @@ -91,7 +94,7 @@ $tmp | |||
| 91 | #undef SIZE | 94 | #undef SIZE |
| 92 | #undef TYPE | 95 | #undef TYPE |
| 93 | #define SIZE(a,b) | 96 | #define SIZE(a,b) |
| 94 | #define TYPE(a,b) | 97 | #define TYPE(a,b) .def a; .scl 2; .type 32; .endef |
| 95 | #endif /* __CYGWIN || __DJGPP */ | 98 | #endif /* __CYGWIN || __DJGPP */ |
| 96 | #endif | 99 | #endif |
| 97 | 100 | ||
diff --git a/src/lib/libcrypto/perlasm/x86ms.pl b/src/lib/libcrypto/perlasm/x86ms.pl index 206452341d..35f1a4ddb9 100644 --- a/src/lib/libcrypto/perlasm/x86ms.pl +++ b/src/lib/libcrypto/perlasm/x86ms.pl | |||
| @@ -92,6 +92,8 @@ sub get_mem | |||
| 92 | $addr="_$addr"; | 92 | $addr="_$addr"; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | if ($addr =~ /^.+\-.+$/) { $addr="($addr)"; } | ||
| 96 | |||
| 95 | $reg1="$regs{$reg1}" if defined($regs{$reg1}); | 97 | $reg1="$regs{$reg1}" if defined($regs{$reg1}); |
| 96 | $reg2="$regs{$reg2}" if defined($regs{$reg2}); | 98 | $reg2="$regs{$reg2}" if defined($regs{$reg2}); |
| 97 | if (($addr ne "") && ($addr ne 0)) | 99 | if (($addr ne "") && ($addr ne 0)) |
| @@ -111,6 +113,7 @@ sub get_mem | |||
| 111 | { | 113 | { |
| 112 | $ret.="[$reg1$post]" | 114 | $ret.="[$reg1$post]" |
| 113 | } | 115 | } |
| 116 | $ret =~ s/\[\]//; # in case $addr was the only argument | ||
| 114 | return($ret); | 117 | return($ret); |
| 115 | } | 118 | } |
| 116 | 119 | ||
| @@ -151,7 +154,7 @@ sub main'push { &out1("push",@_); $stack+=4; } | |||
| 151 | sub main'pop { &out1("pop",@_); $stack-=4; } | 154 | sub main'pop { &out1("pop",@_); $stack-=4; } |
| 152 | sub main'bswap { &out1("bswap",@_); &using486(); } | 155 | sub main'bswap { &out1("bswap",@_); &using486(); } |
| 153 | sub main'not { &out1("not",@_); } | 156 | sub main'not { &out1("not",@_); } |
| 154 | sub main'call { &out1("call",'_'.$_[0]); } | 157 | sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); } |
| 155 | sub main'ret { &out0("ret"); } | 158 | sub main'ret { &out0("ret"); } |
| 156 | sub main'nop { &out0("nop"); } | 159 | sub main'nop { &out0("nop"); } |
| 157 | 160 | ||
| @@ -338,7 +341,7 @@ sub main'set_label | |||
| 338 | { | 341 | { |
| 339 | if (!defined($label{$_[0]})) | 342 | if (!defined($label{$_[0]})) |
| 340 | { | 343 | { |
| 341 | $label{$_[0]}="${label}${_[0]}"; | 344 | $label{$_[0]}="\$${label}${_[0]}"; |
| 342 | $label++; | 345 | $label++; |
| 343 | } | 346 | } |
| 344 | if((defined $_[2]) && ($_[2] == 1)) | 347 | if((defined $_[2]) && ($_[2] == 1)) |
| @@ -363,3 +366,11 @@ sub out1p | |||
| 363 | 366 | ||
| 364 | push(@out,"\t$name\t ".&conv($p1)."\n"); | 367 | push(@out,"\t$name\t ".&conv($p1)."\n"); |
| 365 | } | 368 | } |
| 369 | |||
| 370 | sub main'picmeup | ||
| 371 | { | ||
| 372 | local($dst,$sym)=@_; | ||
| 373 | &main'lea($dst,&main'DWP($sym)); | ||
| 374 | } | ||
| 375 | |||
| 376 | sub main'blindpop { &out1("pop",@_); } | ||
diff --git a/src/lib/libcrypto/perlasm/x86nasm.pl b/src/lib/libcrypto/perlasm/x86nasm.pl index 519d8a5867..f30b7466d4 100644 --- a/src/lib/libcrypto/perlasm/x86nasm.pl +++ b/src/lib/libcrypto/perlasm/x86nasm.pl | |||
| @@ -98,6 +98,8 @@ sub get_mem | |||
| 98 | $addr="_$addr"; | 98 | $addr="_$addr"; |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | if ($addr =~ /^.+\-.+$/) { $addr="($addr)"; } | ||
| 102 | |||
| 101 | $reg1="$regs{$reg1}" if defined($regs{$reg1}); | 103 | $reg1="$regs{$reg1}" if defined($regs{$reg1}); |
| 102 | $reg2="$regs{$reg2}" if defined($regs{$reg2}); | 104 | $reg2="$regs{$reg2}" if defined($regs{$reg2}); |
| 103 | if (($addr ne "") && ($addr ne 0)) | 105 | if (($addr ne "") && ($addr ne 0)) |
| @@ -117,6 +119,7 @@ sub get_mem | |||
| 117 | { | 119 | { |
| 118 | $ret.="$reg1$post]" | 120 | $ret.="$reg1$post]" |
| 119 | } | 121 | } |
| 122 | $ret =~ s/\+\]/]/; # in case $addr was the only argument | ||
| 120 | return($ret); | 123 | return($ret); |
| 121 | } | 124 | } |
| 122 | 125 | ||
| @@ -160,7 +163,7 @@ sub main'push { &out1("push",@_); $stack+=4; } | |||
| 160 | sub main'pop { &out1("pop",@_); $stack-=4; } | 163 | sub main'pop { &out1("pop",@_); $stack-=4; } |
| 161 | sub main'bswap { &out1("bswap",@_); &using486(); } | 164 | sub main'bswap { &out1("bswap",@_); &using486(); } |
| 162 | sub main'not { &out1("not",@_); } | 165 | sub main'not { &out1("not",@_); } |
| 163 | sub main'call { &out1("call",'_'.$_[0]); } | 166 | sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); } |
| 164 | sub main'ret { &out0("ret"); } | 167 | sub main'ret { &out0("ret"); } |
| 165 | sub main'nop { &out0("nop"); } | 168 | sub main'nop { &out0("nop"); } |
| 166 | 169 | ||
| @@ -322,7 +325,7 @@ sub main'set_label | |||
| 322 | { | 325 | { |
| 323 | if (!defined($label{$_[0]})) | 326 | if (!defined($label{$_[0]})) |
| 324 | { | 327 | { |
| 325 | $label{$_[0]}="${label}${_[0]}"; | 328 | $label{$_[0]}="\$${label}${_[0]}"; |
| 326 | $label++; | 329 | $label++; |
| 327 | } | 330 | } |
| 328 | push(@out,"$label{$_[0]}:\n"); | 331 | push(@out,"$label{$_[0]}:\n"); |
| @@ -340,3 +343,11 @@ sub out1p | |||
| 340 | 343 | ||
| 341 | push(@out,"\t$name\t ".&conv($p1)."\n"); | 344 | push(@out,"\t$name\t ".&conv($p1)."\n"); |
| 342 | } | 345 | } |
| 346 | |||
| 347 | sub main'picmeup | ||
| 348 | { | ||
| 349 | local($dst,$sym)=@_; | ||
| 350 | &main'lea($dst,&main'DWP($sym)); | ||
| 351 | } | ||
| 352 | |||
| 353 | sub main'blindpop { &out1("pop",@_); } | ||
diff --git a/src/lib/libcrypto/perlasm/x86unix.pl b/src/lib/libcrypto/perlasm/x86unix.pl index 9ceabf0705..72bde061c5 100644 --- a/src/lib/libcrypto/perlasm/x86unix.pl +++ b/src/lib/libcrypto/perlasm/x86unix.pl | |||
| @@ -87,12 +87,12 @@ sub main'DWP | |||
| 87 | $ret.=$addr if ($addr ne "") && ($addr ne 0); | 87 | $ret.=$addr if ($addr ne "") && ($addr ne 0); |
| 88 | if ($reg2 ne "") | 88 | if ($reg2 ne "") |
| 89 | { | 89 | { |
| 90 | if($idx ne "") | 90 | if($idx ne "" && $idx != 0) |
| 91 | { $ret.="($reg1,$reg2,$idx)"; } | 91 | { $ret.="($reg1,$reg2,$idx)"; } |
| 92 | else | 92 | else |
| 93 | { $ret.="($reg1,$reg2)"; } | 93 | { $ret.="($reg1,$reg2)"; } |
| 94 | } | 94 | } |
| 95 | else | 95 | elsif ($reg1 ne "") |
| 96 | { $ret.="($reg1)" } | 96 | { $ret.="($reg1)" } |
| 97 | return($ret); | 97 | return($ret); |
| 98 | } | 98 | } |
| @@ -167,7 +167,7 @@ sub main'pop { &out1("popl",@_); $stack-=4; } | |||
| 167 | sub main'pushf { &out0("pushf"); $stack+=4; } | 167 | sub main'pushf { &out0("pushf"); $stack+=4; } |
| 168 | sub main'popf { &out0("popf"); $stack-=4; } | 168 | sub main'popf { &out0("popf"); $stack-=4; } |
| 169 | sub main'not { &out1("notl",@_); } | 169 | sub main'not { &out1("notl",@_); } |
| 170 | sub main'call { &out1("call",$under.$_[0]); } | 170 | sub main'call { &out1("call",($_[0]=~/^\.L/?'':$under).$_[0]); } |
| 171 | sub main'ret { &out0("ret"); } | 171 | sub main'ret { &out0("ret"); } |
| 172 | sub main'nop { &out0("nop"); } | 172 | sub main'nop { &out0("nop"); } |
| 173 | 173 | ||
| @@ -345,15 +345,15 @@ sub main'function_end | |||
| 345 | popl %ebx | 345 | popl %ebx |
| 346 | popl %ebp | 346 | popl %ebp |
| 347 | ret | 347 | ret |
| 348 | .${func}_end: | 348 | .L_${func}_end: |
| 349 | EOF | 349 | EOF |
| 350 | push(@out,$tmp); | 350 | push(@out,$tmp); |
| 351 | 351 | ||
| 352 | if ($main'cpp) | 352 | if ($main'cpp) |
| 353 | { push(@out,"\tSIZE($func,.${func}_end-$func)\n"); } | 353 | { push(@out,"\tSIZE($func,.L_${func}_end-$func)\n"); } |
| 354 | elsif ($main'gaswin) | 354 | elsif ($main'gaswin) |
| 355 | { $tmp=push(@out,"\t.align 4\n"); } | 355 | { $tmp=push(@out,"\t.align 4\n"); } |
| 356 | else { push(@out,"\t.size\t$func,.${func}_end-$func\n"); } | 356 | else { push(@out,"\t.size\t$func,.L_${func}_end-$func\n"); } |
| 357 | push(@out,".ident \"$func\"\n"); | 357 | push(@out,".ident \"$func\"\n"); |
| 358 | $stack=0; | 358 | $stack=0; |
| 359 | %label=(); | 359 | %label=(); |
| @@ -426,6 +426,11 @@ sub main'swtmp | |||
| 426 | 426 | ||
| 427 | sub main'comment | 427 | sub main'comment |
| 428 | { | 428 | { |
| 429 | if ($main'elf) # GNU and SVR4 as'es use different comment delimiters, | ||
| 430 | { # so we just skip comments... | ||
| 431 | push(@out,"\n"); | ||
| 432 | return; | ||
| 433 | } | ||
| 429 | foreach (@_) | 434 | foreach (@_) |
| 430 | { | 435 | { |
| 431 | if (/^\s*$/) | 436 | if (/^\s*$/) |
| @@ -542,3 +547,39 @@ sub popvars | |||
| 542 | &main'pop("edx"); | 547 | &main'pop("edx"); |
| 543 | &main'popf(); | 548 | &main'popf(); |
| 544 | } | 549 | } |
| 550 | |||
| 551 | sub main'picmeup | ||
| 552 | { | ||
| 553 | local($dst,$sym)=@_; | ||
| 554 | if ($main'cpp) | ||
| 555 | { | ||
| 556 | local($tmp)=<<___; | ||
| 557 | #if (defined(ELF) || defined(SOL)) && defined(PIC) | ||
| 558 | .align 8 | ||
| 559 | call 1f | ||
| 560 | 1: popl $regs{$dst} | ||
| 561 | addl \$_GLOBAL_OFFSET_TABLE_+[.-1b],$regs{$dst} | ||
| 562 | movl $sym\@GOT($regs{$dst}),$regs{$dst} | ||
| 563 | #else | ||
| 564 | leal $sym,$regs{$dst} | ||
| 565 | #endif | ||
| 566 | ___ | ||
| 567 | push(@out,$tmp); | ||
| 568 | } | ||
| 569 | elsif ($main'pic && ($main'elf || $main'aout)) | ||
| 570 | { | ||
| 571 | push(@out,"\t.align\t8\n"); | ||
| 572 | &main'call(&main'label("PIC_me_up")); | ||
| 573 | &main'set_label("PIC_me_up"); | ||
| 574 | &main'blindpop($dst); | ||
| 575 | &main'add($dst,"\$$under"."_GLOBAL_OFFSET_TABLE_+[.-". | ||
| 576 | &main'label("PIC_me_up") . "]"); | ||
| 577 | &main'mov($dst,&main'DWP($sym."\@GOT",$dst)); | ||
| 578 | } | ||
| 579 | else | ||
| 580 | { | ||
| 581 | &main'lea($dst,&main'DWP($sym)); | ||
| 582 | } | ||
| 583 | } | ||
| 584 | |||
| 585 | sub main'blindpop { &out1("popl",@_); } | ||
