Path: blob/main/crypto/openssl/ms/uplink-x86_64.pl
34860 views
#! /usr/bin/env perl1# Copyright 2008-2024 The OpenSSL Project Authors. All Rights Reserved.2#3# Licensed under the Apache License 2.0 (the "License"). You may not use4# this file except in compliance with the License. You can obtain a copy5# in the file LICENSE in the source distribution or at6# https://www.openssl.org/source/license.html78# $output is the last argument if it looks like a file (it has an extension)9$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;10$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;1112$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;13open OUT,"| \"$^X\" \"${dir}../crypto/perlasm/x86_64-xlate.pl\" $flavour \"$output\""14or die "can't call ${dir}../crypto/perlasm/x86_64-xlate.pl: $!";15*STDOUT=*OUT;16push(@INC,"${dir}.");1718require "uplink-common.pl";1920$prefix="_lazy";2122print <<___;23.text24.extern OPENSSL_Uplink25.globl OPENSSL_UplinkTable26___27for ($i=1;$i<=$N;$i++) {28print <<___;29.type $prefix${i},\@abi-omnipotent30.align 1631$prefix${i}:32.byte 0x48,0x83,0xEC,0x28 # sub rsp,4033mov %rcx,48(%rsp)34mov %rdx,56(%rsp)35mov %r8,64(%rsp)36mov %r9,72(%rsp)37lea OPENSSL_UplinkTable(%rip),%rcx38mov \$$i,%rdx39call OPENSSL_Uplink40mov 48(%rsp),%rcx41mov 56(%rsp),%rdx42mov 64(%rsp),%r843mov 72(%rsp),%r944lea OPENSSL_UplinkTable(%rip),%rax45add \$40,%rsp46jmp *8*$i(%rax)47$prefix${i}_end:48.size $prefix${i},.-$prefix${i}49___50}51print <<___;52.data53OPENSSL_UplinkTable:54.quad $N55___56for ($i=1;$i<=$N;$i++) { print " .quad $prefix$i\n"; }57print <<___;58.section .pdata,"r"59.align 460___61for ($i=1;$i<=$N;$i++) {62print <<___;63.rva $prefix${i},$prefix${i}_end,${prefix}_unwind_info64___65}66print <<___;67.section .xdata,"r"68.align 869${prefix}_unwind_info:70.byte 0x01,0x04,0x01,0x0071.byte 0x04,0x42,0x00,0x0072___7374close STDOUT;757677