A local copy of OpenSSL from GitHub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.7 KiB

#! /usr/bin/env perl
# Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
# $output is the last argument if it looks like a file (it has an extension)
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
open OUT,"| \"$^X\" \"${dir}../crypto/perlasm/x86_64-xlate.pl\" \"$output\""
or die "can't call ${dir}../crypto/perlasm/x86_64-xlate.pl: $!";
require "uplink-common.pl";
print <<___;
.extern OPENSSL_Uplink
.globl OPENSSL_UplinkTable
for ($i=1;$i<=$N;$i++) {
print <<___;
.type $prefix${i},\@abi-omnipotent
.align 16
.byte 0x48,0x83,0xEC,0x28 # sub rsp,40
mov %rcx,48(%rsp)
mov %rdx,56(%rsp)
mov %r8,64(%rsp)
mov %r9,72(%rsp)
lea OPENSSL_UplinkTable(%rip),%rcx
mov \$$i,%rdx
call OPENSSL_Uplink
mov 48(%rsp),%rcx
mov 56(%rsp),%rdx
mov 64(%rsp),%r8
mov 72(%rsp),%r9
lea OPENSSL_UplinkTable(%rip),%rax
add \$40,%rsp
jmp *8*$i(%rax)
.size $prefix${i},.-$prefix${i}
print <<___;
.quad $N
for ($i=1;$i<=$N;$i++) { print " .quad $prefix$i\n"; }
print <<___;
.section .pdata,"r"
.align 4
for ($i=1;$i<=$N;$i++) {
print <<___;
.rva $prefix${i},$prefix${i}_end,${prefix}_unwind_info
print <<___;
.section .xdata,"r"
.align 8
.byte 0x01,0x04,0x01,0x00
.byte 0x04,0x42,0x00,0x00
close STDOUT;