diff options
Diffstat (limited to 'src/lib/libcrypto/bn')
| -rw-r--r-- | src/lib/libcrypto/bn/asm/modexp512-x86_64.pl | 109 | ||||
| -rwxr-xr-x | src/lib/libcrypto/bn/asm/x86_64-mont.pl | 177 |
2 files changed, 0 insertions, 286 deletions
diff --git a/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl b/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl index bfd6e97541..4317282835 100644 --- a/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl +++ b/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl | |||
| @@ -61,8 +61,6 @@ $flavour = shift; | |||
| 61 | $output = shift; | 61 | $output = shift; |
| 62 | if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } | 62 | if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } |
| 63 | 63 | ||
| 64 | my $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); | ||
| 65 | |||
| 66 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; | 64 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 67 | ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or | 65 | ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or |
| 68 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or | 66 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or |
| @@ -1374,113 +1372,6 @@ end_main_loop_a3b: | |||
| 1374 | .size mod_exp_512, . - mod_exp_512 | 1372 | .size mod_exp_512, . - mod_exp_512 |
| 1375 | ___ | 1373 | ___ |
| 1376 | 1374 | ||
| 1377 | if ($win64) { | ||
| 1378 | # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, | ||
| 1379 | # CONTEXT *context,DISPATCHER_CONTEXT *disp) | ||
| 1380 | my $rec="%rcx"; | ||
| 1381 | my $frame="%rdx"; | ||
| 1382 | my $context="%r8"; | ||
| 1383 | my $disp="%r9"; | ||
| 1384 | |||
| 1385 | $code.=<<___; | ||
| 1386 | .extern __imp_RtlVirtualUnwind | ||
| 1387 | .type mod_exp_512_se_handler,\@abi-omnipotent | ||
| 1388 | .align 16 | ||
| 1389 | mod_exp_512_se_handler: | ||
| 1390 | push %rsi | ||
| 1391 | push %rdi | ||
| 1392 | push %rbx | ||
| 1393 | push %rbp | ||
| 1394 | push %r12 | ||
| 1395 | push %r13 | ||
| 1396 | push %r14 | ||
| 1397 | push %r15 | ||
| 1398 | pushfq | ||
| 1399 | sub \$64,%rsp | ||
| 1400 | |||
| 1401 | mov 120($context),%rax # pull context->Rax | ||
| 1402 | mov 248($context),%rbx # pull context->Rip | ||
| 1403 | |||
| 1404 | lea .Lbody(%rip),%r10 | ||
| 1405 | cmp %r10,%rbx # context->Rip<prologue label | ||
| 1406 | jb .Lin_prologue | ||
| 1407 | |||
| 1408 | mov 152($context),%rax # pull context->Rsp | ||
| 1409 | |||
| 1410 | lea .Lepilogue(%rip),%r10 | ||
| 1411 | cmp %r10,%rbx # context->Rip>=epilogue label | ||
| 1412 | jae .Lin_prologue | ||
| 1413 | |||
| 1414 | mov $rsp_offset(%rax),%rax # pull saved Rsp | ||
| 1415 | |||
| 1416 | mov 32(%rax),%rbx | ||
| 1417 | mov 40(%rax),%rbp | ||
| 1418 | mov 24(%rax),%r12 | ||
| 1419 | mov 16(%rax),%r13 | ||
| 1420 | mov 8(%rax),%r14 | ||
| 1421 | mov 0(%rax),%r15 | ||
| 1422 | lea 48(%rax),%rax | ||
| 1423 | mov %rbx,144($context) # restore context->Rbx | ||
| 1424 | mov %rbp,160($context) # restore context->Rbp | ||
| 1425 | mov %r12,216($context) # restore context->R12 | ||
| 1426 | mov %r13,224($context) # restore context->R13 | ||
| 1427 | mov %r14,232($context) # restore context->R14 | ||
| 1428 | mov %r15,240($context) # restore context->R15 | ||
| 1429 | |||
| 1430 | .Lin_prologue: | ||
| 1431 | mov 8(%rax),%rdi | ||
| 1432 | mov 16(%rax),%rsi | ||
| 1433 | mov %rax,152($context) # restore context->Rsp | ||
| 1434 | mov %rsi,168($context) # restore context->Rsi | ||
| 1435 | mov %rdi,176($context) # restore context->Rdi | ||
| 1436 | |||
| 1437 | mov 40($disp),%rdi # disp->ContextRecord | ||
| 1438 | mov $context,%rsi # context | ||
| 1439 | mov \$154,%ecx # sizeof(CONTEXT) | ||
| 1440 | .long 0xa548f3fc # cld; rep movsq | ||
| 1441 | |||
| 1442 | mov $disp,%rsi | ||
| 1443 | xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER | ||
| 1444 | mov 8(%rsi),%rdx # arg2, disp->ImageBase | ||
| 1445 | mov 0(%rsi),%r8 # arg3, disp->ControlPc | ||
| 1446 | mov 16(%rsi),%r9 # arg4, disp->FunctionEntry | ||
| 1447 | mov 40(%rsi),%r10 # disp->ContextRecord | ||
| 1448 | lea 56(%rsi),%r11 # &disp->HandlerData | ||
| 1449 | lea 24(%rsi),%r12 # &disp->EstablisherFrame | ||
| 1450 | mov %r10,32(%rsp) # arg5 | ||
| 1451 | mov %r11,40(%rsp) # arg6 | ||
| 1452 | mov %r12,48(%rsp) # arg7 | ||
| 1453 | mov %rcx,56(%rsp) # arg8, (NULL) | ||
| 1454 | call *__imp_RtlVirtualUnwind(%rip) | ||
| 1455 | |||
| 1456 | mov \$1,%eax # ExceptionContinueSearch | ||
| 1457 | add \$64,%rsp | ||
| 1458 | popfq | ||
| 1459 | pop %r15 | ||
| 1460 | pop %r14 | ||
| 1461 | pop %r13 | ||
| 1462 | pop %r12 | ||
| 1463 | pop %rbp | ||
| 1464 | pop %rbx | ||
| 1465 | pop %rdi | ||
| 1466 | pop %rsi | ||
| 1467 | ret | ||
| 1468 | .size mod_exp_512_se_handler,.-mod_exp_512_se_handler | ||
| 1469 | |||
| 1470 | .section .pdata | ||
| 1471 | .align 4 | ||
| 1472 | .rva .LSEH_begin_mod_exp_512 | ||
| 1473 | .rva .LSEH_end_mod_exp_512 | ||
| 1474 | .rva .LSEH_info_mod_exp_512 | ||
| 1475 | |||
| 1476 | .section .xdata | ||
| 1477 | .align 8 | ||
| 1478 | .LSEH_info_mod_exp_512: | ||
| 1479 | .byte 9,0,0,0 | ||
| 1480 | .rva mod_exp_512_se_handler | ||
| 1481 | ___ | ||
| 1482 | } | ||
| 1483 | |||
| 1484 | sub reg_part { | 1375 | sub reg_part { |
| 1485 | my ($reg,$conv)=@_; | 1376 | my ($reg,$conv)=@_; |
| 1486 | if ($reg =~ /%r[0-9]+/) { $reg .= $conv; } | 1377 | if ($reg =~ /%r[0-9]+/) { $reg .= $conv; } |
diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont.pl b/src/lib/libcrypto/bn/asm/x86_64-mont.pl index 17fb94c84c..90c717f115 100755 --- a/src/lib/libcrypto/bn/asm/x86_64-mont.pl +++ b/src/lib/libcrypto/bn/asm/x86_64-mont.pl | |||
| @@ -33,8 +33,6 @@ $flavour = shift; | |||
| 33 | $output = shift; | 33 | $output = shift; |
| 34 | if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } | 34 | if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } |
| 35 | 35 | ||
| 36 | $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); | ||
| 37 | |||
| 38 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; | 36 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 39 | ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or | 37 | ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or |
| 40 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or | 38 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or |
| @@ -1502,180 +1500,5 @@ $code.=<<___; | |||
| 1502 | .align 16 | 1500 | .align 16 |
| 1503 | ___ | 1501 | ___ |
| 1504 | 1502 | ||
| 1505 | # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, | ||
| 1506 | # CONTEXT *context,DISPATCHER_CONTEXT *disp) | ||
| 1507 | if ($win64) { | ||
| 1508 | $rec="%rcx"; | ||
| 1509 | $frame="%rdx"; | ||
| 1510 | $context="%r8"; | ||
| 1511 | $disp="%r9"; | ||
| 1512 | |||
| 1513 | $code.=<<___; | ||
| 1514 | .extern __imp_RtlVirtualUnwind | ||
| 1515 | .type mul_handler,\@abi-omnipotent | ||
| 1516 | .align 16 | ||
| 1517 | mul_handler: | ||
| 1518 | push %rsi | ||
| 1519 | push %rdi | ||
| 1520 | push %rbx | ||
| 1521 | push %rbp | ||
| 1522 | push %r12 | ||
| 1523 | push %r13 | ||
| 1524 | push %r14 | ||
| 1525 | push %r15 | ||
| 1526 | pushfq | ||
| 1527 | sub \$64,%rsp | ||
| 1528 | |||
| 1529 | mov 120($context),%rax # pull context->Rax | ||
| 1530 | mov 248($context),%rbx # pull context->Rip | ||
| 1531 | |||
| 1532 | mov 8($disp),%rsi # disp->ImageBase | ||
| 1533 | mov 56($disp),%r11 # disp->HandlerData | ||
| 1534 | |||
| 1535 | mov 0(%r11),%r10d # HandlerData[0] | ||
| 1536 | lea (%rsi,%r10),%r10 # end of prologue label | ||
| 1537 | cmp %r10,%rbx # context->Rip<end of prologue label | ||
| 1538 | jb .Lcommon_seh_tail | ||
| 1539 | |||
| 1540 | mov 152($context),%rax # pull context->Rsp | ||
| 1541 | |||
| 1542 | mov 4(%r11),%r10d # HandlerData[1] | ||
| 1543 | lea (%rsi,%r10),%r10 # epilogue label | ||
| 1544 | cmp %r10,%rbx # context->Rip>=epilogue label | ||
| 1545 | jae .Lcommon_seh_tail | ||
| 1546 | |||
| 1547 | mov 192($context),%r10 # pull $num | ||
| 1548 | mov 8(%rax,%r10,8),%rax # pull saved stack pointer | ||
| 1549 | lea 48(%rax),%rax | ||
| 1550 | |||
| 1551 | mov -8(%rax),%rbx | ||
| 1552 | mov -16(%rax),%rbp | ||
| 1553 | mov -24(%rax),%r12 | ||
| 1554 | mov -32(%rax),%r13 | ||
| 1555 | mov -40(%rax),%r14 | ||
| 1556 | mov -48(%rax),%r15 | ||
| 1557 | mov %rbx,144($context) # restore context->Rbx | ||
| 1558 | mov %rbp,160($context) # restore context->Rbp | ||
| 1559 | mov %r12,216($context) # restore context->R12 | ||
| 1560 | mov %r13,224($context) # restore context->R13 | ||
| 1561 | mov %r14,232($context) # restore context->R14 | ||
| 1562 | mov %r15,240($context) # restore context->R15 | ||
| 1563 | |||
| 1564 | jmp .Lcommon_seh_tail | ||
| 1565 | .size mul_handler,.-mul_handler | ||
| 1566 | |||
| 1567 | .type sqr_handler,\@abi-omnipotent | ||
| 1568 | .align 16 | ||
| 1569 | sqr_handler: | ||
| 1570 | push %rsi | ||
| 1571 | push %rdi | ||
| 1572 | push %rbx | ||
| 1573 | push %rbp | ||
| 1574 | push %r12 | ||
| 1575 | push %r13 | ||
| 1576 | push %r14 | ||
| 1577 | push %r15 | ||
| 1578 | pushfq | ||
| 1579 | sub \$64,%rsp | ||
| 1580 | |||
| 1581 | mov 120($context),%rax # pull context->Rax | ||
| 1582 | mov 248($context),%rbx # pull context->Rip | ||
| 1583 | |||
| 1584 | lea .Lsqr4x_body(%rip),%r10 | ||
| 1585 | cmp %r10,%rbx # context->Rip<.Lsqr_body | ||
| 1586 | jb .Lcommon_seh_tail | ||
| 1587 | |||
| 1588 | mov 152($context),%rax # pull context->Rsp | ||
| 1589 | |||
| 1590 | lea .Lsqr4x_epilogue(%rip),%r10 | ||
| 1591 | cmp %r10,%rbx # context->Rip>=.Lsqr_epilogue | ||
| 1592 | jae .Lcommon_seh_tail | ||
| 1593 | |||
| 1594 | mov 56(%rax),%rax # pull saved stack pointer | ||
| 1595 | lea 48(%rax),%rax | ||
| 1596 | |||
| 1597 | mov -8(%rax),%rbx | ||
| 1598 | mov -16(%rax),%rbp | ||
| 1599 | mov -24(%rax),%r12 | ||
| 1600 | mov -32(%rax),%r13 | ||
| 1601 | mov -40(%rax),%r14 | ||
| 1602 | mov -48(%rax),%r15 | ||
| 1603 | mov %rbx,144($context) # restore context->Rbx | ||
| 1604 | mov %rbp,160($context) # restore context->Rbp | ||
| 1605 | mov %r12,216($context) # restore context->R12 | ||
| 1606 | mov %r13,224($context) # restore context->R13 | ||
| 1607 | mov %r14,232($context) # restore context->R14 | ||
| 1608 | mov %r15,240($context) # restore context->R15 | ||
| 1609 | |||
| 1610 | .Lcommon_seh_tail: | ||
| 1611 | mov 8(%rax),%rdi | ||
| 1612 | mov 16(%rax),%rsi | ||
| 1613 | mov %rax,152($context) # restore context->Rsp | ||
| 1614 | mov %rsi,168($context) # restore context->Rsi | ||
| 1615 | mov %rdi,176($context) # restore context->Rdi | ||
| 1616 | |||
| 1617 | mov 40($disp),%rdi # disp->ContextRecord | ||
| 1618 | mov $context,%rsi # context | ||
| 1619 | mov \$154,%ecx # sizeof(CONTEXT) | ||
| 1620 | .long 0xa548f3fc # cld; rep movsq | ||
| 1621 | |||
| 1622 | mov $disp,%rsi | ||
| 1623 | xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER | ||
| 1624 | mov 8(%rsi),%rdx # arg2, disp->ImageBase | ||
| 1625 | mov 0(%rsi),%r8 # arg3, disp->ControlPc | ||
| 1626 | mov 16(%rsi),%r9 # arg4, disp->FunctionEntry | ||
| 1627 | mov 40(%rsi),%r10 # disp->ContextRecord | ||
| 1628 | lea 56(%rsi),%r11 # &disp->HandlerData | ||
| 1629 | lea 24(%rsi),%r12 # &disp->EstablisherFrame | ||
| 1630 | mov %r10,32(%rsp) # arg5 | ||
| 1631 | mov %r11,40(%rsp) # arg6 | ||
| 1632 | mov %r12,48(%rsp) # arg7 | ||
| 1633 | mov %rcx,56(%rsp) # arg8, (NULL) | ||
| 1634 | call *__imp_RtlVirtualUnwind(%rip) | ||
| 1635 | |||
| 1636 | mov \$1,%eax # ExceptionContinueSearch | ||
| 1637 | add \$64,%rsp | ||
| 1638 | popfq | ||
| 1639 | pop %r15 | ||
| 1640 | pop %r14 | ||
| 1641 | pop %r13 | ||
| 1642 | pop %r12 | ||
| 1643 | pop %rbp | ||
| 1644 | pop %rbx | ||
| 1645 | pop %rdi | ||
| 1646 | pop %rsi | ||
| 1647 | ret | ||
| 1648 | .size sqr_handler,.-sqr_handler | ||
| 1649 | |||
| 1650 | .section .pdata | ||
| 1651 | .align 4 | ||
| 1652 | .rva .LSEH_begin_bn_mul_mont | ||
| 1653 | .rva .LSEH_end_bn_mul_mont | ||
| 1654 | .rva .LSEH_info_bn_mul_mont | ||
| 1655 | |||
| 1656 | .rva .LSEH_begin_bn_mul4x_mont | ||
| 1657 | .rva .LSEH_end_bn_mul4x_mont | ||
| 1658 | .rva .LSEH_info_bn_mul4x_mont | ||
| 1659 | |||
| 1660 | .rva .LSEH_begin_bn_sqr4x_mont | ||
| 1661 | .rva .LSEH_end_bn_sqr4x_mont | ||
| 1662 | .rva .LSEH_info_bn_sqr4x_mont | ||
| 1663 | |||
| 1664 | .section .xdata | ||
| 1665 | .align 8 | ||
| 1666 | .LSEH_info_bn_mul_mont: | ||
| 1667 | .byte 9,0,0,0 | ||
| 1668 | .rva mul_handler | ||
| 1669 | .rva .Lmul_body,.Lmul_epilogue # HandlerData[] | ||
| 1670 | .LSEH_info_bn_mul4x_mont: | ||
| 1671 | .byte 9,0,0,0 | ||
| 1672 | .rva mul_handler | ||
| 1673 | .rva .Lmul4x_body,.Lmul4x_epilogue # HandlerData[] | ||
| 1674 | .LSEH_info_bn_sqr4x_mont: | ||
| 1675 | .byte 9,0,0,0 | ||
| 1676 | .rva sqr_handler | ||
| 1677 | ___ | ||
| 1678 | } | ||
| 1679 | |||
| 1680 | print $code; | 1503 | print $code; |
| 1681 | close STDOUT; | 1504 | close STDOUT; |
