]> git.ipfire.org Git - thirdparty/openssl.git/blame - ms/uplink-x86_64.pl
x86_64 assembly pack: tolerate spaces in source directory name.
[thirdparty/openssl.git] / ms / uplink-x86_64.pl
CommitLineData
e0a65194
RS
1#! /usr/bin/env perl
2# Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
3#
4# Licensed under the OpenSSL license (the "License"). You may not use
5# this file except in compliance with the License. You can obtain a copy
6# in the file LICENSE in the source distribution or at
7# https://www.openssl.org/source/license.html
4c048211 8
acf15259 9$output=pop;
4c048211 10$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
cfe1d992 11open OUT,"| \"$^X\" \"${dir}../crypto/perlasm/x86_64-xlate.pl\" \"$output\"";
46bf83f0 12*STDOUT=*OUT;
4c048211
AP
13push(@INC,"${dir}.");
14
15require "uplink-common.pl";
16
17$prefix="_lazy";
18
19print <<___;
20.text
21.extern OPENSSL_Uplink
be01f79d 22.globl OPENSSL_UplinkTable
4c048211
AP
23___
24for ($i=1;$i<=$N;$i++) {
25print <<___;
26.type $prefix${i},\@abi-omnipotent
27.align 16
28$prefix${i}:
29 .byte 0x48,0x83,0xEC,0x28 # sub rsp,40
30 mov %rcx,48(%rsp)
31 mov %rdx,56(%rsp)
32 mov %r8,64(%rsp)
33 mov %r9,72(%rsp)
34 lea OPENSSL_UplinkTable(%rip),%rcx
35 mov \$$i,%rdx
36 call OPENSSL_Uplink
37 mov 48(%rsp),%rcx
38 mov 56(%rsp),%rdx
39 mov 64(%rsp),%r8
40 mov 72(%rsp),%r9
4c048211 41 lea OPENSSL_UplinkTable(%rip),%rax
be01f79d 42 add \$40,%rsp
4c048211
AP
43 jmp *8*$i(%rax)
44$prefix${i}_end:
45.size $prefix${i},.-$prefix${i}
46___
47}
48print <<___;
49.data
4c048211
AP
50OPENSSL_UplinkTable:
51 .quad $N
52___
53for ($i=1;$i<=$N;$i++) { print " .quad $prefix$i\n"; }
54print <<___;
be01f79d
AP
55.section .pdata,"r"
56.align 4
4c048211
AP
57___
58for ($i=1;$i<=$N;$i++) {
59print <<___;
be01f79d 60 .rva $prefix${i},$prefix${i}_end,${prefix}_unwind_info
4c048211
AP
61___
62}
63print <<___;
be01f79d
AP
64.section .xdata,"r"
65.align 8
4c048211
AP
66${prefix}_unwind_info:
67 .byte 0x01,0x04,0x01,0x00
68 .byte 0x04,0x42,0x00,0x00
69___
be01f79d
AP
70
71close STDOUT;