Rich Salz | e0a6519 | 2016-04-19 22:10:43 -0400 | [diff] [blame] | 1 | #! /usr/bin/env perl |
| 2 | # Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved. |
| 3 | # |
Richard Levitte | c7fcbc0 | 2018-12-06 13:10:33 +0100 | [diff] [blame] | 4 | # Licensed under the Apache License 2.0 (the "License"). You may not use |
Rich Salz | e0a6519 | 2016-04-19 22:10:43 -0400 | [diff] [blame] | 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 |
Andy Polyakov | 4c04821 | 2008-07-22 08:47:35 +0000 | [diff] [blame] | 8 | |
Richard Levitte | 1aa89a7 | 2019-09-13 00:06:46 +0200 | [diff] [blame] | 9 | $output = pop and open STDOUT,">$output"; |
Andy Polyakov | acf1525 | 2016-03-18 23:31:17 +0100 | [diff] [blame] | 10 | |
Andy Polyakov | 4c04821 | 2008-07-22 08:47:35 +0000 | [diff] [blame] | 11 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 12 | push(@INC,"${dir}."); |
| 13 | |
| 14 | require "uplink-common.pl"; |
| 15 | |
| 16 | local $V=8; # max number of args uplink functions may accept... |
| 17 | my $loc0 = "r".(32+$V); |
| 18 | print <<___; |
| 19 | .text |
| 20 | .global OPENSSL_Uplink# |
| 21 | .type OPENSSL_Uplink#,\@function |
| 22 | |
| 23 | ___ |
| 24 | for ($i=1;$i<=$N;$i++) { |
| 25 | print <<___; |
| 26 | .proc lazy$i# |
| 27 | lazy$i: |
| 28 | .prologue |
| 29 | { .mii; .save ar.pfs,$loc0 |
| 30 | alloc loc0=ar.pfs,$V,3,2,0 |
| 31 | .save b0,loc1 |
| 32 | mov loc1=b0 |
| 33 | addl loc2=\@ltoff(OPENSSL_UplinkTable#),gp };; |
| 34 | .body |
| 35 | { .mmi; ld8 out0=[loc2] |
| 36 | mov out1=$i };; |
| 37 | { .mib; add loc2=8*$i,out0 |
| 38 | br.call.sptk.many b0=OPENSSL_Uplink# };; |
| 39 | { .mmi; ld8 r31=[loc2];; |
| 40 | ld8 r30=[r31],8 };; |
| 41 | { .mii; ld8 gp=[r31] |
| 42 | mov b6=r30 |
| 43 | mov b0=loc1 };; |
| 44 | { .mib; mov ar.pfs=loc0 |
| 45 | br.many b6 };; |
| 46 | .endp lazy$i# |
| 47 | |
| 48 | ___ |
| 49 | } |
| 50 | print <<___; |
| 51 | .data |
| 52 | .global OPENSSL_UplinkTable# |
| 53 | OPENSSL_UplinkTable: data8 $N // amount of following entries |
| 54 | ___ |
| 55 | for ($i=1;$i<=$N;$i++) { print " data8 \@fptr(lazy$i#)\n"; } |
| 56 | print <<___; |
| 57 | .size OPENSSL_UplinkTable,.-OPENSSL_UplinkTable# |
| 58 | ___ |
Andy Polyakov | acf1525 | 2016-03-18 23:31:17 +0100 | [diff] [blame] | 59 | |
| 60 | close STDOUT; |