diff options
author | marha <marha@users.sourceforge.net> | 2009-06-28 22:07:26 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-06-28 22:07:26 +0000 |
commit | 3562e78743202e43aec8727005182a2558117eca (patch) | |
tree | 8f9113a77d12470c5c851a2a8e4cb02e89df7d43 /openssl/ms/uplink.pl | |
download | vcxsrv-3562e78743202e43aec8727005182a2558117eca.tar.gz vcxsrv-3562e78743202e43aec8727005182a2558117eca.tar.bz2 vcxsrv-3562e78743202e43aec8727005182a2558117eca.zip |
Checked in the following released items:
xkeyboard-config-1.4.tar.gz
ttf-bitstream-vera-1.10.tar.gz
font-alias-1.0.1.tar.gz
font-sun-misc-1.0.0.tar.gz
font-sun-misc-1.0.0.tar.gz
font-sony-misc-1.0.0.tar.gz
font-schumacher-misc-1.0.0.tar.gz
font-mutt-misc-1.0.0.tar.gz
font-misc-misc-1.0.0.tar.gz
font-misc-meltho-1.0.0.tar.gz
font-micro-misc-1.0.0.tar.gz
font-jis-misc-1.0.0.tar.gz
font-isas-misc-1.0.0.tar.gz
font-dec-misc-1.0.0.tar.gz
font-daewoo-misc-1.0.0.tar.gz
font-cursor-misc-1.0.0.tar.gz
font-arabic-misc-1.0.0.tar.gz
font-winitzki-cyrillic-1.0.0.tar.gz
font-misc-cyrillic-1.0.0.tar.gz
font-cronyx-cyrillic-1.0.0.tar.gz
font-screen-cyrillic-1.0.1.tar.gz
font-xfree86-type1-1.0.1.tar.gz
font-adobe-utopia-type1-1.0.1.tar.gz
font-ibm-type1-1.0.0.tar.gz
font-bitstream-type1-1.0.0.tar.gz
font-bitstream-speedo-1.0.0.tar.gz
font-bh-ttf-1.0.0.tar.gz
font-bh-type1-1.0.0.tar.gz
font-bitstream-100dpi-1.0.0.tar.gz
font-bh-lucidatypewriter-100dpi-1.0.0.tar.gz
font-bh-100dpi-1.0.0.tar.gz
font-adobe-utopia-100dpi-1.0.1.tar.gz
font-adobe-100dpi-1.0.0.tar.gz
font-util-1.0.1.tar.gz
font-bitstream-75dpi-1.0.0.tar.gz
font-bh-lucidatypewriter-75dpi-1.0.0.tar.gz
font-adobe-utopia-75dpi-1.0.1.tar.gz
font-bh-75dpi-1.0.0.tar.gz
bdftopcf-1.0.1.tar.gz
font-adobe-75dpi-1.0.0.tar.gz
mkfontscale-1.0.6.tar.gz
openssl-0.9.8k.tar.gz
bigreqsproto-1.0.2.tar.gz
xtrans-1.2.2.tar.gz
resourceproto-1.0.2.tar.gz
inputproto-1.4.4.tar.gz
compositeproto-0.4.tar.gz
damageproto-1.1.0.tar.gz
zlib-1.2.3.tar.gz
xkbcomp-1.0.5.tar.gz
freetype-2.3.9.tar.gz
pthreads-w32-2-8-0-release.tar.gz
pixman-0.12.0.tar.gz
kbproto-1.0.3.tar.gz
evieext-1.0.2.tar.gz
fixesproto-4.0.tar.gz
recordproto-1.13.2.tar.gz
randrproto-1.2.2.tar.gz
scrnsaverproto-1.1.0.tar.gz
renderproto-0.9.3.tar.gz
xcmiscproto-1.1.2.tar.gz
fontsproto-2.0.2.tar.gz
xextproto-7.0.3.tar.gz
xproto-7.0.14.tar.gz
libXdmcp-1.0.2.tar.gz
libxkbfile-1.0.5.tar.gz
libfontenc-1.0.4.tar.gz
libXfont-1.3.4.tar.gz
libX11-1.1.5.tar.gz
libXau-1.0.4.tar.gz
libxcb-1.1.tar.gz
xorg-server-1.5.3.tar.gz
Diffstat (limited to 'openssl/ms/uplink.pl')
-rw-r--r-- | openssl/ms/uplink.pl | 204 |
1 files changed, 204 insertions, 0 deletions
diff --git a/openssl/ms/uplink.pl b/openssl/ms/uplink.pl new file mode 100644 index 000000000..102400e88 --- /dev/null +++ b/openssl/ms/uplink.pl @@ -0,0 +1,204 @@ +#!/usr/bin/env perl +# +# For Microsoft CL this is implemented as inline assembler. So that +# even though this script can generate even Win32 code, we'll be +# using it primarily to generate Win64 modules. Both IA-64 and AMD64 +# are supported... + +# pull APPLINK_MAX value from applink.c... +$applink_c=$0; +$applink_c=~s|[^/\\]+$||g; +$applink_c.="applink.c"; +open(INPUT,$applink_c) || die "can't open $applink_c: $!"; +@max=grep {/APPLINK_MAX\s+(\d+)/} <INPUT>; +close(INPUT); +($#max==0) or die "can't find APPLINK_MAX in $applink_c"; + +$max[0]=~/APPLINK_MAX\s+(\d+)/; +$N=$1; # number of entries in OPENSSL_UplinkTable not including + # OPENSSL_UplinkTable[0], which contains this value... + +# Idea is to fill the OPENSSL_UplinkTable with pointers to stubs +# which invoke 'void OPENSSL_Uplink (ULONG_PTR *table,int index)'; +# and then dereference themselves. Latter shall result in endless +# loop *unless* OPENSSL_Uplink does not replace 'table[index]' with +# something else, e.g. as 'table[index]=unimplemented;'... + +$arg = shift; +#( defined shift || open STDOUT,">$arg" ) || die "can't open $arg: $!"; + +if ($arg =~ /win32n/) { ia32nasm(); } +elsif ($arg =~ /win32/) { ia32masm(); } +elsif ($arg =~ /coff/) { ia32gas(); } +elsif ($arg =~ /win64i/ or $arg =~ /ia64/) { ia64ias(); } +elsif ($arg =~ /win64a/ or $arg =~ /amd64/) { amd64masm(); } +else { die "nonsense $arg"; } + +sub ia32gas() { +print <<___; +.text +___ +for ($i=1;$i<=$N;$i++) { +print <<___; +.def .Lazy$i; .scl 3; .type 32; .endef +.align 4 +.Lazy$i: + pushl \$$i + pushl \$_OPENSSL_UplinkTable + call _OPENSSL_Uplink + addl \$8,%esp + jmp *(_OPENSSL_UplinkTable+4*$i) +___ +} +print <<___; +.data +.align 4 +.globl _OPENSSL_UplinkTable +_OPENSSL_UplinkTable: + .long $N +___ +for ($i=1;$i<=$N;$i++) { print " .long .Lazy$i\n"; } +} + +sub ia32masm() { +print <<___; +.386P +.model FLAT + +_DATA SEGMENT +PUBLIC _OPENSSL_UplinkTable +_OPENSSL_UplinkTable DD $N ; amount of following entries +___ +for ($i=1;$i<=$N;$i++) { print " DD FLAT:\$lazy$i\n"; } +print <<___; +_DATA ENDS + +_TEXT SEGMENT +EXTRN _OPENSSL_Uplink:NEAR +___ +for ($i=1;$i<=$N;$i++) { +print <<___; +ALIGN 4 +\$lazy$i PROC NEAR + push $i + push OFFSET FLAT:_OPENSSL_UplinkTable + call _OPENSSL_Uplink + add esp,8 + jmp DWORD PTR _OPENSSL_UplinkTable+4*$i +\$lazy$i ENDP +___ +} +print <<___; +ALIGN 4 +_TEXT ENDS +END +___ +} + +sub ia32nasm() { +print <<___; +SEGMENT .data +GLOBAL _OPENSSL_UplinkTable +_OPENSSL_UplinkTable DD $N ; amount of following entries +___ +for ($i=1;$i<=$N;$i++) { print " DD \$lazy$i\n"; } +print <<___; + +SEGMENT .text +EXTERN _OPENSSL_Uplink +___ +for ($i=1;$i<=$N;$i++) { +print <<___; +ALIGN 4 +\$lazy$i: + push $i + push _OPENSSL_UplinkTable + call _OPENSSL_Uplink + add esp,8 + jmp [_OPENSSL_UplinkTable+4*$i] +___ +} +print <<___; +ALIGN 4 +END +___ +} + +sub ia64ias () { +local $V=8; # max number of args uplink functions may accept... +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# + +.text +.global OPENSSL_Uplink# +.type OPENSSL_Uplink#,\@function +___ +for ($i=1;$i<=$N;$i++) { +print <<___; +.proc lazy$i +lazy$i: +{ .mii; alloc loc0=ar.pfs,$V,3,2,0 + mov loc1=b0 + addl loc2=\@ltoff(OPENSSL_UplinkTable#),gp };; +{ .mmi; ld8 out0=[loc2] + mov out1=$i };; +{ .mib; adds 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# +___ +} +} + +sub amd64masm() { +print <<___; +_DATA SEGMENT +PUBLIC OPENSSL_UplinkTable +OPENSSL_UplinkTable DQ $N +___ +for ($i=1;$i<=$N;$i++) { print " DQ \$lazy$i\n"; } +print <<___; +_DATA ENDS + +_TEXT SEGMENT +EXTERN OPENSSL_Uplink:PROC +___ +for ($i=1;$i<=$N;$i++) { +print <<___; +ALIGN 4 +\$lazy$i PROC + push r9 + push r8 + push rdx + push rcx + sub rsp,40 + lea rcx,OFFSET OPENSSL_UplinkTable + mov rdx,$i + call OPENSSL_Uplink + add rsp,40 + pop rcx + pop rdx + pop r8 + pop r9 + jmp QWORD PTR OPENSSL_UplinkTable+8*$i +\$lazy$i ENDP +___ +} +print <<___; +_TEXT ENDS +END +___ +} + |