11cb0ef41Sopenharmony_ci#! /usr/bin/env perl
21cb0ef41Sopenharmony_ci# Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
31cb0ef41Sopenharmony_ci#
41cb0ef41Sopenharmony_ci# Licensed under the Apache License 2.0 (the "License").  You may not use
51cb0ef41Sopenharmony_ci# this file except in compliance with the License.  You can obtain a copy
61cb0ef41Sopenharmony_ci# in the file LICENSE in the source distribution or at
71cb0ef41Sopenharmony_ci# https://www.openssl.org/source/license.html
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci$output = pop and open STDOUT,">$output";
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ci$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
121cb0ef41Sopenharmony_cipush(@INC,"${dir}.");
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_cirequire "uplink-common.pl";
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_cilocal $V=8;	# max number of args uplink functions may accept...
171cb0ef41Sopenharmony_cimy $loc0 = "r".(32+$V);
181cb0ef41Sopenharmony_ciprint <<___;
191cb0ef41Sopenharmony_ci.text
201cb0ef41Sopenharmony_ci.global	OPENSSL_Uplink#
211cb0ef41Sopenharmony_ci.type	OPENSSL_Uplink#,\@function
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ci___
241cb0ef41Sopenharmony_cifor ($i=1;$i<=$N;$i++) {
251cb0ef41Sopenharmony_ciprint <<___;
261cb0ef41Sopenharmony_ci.proc	lazy$i#
271cb0ef41Sopenharmony_cilazy$i:
281cb0ef41Sopenharmony_ci	.prologue
291cb0ef41Sopenharmony_ci{ .mii;	.save	ar.pfs,$loc0
301cb0ef41Sopenharmony_ci	alloc	loc0=ar.pfs,$V,3,2,0
311cb0ef41Sopenharmony_ci	.save	b0,loc1
321cb0ef41Sopenharmony_ci	mov	loc1=b0
331cb0ef41Sopenharmony_ci	addl	loc2=\@ltoff(OPENSSL_UplinkTable#),gp	};;
341cb0ef41Sopenharmony_ci	.body
351cb0ef41Sopenharmony_ci{ .mmi;	ld8	out0=[loc2]
361cb0ef41Sopenharmony_ci	mov	out1=$i					};;
371cb0ef41Sopenharmony_ci{ .mib;	add	loc2=8*$i,out0
381cb0ef41Sopenharmony_ci	br.call.sptk.many	b0=OPENSSL_Uplink#	};;
391cb0ef41Sopenharmony_ci{ .mmi;	ld8	r31=[loc2];;
401cb0ef41Sopenharmony_ci	ld8	r30=[r31],8				};;
411cb0ef41Sopenharmony_ci{ .mii;	ld8	gp=[r31]
421cb0ef41Sopenharmony_ci	mov	b6=r30
431cb0ef41Sopenharmony_ci	mov	b0=loc1					};;
441cb0ef41Sopenharmony_ci{ .mib;	mov	ar.pfs=loc0
451cb0ef41Sopenharmony_ci	br.many	b6					};;
461cb0ef41Sopenharmony_ci.endp	lazy$i#
471cb0ef41Sopenharmony_ci
481cb0ef41Sopenharmony_ci___
491cb0ef41Sopenharmony_ci}
501cb0ef41Sopenharmony_ciprint <<___;
511cb0ef41Sopenharmony_ci.data
521cb0ef41Sopenharmony_ci.global OPENSSL_UplinkTable#
531cb0ef41Sopenharmony_ciOPENSSL_UplinkTable:    data8   $N      // amount of following entries
541cb0ef41Sopenharmony_ci___
551cb0ef41Sopenharmony_cifor ($i=1;$i<=$N;$i++) {   print "      data8   \@fptr(lazy$i#)\n";   }
561cb0ef41Sopenharmony_ciprint <<___;
571cb0ef41Sopenharmony_ci.size   OPENSSL_UplinkTable,.-OPENSSL_UplinkTable#
581cb0ef41Sopenharmony_ci___
591cb0ef41Sopenharmony_ci
601cb0ef41Sopenharmony_ciclose STDOUT;
61