2016-04-20 10:10:43 +08:00
|
|
|
#! /usr/bin/env perl
|
|
|
|
# Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
|
|
|
|
#
|
|
|
|
# Licensed under the OpenSSL license (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
|
2008-07-22 16:47:35 +08:00
|
|
|
|
2016-03-19 06:31:17 +08:00
|
|
|
$output=pop;
|
2008-07-22 16:47:35 +08:00
|
|
|
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
|
2016-05-28 22:25:38 +08:00
|
|
|
open OUT,"| \"$^X\" \"${dir}../crypto/perlasm/x86_64-xlate.pl\" \"$output\"";
|
2013-01-23 05:11:31 +08:00
|
|
|
*STDOUT=*OUT;
|
2008-07-22 16:47:35 +08:00
|
|
|
push(@INC,"${dir}.");
|
|
|
|
|
|
|
|
require "uplink-common.pl";
|
|
|
|
|
|
|
|
$prefix="_lazy";
|
|
|
|
|
|
|
|
print <<___;
|
|
|
|
.text
|
|
|
|
.extern OPENSSL_Uplink
|
2008-12-19 19:17:29 +08:00
|
|
|
.globl OPENSSL_UplinkTable
|
2008-07-22 16:47:35 +08:00
|
|
|
___
|
|
|
|
for ($i=1;$i<=$N;$i++) {
|
|
|
|
print <<___;
|
|
|
|
.type $prefix${i},\@abi-omnipotent
|
|
|
|
.align 16
|
|
|
|
$prefix${i}:
|
|
|
|
.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
|
2008-12-19 19:17:29 +08:00
|
|
|
add \$40,%rsp
|
2008-07-22 16:47:35 +08:00
|
|
|
jmp *8*$i(%rax)
|
|
|
|
$prefix${i}_end:
|
|
|
|
.size $prefix${i},.-$prefix${i}
|
|
|
|
___
|
|
|
|
}
|
|
|
|
print <<___;
|
|
|
|
.data
|
|
|
|
OPENSSL_UplinkTable:
|
|
|
|
.quad $N
|
|
|
|
___
|
|
|
|
for ($i=1;$i<=$N;$i++) { print " .quad $prefix$i\n"; }
|
|
|
|
print <<___;
|
2008-12-19 19:17:29 +08:00
|
|
|
.section .pdata,"r"
|
|
|
|
.align 4
|
2008-07-22 16:47:35 +08:00
|
|
|
___
|
|
|
|
for ($i=1;$i<=$N;$i++) {
|
|
|
|
print <<___;
|
2008-12-19 19:17:29 +08:00
|
|
|
.rva $prefix${i},$prefix${i}_end,${prefix}_unwind_info
|
2008-07-22 16:47:35 +08:00
|
|
|
___
|
|
|
|
}
|
|
|
|
print <<___;
|
2008-12-19 19:17:29 +08:00
|
|
|
.section .xdata,"r"
|
|
|
|
.align 8
|
2008-07-22 16:47:35 +08:00
|
|
|
${prefix}_unwind_info:
|
|
|
|
.byte 0x01,0x04,0x01,0x00
|
|
|
|
.byte 0x04,0x42,0x00,0x00
|
|
|
|
___
|
2008-12-19 19:17:29 +08:00
|
|
|
|
|
|
|
close STDOUT;
|