1e1051a39Sopenharmony_ci#! /usr/bin/env perl 2e1051a39Sopenharmony_ci# Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved. 3e1051a39Sopenharmony_ci# 4e1051a39Sopenharmony_ci# Licensed under the Apache License 2.0 (the "License"). You may not use 5e1051a39Sopenharmony_ci# this file except in compliance with the License. You can obtain a copy 6e1051a39Sopenharmony_ci# in the file LICENSE in the source distribution or at 7e1051a39Sopenharmony_ci# https://www.openssl.org/source/license.html 8e1051a39Sopenharmony_ci 9e1051a39Sopenharmony_ci# $output is the last argument if it looks like a file (it has an extension) 10e1051a39Sopenharmony_ci$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef; 11e1051a39Sopenharmony_ci 12e1051a39Sopenharmony_ci$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; 13e1051a39Sopenharmony_ciopen OUT,"| \"$^X\" \"${dir}../crypto/perlasm/x86_64-xlate.pl\" \"$output\"" 14e1051a39Sopenharmony_ci or die "can't call ${dir}../crypto/perlasm/x86_64-xlate.pl: $!"; 15e1051a39Sopenharmony_ci*STDOUT=*OUT; 16e1051a39Sopenharmony_cipush(@INC,"${dir}."); 17e1051a39Sopenharmony_ci 18e1051a39Sopenharmony_cirequire "uplink-common.pl"; 19e1051a39Sopenharmony_ci 20e1051a39Sopenharmony_ci$prefix="_lazy"; 21e1051a39Sopenharmony_ci 22e1051a39Sopenharmony_ciprint <<___; 23e1051a39Sopenharmony_ci.text 24e1051a39Sopenharmony_ci.extern OPENSSL_Uplink 25e1051a39Sopenharmony_ci.globl OPENSSL_UplinkTable 26e1051a39Sopenharmony_ci___ 27e1051a39Sopenharmony_cifor ($i=1;$i<=$N;$i++) { 28e1051a39Sopenharmony_ciprint <<___; 29e1051a39Sopenharmony_ci.type $prefix${i},\@abi-omnipotent 30e1051a39Sopenharmony_ci.align 16 31e1051a39Sopenharmony_ci$prefix${i}: 32e1051a39Sopenharmony_ci .byte 0x48,0x83,0xEC,0x28 # sub rsp,40 33e1051a39Sopenharmony_ci mov %rcx,48(%rsp) 34e1051a39Sopenharmony_ci mov %rdx,56(%rsp) 35e1051a39Sopenharmony_ci mov %r8,64(%rsp) 36e1051a39Sopenharmony_ci mov %r9,72(%rsp) 37e1051a39Sopenharmony_ci lea OPENSSL_UplinkTable(%rip),%rcx 38e1051a39Sopenharmony_ci mov \$$i,%rdx 39e1051a39Sopenharmony_ci call OPENSSL_Uplink 40e1051a39Sopenharmony_ci mov 48(%rsp),%rcx 41e1051a39Sopenharmony_ci mov 56(%rsp),%rdx 42e1051a39Sopenharmony_ci mov 64(%rsp),%r8 43e1051a39Sopenharmony_ci mov 72(%rsp),%r9 44e1051a39Sopenharmony_ci lea OPENSSL_UplinkTable(%rip),%rax 45e1051a39Sopenharmony_ci add \$40,%rsp 46e1051a39Sopenharmony_ci jmp *8*$i(%rax) 47e1051a39Sopenharmony_ci$prefix${i}_end: 48e1051a39Sopenharmony_ci.size $prefix${i},.-$prefix${i} 49e1051a39Sopenharmony_ci___ 50e1051a39Sopenharmony_ci} 51e1051a39Sopenharmony_ciprint <<___; 52e1051a39Sopenharmony_ci.data 53e1051a39Sopenharmony_ciOPENSSL_UplinkTable: 54e1051a39Sopenharmony_ci .quad $N 55e1051a39Sopenharmony_ci___ 56e1051a39Sopenharmony_cifor ($i=1;$i<=$N;$i++) { print " .quad $prefix$i\n"; } 57e1051a39Sopenharmony_ciprint <<___; 58e1051a39Sopenharmony_ci.section .pdata,"r" 59e1051a39Sopenharmony_ci.align 4 60e1051a39Sopenharmony_ci___ 61e1051a39Sopenharmony_cifor ($i=1;$i<=$N;$i++) { 62e1051a39Sopenharmony_ciprint <<___; 63e1051a39Sopenharmony_ci .rva $prefix${i},$prefix${i}_end,${prefix}_unwind_info 64e1051a39Sopenharmony_ci___ 65e1051a39Sopenharmony_ci} 66e1051a39Sopenharmony_ciprint <<___; 67e1051a39Sopenharmony_ci.section .xdata,"r" 68e1051a39Sopenharmony_ci.align 8 69e1051a39Sopenharmony_ci${prefix}_unwind_info: 70e1051a39Sopenharmony_ci .byte 0x01,0x04,0x01,0x00 71e1051a39Sopenharmony_ci .byte 0x04,0x42,0x00,0x00 72e1051a39Sopenharmony_ci___ 73e1051a39Sopenharmony_ci 74e1051a39Sopenharmony_ciclose STDOUT; 75