diff options
author | jsing <> | 2014-04-30 13:40:02 +0000 |
---|---|---|
committer | jsing <> | 2014-04-30 13:40:02 +0000 |
commit | b8e088b53dabff9eeb33721c6fa4e60831bf9797 (patch) | |
tree | 75932b21b0fece851ece3d9ad0c80de6a9ff65e2 /src/lib/libcrypto/rc4/asm | |
parent | 11a8133c7b915dcd4af9f7cf1c70b1179eeddf14 (diff) | |
download | openbsd-b8e088b53dabff9eeb33721c6fa4e60831bf9797.tar.gz openbsd-b8e088b53dabff9eeb33721c6fa4e60831bf9797.tar.bz2 openbsd-b8e088b53dabff9eeb33721c6fa4e60831bf9797.zip |
First pass at removing win64 support from the assembly generating Perl
scripts. We certainly do not need an identical copy of the win64
exception handler in each script (surely one copy would be sufficient).
ok miod@
Diffstat (limited to 'src/lib/libcrypto/rc4/asm')
-rw-r--r-- | src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl | 107 | ||||
-rwxr-xr-x | src/lib/libcrypto/rc4/asm/rc4-x86_64.pl | 134 |
2 files changed, 0 insertions, 241 deletions
diff --git a/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl b/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl index 272fa91e1a..501d9e936b 100644 --- a/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl +++ b/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl | |||
@@ -44,8 +44,6 @@ my $flavour = shift; | |||
44 | my $output = shift; | 44 | my $output = shift; |
45 | if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } | 45 | if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } |
46 | 46 | ||
47 | my $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); | ||
48 | |||
49 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; my $dir=$1; my $xlate; | 47 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; my $dir=$1; my $xlate; |
50 | ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or | 48 | ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or |
51 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or | 49 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or |
@@ -505,111 +503,6 @@ RC4_options: | |||
505 | .size RC4_options,.-RC4_options | 503 | .size RC4_options,.-RC4_options |
506 | ___ | 504 | ___ |
507 | } | 505 | } |
508 | # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, | ||
509 | # CONTEXT *context,DISPATCHER_CONTEXT *disp) | ||
510 | if ($win64) { | ||
511 | my $rec="%rcx"; | ||
512 | my $frame="%rdx"; | ||
513 | my $context="%r8"; | ||
514 | my $disp="%r9"; | ||
515 | |||
516 | $code.=<<___; | ||
517 | .extern __imp_RtlVirtualUnwind | ||
518 | .type se_handler,\@abi-omnipotent | ||
519 | .align 16 | ||
520 | se_handler: | ||
521 | push %rsi | ||
522 | push %rdi | ||
523 | push %rbx | ||
524 | push %rbp | ||
525 | push %r12 | ||
526 | push %r13 | ||
527 | push %r14 | ||
528 | push %r15 | ||
529 | pushfq | ||
530 | sub \$64,%rsp | ||
531 | |||
532 | mov 120($context),%rax # pull context->Rax | ||
533 | mov 248($context),%rbx # pull context->Rip | ||
534 | |||
535 | lea .Lbody(%rip),%r10 | ||
536 | cmp %r10,%rbx # context->Rip<.Lbody | ||
537 | jb .Lin_prologue | ||
538 | |||
539 | mov 152($context),%rax # pull context->Rsp | ||
540 | |||
541 | lea .Lepilogue(%rip),%r10 | ||
542 | cmp %r10,%rbx # context->Rip>=.Lepilogue | ||
543 | jae .Lin_prologue | ||
544 | |||
545 | mov 40(%rax),%r15 | ||
546 | mov 48(%rax),%r14 | ||
547 | mov 56(%rax),%r13 | ||
548 | mov 64(%rax),%r12 | ||
549 | mov 72(%rax),%rbp | ||
550 | mov 80(%rax),%rbx | ||
551 | lea 88(%rax),%rax | ||
552 | |||
553 | mov %rbx,144($context) # restore context->Rbx | ||
554 | mov %rbp,160($context) # restore context->Rbp | ||
555 | mov %r12,216($context) # restore context->R12 | ||
556 | mov %r13,224($context) # restore context->R12 | ||
557 | mov %r14,232($context) # restore context->R14 | ||
558 | mov %r15,240($context) # restore context->R15 | ||
559 | |||
560 | .Lin_prologue: | ||
561 | mov 8(%rax),%rdi | ||
562 | mov 16(%rax),%rsi | ||
563 | mov %rax,152($context) # restore context->Rsp | ||
564 | mov %rsi,168($context) # restore context->Rsi | ||
565 | mov %rdi,176($context) # restore context->Rdi | ||
566 | |||
567 | mov 40($disp),%rdi # disp->ContextRecord | ||
568 | mov $context,%rsi # context | ||
569 | mov \$154,%ecx # sizeof(CONTEXT) | ||
570 | .long 0xa548f3fc # cld; rep movsq | ||
571 | |||
572 | mov $disp,%rsi | ||
573 | xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER | ||
574 | mov 8(%rsi),%rdx # arg2, disp->ImageBase | ||
575 | mov 0(%rsi),%r8 # arg3, disp->ControlPc | ||
576 | mov 16(%rsi),%r9 # arg4, disp->FunctionEntry | ||
577 | mov 40(%rsi),%r10 # disp->ContextRecord | ||
578 | lea 56(%rsi),%r11 # &disp->HandlerData | ||
579 | lea 24(%rsi),%r12 # &disp->EstablisherFrame | ||
580 | mov %r10,32(%rsp) # arg5 | ||
581 | mov %r11,40(%rsp) # arg6 | ||
582 | mov %r12,48(%rsp) # arg7 | ||
583 | mov %rcx,56(%rsp) # arg8, (NULL) | ||
584 | call *__imp_RtlVirtualUnwind(%rip) | ||
585 | |||
586 | mov \$1,%eax # ExceptionContinueSearch | ||
587 | add \$64,%rsp | ||
588 | popfq | ||
589 | pop %r15 | ||
590 | pop %r14 | ||
591 | pop %r13 | ||
592 | pop %r12 | ||
593 | pop %rbp | ||
594 | pop %rbx | ||
595 | pop %rdi | ||
596 | pop %rsi | ||
597 | ret | ||
598 | .size se_handler,.-se_handler | ||
599 | |||
600 | .section .pdata | ||
601 | .align 4 | ||
602 | .rva .LSEH_begin_$func | ||
603 | .rva .LSEH_end_$func | ||
604 | .rva .LSEH_info_$func | ||
605 | |||
606 | .section .xdata | ||
607 | .align 8 | ||
608 | .LSEH_info_$func: | ||
609 | .byte 9,0,0,0 | ||
610 | .rva se_handler | ||
611 | ___ | ||
612 | } | ||
613 | 506 | ||
614 | sub reg_part { | 507 | sub reg_part { |
615 | my ($reg,$conv)=@_; | 508 | my ($reg,$conv)=@_; |
diff --git a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl index 75750dbf33..2bed1e279f 100755 --- a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl +++ b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl | |||
@@ -105,8 +105,6 @@ $flavour = shift; | |||
105 | $output = shift; | 105 | $output = shift; |
106 | if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } | 106 | if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } |
107 | 107 | ||
108 | $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); | ||
109 | |||
110 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; | 108 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
111 | ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or | 109 | ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or |
112 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or | 110 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or |
@@ -528,138 +526,6 @@ RC4_options: | |||
528 | .size RC4_options,.-RC4_options | 526 | .size RC4_options,.-RC4_options |
529 | ___ | 527 | ___ |
530 | 528 | ||
531 | # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, | ||
532 | # CONTEXT *context,DISPATCHER_CONTEXT *disp) | ||
533 | if ($win64) { | ||
534 | $rec="%rcx"; | ||
535 | $frame="%rdx"; | ||
536 | $context="%r8"; | ||
537 | $disp="%r9"; | ||
538 | |||
539 | $code.=<<___; | ||
540 | .extern __imp_RtlVirtualUnwind | ||
541 | .type stream_se_handler,\@abi-omnipotent | ||
542 | .align 16 | ||
543 | stream_se_handler: | ||
544 | push %rsi | ||
545 | push %rdi | ||
546 | push %rbx | ||
547 | push %rbp | ||
548 | push %r12 | ||
549 | push %r13 | ||
550 | push %r14 | ||
551 | push %r15 | ||
552 | pushfq | ||
553 | sub \$64,%rsp | ||
554 | |||
555 | mov 120($context),%rax # pull context->Rax | ||
556 | mov 248($context),%rbx # pull context->Rip | ||
557 | |||
558 | lea .Lprologue(%rip),%r10 | ||
559 | cmp %r10,%rbx # context->Rip<prologue label | ||
560 | jb .Lin_prologue | ||
561 | |||
562 | mov 152($context),%rax # pull context->Rsp | ||
563 | |||
564 | lea .Lepilogue(%rip),%r10 | ||
565 | cmp %r10,%rbx # context->Rip>=epilogue label | ||
566 | jae .Lin_prologue | ||
567 | |||
568 | lea 24(%rax),%rax | ||
569 | |||
570 | mov -8(%rax),%rbx | ||
571 | mov -16(%rax),%r12 | ||
572 | mov -24(%rax),%r13 | ||
573 | mov %rbx,144($context) # restore context->Rbx | ||
574 | mov %r12,216($context) # restore context->R12 | ||
575 | mov %r13,224($context) # restore context->R13 | ||
576 | |||
577 | .Lin_prologue: | ||
578 | mov 8(%rax),%rdi | ||
579 | mov 16(%rax),%rsi | ||
580 | mov %rax,152($context) # restore context->Rsp | ||
581 | mov %rsi,168($context) # restore context->Rsi | ||
582 | mov %rdi,176($context) # restore context->Rdi | ||
583 | |||
584 | jmp .Lcommon_seh_exit | ||
585 | .size stream_se_handler,.-stream_se_handler | ||
586 | |||
587 | .type key_se_handler,\@abi-omnipotent | ||
588 | .align 16 | ||
589 | key_se_handler: | ||
590 | push %rsi | ||
591 | push %rdi | ||
592 | push %rbx | ||
593 | push %rbp | ||
594 | push %r12 | ||
595 | push %r13 | ||
596 | push %r14 | ||
597 | push %r15 | ||
598 | pushfq | ||
599 | sub \$64,%rsp | ||
600 | |||
601 | mov 152($context),%rax # pull context->Rsp | ||
602 | mov 8(%rax),%rdi | ||
603 | mov 16(%rax),%rsi | ||
604 | mov %rsi,168($context) # restore context->Rsi | ||
605 | mov %rdi,176($context) # restore context->Rdi | ||
606 | |||
607 | .Lcommon_seh_exit: | ||
608 | |||
609 | mov 40($disp),%rdi # disp->ContextRecord | ||
610 | mov $context,%rsi # context | ||
611 | mov \$154,%ecx # sizeof(CONTEXT) | ||
612 | .long 0xa548f3fc # cld; rep movsq | ||
613 | |||
614 | mov $disp,%rsi | ||
615 | xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER | ||
616 | mov 8(%rsi),%rdx # arg2, disp->ImageBase | ||
617 | mov 0(%rsi),%r8 # arg3, disp->ControlPc | ||
618 | mov 16(%rsi),%r9 # arg4, disp->FunctionEntry | ||
619 | mov 40(%rsi),%r10 # disp->ContextRecord | ||
620 | lea 56(%rsi),%r11 # &disp->HandlerData | ||
621 | lea 24(%rsi),%r12 # &disp->EstablisherFrame | ||
622 | mov %r10,32(%rsp) # arg5 | ||
623 | mov %r11,40(%rsp) # arg6 | ||
624 | mov %r12,48(%rsp) # arg7 | ||
625 | mov %rcx,56(%rsp) # arg8, (NULL) | ||
626 | call *__imp_RtlVirtualUnwind(%rip) | ||
627 | |||
628 | mov \$1,%eax # ExceptionContinueSearch | ||
629 | add \$64,%rsp | ||
630 | popfq | ||
631 | pop %r15 | ||
632 | pop %r14 | ||
633 | pop %r13 | ||
634 | pop %r12 | ||
635 | pop %rbp | ||
636 | pop %rbx | ||
637 | pop %rdi | ||
638 | pop %rsi | ||
639 | ret | ||
640 | .size key_se_handler,.-key_se_handler | ||
641 | |||
642 | .section .pdata | ||
643 | .align 4 | ||
644 | .rva .LSEH_begin_RC4 | ||
645 | .rva .LSEH_end_RC4 | ||
646 | .rva .LSEH_info_RC4 | ||
647 | |||
648 | .rva .LSEH_begin_private_RC4_set_key | ||
649 | .rva .LSEH_end_private_RC4_set_key | ||
650 | .rva .LSEH_info_private_RC4_set_key | ||
651 | |||
652 | .section .xdata | ||
653 | .align 8 | ||
654 | .LSEH_info_RC4: | ||
655 | .byte 9,0,0,0 | ||
656 | .rva stream_se_handler | ||
657 | .LSEH_info_private_RC4_set_key: | ||
658 | .byte 9,0,0,0 | ||
659 | .rva key_se_handler | ||
660 | ___ | ||
661 | } | ||
662 | |||
663 | sub reg_part { | 529 | sub reg_part { |
664 | my ($reg,$conv)=@_; | 530 | my ($reg,$conv)=@_; |
665 | if ($reg =~ /%r[0-9]+/) { $reg .= $conv; } | 531 | if ($reg =~ /%r[0-9]+/) { $reg .= $conv; } |