xref: /freebsd/crypto/openssl/ms/uplink-ia64.pl (revision e0c4386e7e71d93b0edc0c8fa156263fc4a8b0b6)
1#! /usr/bin/env perl
2# Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
3#
4# Licensed under the Apache License 2.0 (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 and open STDOUT,">$output";
10
11$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
12push(@INC,"${dir}.");
13
14require "uplink-common.pl";
15
16local $V=8;	# max number of args uplink functions may accept...
17my $loc0 = "r".(32+$V);
18print <<___;
19.text
20.global	OPENSSL_Uplink#
21.type	OPENSSL_Uplink#,\@function
22
23___
24for ($i=1;$i<=$N;$i++) {
25print <<___;
26.proc	lazy$i#
27lazy$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}
50print <<___;
51.data
52.global OPENSSL_UplinkTable#
53OPENSSL_UplinkTable:    data8   $N      // amount of following entries
54___
55for ($i=1;$i<=$N;$i++) {   print "      data8   \@fptr(lazy$i#)\n";   }
56print <<___;
57.size   OPENSSL_UplinkTable,.-OPENSSL_UplinkTable#
58___
59
60close STDOUT;
61