]> git.ipfire.org Git - thirdparty/openssl.git/blob - ms/uplink-x86_64.pl
x86_64 assembly pack: tolerate spaces in source directory name.
[thirdparty/openssl.git] / ms / uplink-x86_64.pl
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
8
9 $output=pop;
10 $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
11 open OUT,"| \"$^X\" \"${dir}../crypto/perlasm/x86_64-xlate.pl\" \"$output\"";
12 *STDOUT=*OUT;
13 push(@INC,"${dir}.");
14
15 require "uplink-common.pl";
16
17 $prefix="_lazy";
18
19 print <<___;
20 .text
21 .extern OPENSSL_Uplink
22 .globl OPENSSL_UplinkTable
23 ___
24 for ($i=1;$i<=$N;$i++) {
25 print <<___;
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
41 lea OPENSSL_UplinkTable(%rip),%rax
42 add \$40,%rsp
43 jmp *8*$i(%rax)
44 $prefix${i}_end:
45 .size $prefix${i},.-$prefix${i}
46 ___
47 }
48 print <<___;
49 .data
50 OPENSSL_UplinkTable:
51 .quad $N
52 ___
53 for ($i=1;$i<=$N;$i++) { print " .quad $prefix$i\n"; }
54 print <<___;
55 .section .pdata,"r"
56 .align 4
57 ___
58 for ($i=1;$i<=$N;$i++) {
59 print <<___;
60 .rva $prefix${i},$prefix${i}_end,${prefix}_unwind_info
61 ___
62 }
63 print <<___;
64 .section .xdata,"r"
65 .align 8
66 ${prefix}_unwind_info:
67 .byte 0x01,0x04,0x01,0x00
68 .byte 0x04,0x42,0x00,0x00
69 ___
70
71 close STDOUT;