2016-04-20 10:10:43 +08:00
|
|
|
#! /usr/bin/env perl
|
|
|
|
# Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
|
|
|
|
#
|
2018-12-06 20:10:33 +08:00
|
|
|
# Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-04-20 10:10:43 +08:00
|
|
|
# this file except in compliance with the License. You can obtain a copy
|
|
|
|
# in the file LICENSE in the source distribution or at
|
|
|
|
# https://www.openssl.org/source/license.html
|
2008-07-22 16:47:35 +08:00
|
|
|
|
Unify all assembler file generators
They now generally conform to the following argument sequence:
script.pl "$(PERLASM_SCHEME)" [ C preprocessor arguments ... ] \
$(PROCESSOR) <output file>
However, in the spirit of being able to use these scripts manually,
they also allow for no argument, or for only the flavour, or for only
the output file. This is done by only using the last argument as
output file if it's a file (it has an extension), and only using the
first argument as flavour if it isn't a file (it doesn't have an
extension).
While we're at it, we make all $xlate calls the same, i.e. the $output
argument is always quoted, and we always die on error when trying to
start $xlate.
There's a perl lesson in this, regarding operator priority...
This will always succeed, even when it fails:
open FOO, "something" || die "ERR: $!";
The reason is that '||' has higher priority than list operators (a
function is essentially a list operator and gobbles up everything
following it that isn't lower priority), and since a non-empty string
is always true, so that ends up being exactly the same as:
open FOO, "something";
This, however, will fail if "something" can't be opened:
open FOO, "something" or die "ERR: $!";
The reason is that 'or' has lower priority that list operators,
i.e. it's performed after the 'open' call.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9884)
2019-09-13 06:06:46 +08:00
|
|
|
$output = pop and open STDOUT,">$output";
|
2016-03-19 06:31:17 +08:00
|
|
|
|
2008-07-22 16:47:35 +08:00
|
|
|
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
|
|
|
|
push(@INC,"${dir}.");
|
|
|
|
|
|
|
|
require "uplink-common.pl";
|
|
|
|
|
|
|
|
local $V=8; # max number of args uplink functions may accept...
|
|
|
|
my $loc0 = "r".(32+$V);
|
|
|
|
print <<___;
|
|
|
|
.text
|
|
|
|
.global OPENSSL_Uplink#
|
|
|
|
.type OPENSSL_Uplink#,\@function
|
|
|
|
|
|
|
|
___
|
|
|
|
for ($i=1;$i<=$N;$i++) {
|
|
|
|
print <<___;
|
|
|
|
.proc lazy$i#
|
|
|
|
lazy$i:
|
|
|
|
.prologue
|
|
|
|
{ .mii; .save ar.pfs,$loc0
|
|
|
|
alloc loc0=ar.pfs,$V,3,2,0
|
|
|
|
.save b0,loc1
|
|
|
|
mov loc1=b0
|
|
|
|
addl loc2=\@ltoff(OPENSSL_UplinkTable#),gp };;
|
|
|
|
.body
|
|
|
|
{ .mmi; ld8 out0=[loc2]
|
|
|
|
mov out1=$i };;
|
|
|
|
{ .mib; add loc2=8*$i,out0
|
|
|
|
br.call.sptk.many b0=OPENSSL_Uplink# };;
|
|
|
|
{ .mmi; ld8 r31=[loc2];;
|
|
|
|
ld8 r30=[r31],8 };;
|
|
|
|
{ .mii; ld8 gp=[r31]
|
|
|
|
mov b6=r30
|
|
|
|
mov b0=loc1 };;
|
|
|
|
{ .mib; mov ar.pfs=loc0
|
|
|
|
br.many b6 };;
|
|
|
|
.endp lazy$i#
|
|
|
|
|
|
|
|
___
|
|
|
|
}
|
|
|
|
print <<___;
|
|
|
|
.data
|
|
|
|
.global OPENSSL_UplinkTable#
|
|
|
|
OPENSSL_UplinkTable: data8 $N // amount of following entries
|
|
|
|
___
|
|
|
|
for ($i=1;$i<=$N;$i++) { print " data8 \@fptr(lazy$i#)\n"; }
|
|
|
|
print <<___;
|
|
|
|
.size OPENSSL_UplinkTable,.-OPENSSL_UplinkTable#
|
|
|
|
___
|
2016-03-19 06:31:17 +08:00
|
|
|
|
|
|
|
close STDOUT;
|