summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/sha
diff options
context:
space:
mode:
authorjsing <>2014-04-30 13:40:02 +0000
committerjsing <>2014-04-30 13:40:02 +0000
commitb8e088b53dabff9eeb33721c6fa4e60831bf9797 (patch)
tree75932b21b0fece851ece3d9ad0c80de6a9ff65e2 /src/lib/libcrypto/sha
parent11a8133c7b915dcd4af9f7cf1c70b1179eeddf14 (diff)
downloadopenbsd-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/sha')
-rwxr-xr-xsrc/lib/libcrypto/sha/asm/sha512-x86_64.pl109
1 files changed, 0 insertions, 109 deletions
diff --git a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
index 8d51678557..feb0f9e776 100755
--- a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
+++ b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
@@ -44,8 +44,6 @@ $flavour = shift;
44$output = shift; 44$output = shift;
45if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } 45if ($flavour =~ /\./) { $output = $flavour; undef $flavour; }
46 46
47$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
48
49$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; 47$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
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
@@ -339,113 +337,6 @@ $TABLE:
339___ 337___
340} 338}
341 339
342# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
343# CONTEXT *context,DISPATCHER_CONTEXT *disp)
344if ($win64) {
345$rec="%rcx";
346$frame="%rdx";
347$context="%r8";
348$disp="%r9";
349
350$code.=<<___;
351.extern __imp_RtlVirtualUnwind
352.type se_handler,\@abi-omnipotent
353.align 16
354se_handler:
355 push %rsi
356 push %rdi
357 push %rbx
358 push %rbp
359 push %r12
360 push %r13
361 push %r14
362 push %r15
363 pushfq
364 sub \$64,%rsp
365
366 mov 120($context),%rax # pull context->Rax
367 mov 248($context),%rbx # pull context->Rip
368
369 lea .Lprologue(%rip),%r10
370 cmp %r10,%rbx # context->Rip<.Lprologue
371 jb .Lin_prologue
372
373 mov 152($context),%rax # pull context->Rsp
374
375 lea .Lepilogue(%rip),%r10
376 cmp %r10,%rbx # context->Rip>=.Lepilogue
377 jae .Lin_prologue
378
379 mov 16*$SZ+3*8(%rax),%rax # pull $_rsp
380 lea 48(%rax),%rax
381
382 mov -8(%rax),%rbx
383 mov -16(%rax),%rbp
384 mov -24(%rax),%r12
385 mov -32(%rax),%r13
386 mov -40(%rax),%r14
387 mov -48(%rax),%r15
388 mov %rbx,144($context) # restore context->Rbx
389 mov %rbp,160($context) # restore context->Rbp
390 mov %r12,216($context) # restore context->R12
391 mov %r13,224($context) # restore context->R13
392 mov %r14,232($context) # restore context->R14
393 mov %r15,240($context) # restore context->R15
394
395.Lin_prologue:
396 mov 8(%rax),%rdi
397 mov 16(%rax),%rsi
398 mov %rax,152($context) # restore context->Rsp
399 mov %rsi,168($context) # restore context->Rsi
400 mov %rdi,176($context) # restore context->Rdi
401
402 mov 40($disp),%rdi # disp->ContextRecord
403 mov $context,%rsi # context
404 mov \$154,%ecx # sizeof(CONTEXT)
405 .long 0xa548f3fc # cld; rep movsq
406
407 mov $disp,%rsi
408 xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER
409 mov 8(%rsi),%rdx # arg2, disp->ImageBase
410 mov 0(%rsi),%r8 # arg3, disp->ControlPc
411 mov 16(%rsi),%r9 # arg4, disp->FunctionEntry
412 mov 40(%rsi),%r10 # disp->ContextRecord
413 lea 56(%rsi),%r11 # &disp->HandlerData
414 lea 24(%rsi),%r12 # &disp->EstablisherFrame
415 mov %r10,32(%rsp) # arg5
416 mov %r11,40(%rsp) # arg6
417 mov %r12,48(%rsp) # arg7
418 mov %rcx,56(%rsp) # arg8, (NULL)
419 call *__imp_RtlVirtualUnwind(%rip)
420
421 mov \$1,%eax # ExceptionContinueSearch
422 add \$64,%rsp
423 popfq
424 pop %r15
425 pop %r14
426 pop %r13
427 pop %r12
428 pop %rbp
429 pop %rbx
430 pop %rdi
431 pop %rsi
432 ret
433.size se_handler,.-se_handler
434
435.section .pdata
436.align 4
437 .rva .LSEH_begin_$func
438 .rva .LSEH_end_$func
439 .rva .LSEH_info_$func
440
441.section .xdata
442.align 8
443.LSEH_info_$func:
444 .byte 9,0,0,0
445 .rva se_handler
446___
447}
448
449$code =~ s/\`([^\`]*)\`/eval $1/gem; 340$code =~ s/\`([^\`]*)\`/eval $1/gem;
450print $code; 341print $code;
451close STDOUT; 342close STDOUT;