lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 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 | open STDOUT,">$output"; |
| 11 | |
| 12 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 13 | push(@INC,"${dir}."); |
| 14 | |
| 15 | require "uplink-common.pl"; |
| 16 | |
| 17 | local $V=8; # max number of args uplink functions may accept... |
| 18 | my $loc0 = "r".(32+$V); |
| 19 | print <<___; |
| 20 | .text |
| 21 | .global OPENSSL_Uplink# |
| 22 | .type OPENSSL_Uplink#,\@function |
| 23 | |
| 24 | ___ |
| 25 | for ($i=1;$i<=$N;$i++) { |
| 26 | print <<___; |
| 27 | .proc lazy$i# |
| 28 | lazy$i: |
| 29 | .prologue |
| 30 | { .mii; .save ar.pfs,$loc0 |
| 31 | alloc loc0=ar.pfs,$V,3,2,0 |
| 32 | .save b0,loc1 |
| 33 | mov loc1=b0 |
| 34 | addl loc2=\@ltoff(OPENSSL_UplinkTable#),gp };; |
| 35 | .body |
| 36 | { .mmi; ld8 out0=[loc2] |
| 37 | mov out1=$i };; |
| 38 | { .mib; add loc2=8*$i,out0 |
| 39 | br.call.sptk.many b0=OPENSSL_Uplink# };; |
| 40 | { .mmi; ld8 r31=[loc2];; |
| 41 | ld8 r30=[r31],8 };; |
| 42 | { .mii; ld8 gp=[r31] |
| 43 | mov b6=r30 |
| 44 | mov b0=loc1 };; |
| 45 | { .mib; mov ar.pfs=loc0 |
| 46 | br.many b6 };; |
| 47 | .endp lazy$i# |
| 48 | |
| 49 | ___ |
| 50 | } |
| 51 | print <<___; |
| 52 | .data |
| 53 | .global OPENSSL_UplinkTable# |
| 54 | OPENSSL_UplinkTable: data8 $N // amount of following entries |
| 55 | ___ |
| 56 | for ($i=1;$i<=$N;$i++) { print " data8 \@fptr(lazy$i#)\n"; } |
| 57 | print <<___; |
| 58 | .size OPENSSL_UplinkTable,.-OPENSSL_UplinkTable# |
| 59 | ___ |
| 60 | |
| 61 | close STDOUT; |