0000: 23 69 66 6e 64 65 66 20 5f 61 76 63 61 6c 6c 5f #ifndef _avcall_
0010: 61 6c 70 68 61 5f 63 09 09 09 09 2f 2a 2d 2a 2d alpha_c..../*-*-
0020: 20 43 20 2d 2a 2d 2a 2f 0a 23 64 65 66 69 6e 65 C -*-*/.#define
0030: 20 5f 61 76 63 61 6c 6c 5f 61 6c 70 68 61 5f 63 _avcall_alpha_c
0040: 0a 2f 2a 2a 0a 20 20 43 6f 70 79 72 69 67 68 74 ./**. Copyright
0050: 20 31 39 39 33 20 42 69 6c 6c 20 54 72 69 67 67 1993 Bill Trigg
0060: 73 2c 20 3c 42 69 6c 6c 2e 54 72 69 67 67 73 40 s, <Bill.Triggs@
0070: 69 6e 72 69 61 6c 70 65 73 2e 66 72 3e 0a 20 20 inrialpes.fr>.
0080: 43 6f 70 79 72 69 67 68 74 20 31 39 39 35 2d 31 Copyright 1995-1
0090: 39 39 39 20 42 72 75 6e 6f 20 48 61 69 62 6c 65 999 Bruno Haible
00a0: 2c 20 3c 62 72 75 6e 6f 40 63 6c 69 73 70 2e 6f , <bruno@clisp.o
00b0: 72 67 3e 0a 0a 20 20 54 68 69 73 20 69 73 20 66 rg>.. This is f
00c0: 72 65 65 20 73 6f 66 74 77 61 72 65 20 64 69 73 ree software dis
00d0: 74 72 69 62 75 74 65 64 20 75 6e 64 65 72 20 74 tributed under t
00e0: 68 65 20 47 4e 55 20 47 65 6e 65 72 61 6c 20 50 he GNU General P
00f0: 75 62 6c 69 63 0a 20 20 4c 69 63 65 6e 63 65 20 ublic. Licence
0100: 64 65 73 63 72 69 62 65 64 20 69 6e 20 74 68 65 described in the
0110: 20 66 69 6c 65 20 43 4f 50 59 49 4e 47 2e 20 43 file COPYING. C
0120: 6f 6e 74 61 63 74 20 74 68 65 20 61 75 74 68 6f ontact the autho
0130: 72 20 69 66 0a 20 20 79 6f 75 20 64 6f 6e 27 74 r if. you don't
0140: 20 68 61 76 65 20 74 68 69 73 20 6f 72 20 63 61 have this or ca
0150: 6e 27 74 20 6c 69 76 65 20 77 69 74 68 20 69 74 n't live with it
0160: 2e 20 54 68 65 72 65 20 69 73 20 41 42 53 4f 4c . There is ABSOL
0170: 55 54 45 4c 59 0a 20 20 4e 4f 20 57 41 52 52 41 UTELY. NO WARRA
0180: 4e 54 59 2c 20 65 78 70 6c 69 63 69 74 20 6f 72 NTY, explicit or
0190: 20 69 6d 70 6c 69 65 64 2c 20 6f 6e 20 74 68 69 implied, on thi
01a0: 73 20 73 6f 66 74 77 61 72 65 2e 0a 2a 2a 2f 0a s software..**/.
01b0: 2f 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d /*--------------
01c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
01d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
01e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
01f0: 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 21 21 21 20 54 --------. !!! T
0200: 48 49 53 20 52 4f 55 54 49 4e 45 20 4d 55 53 54 HIS ROUTINE MUST
0210: 20 42 45 20 43 4f 4d 50 49 4c 45 44 20 67 63 63 BE COMPILED gcc
0220: 20 2d 4f 20 21 21 21 0a 0a 20 20 46 6f 72 65 69 -O !!!.. Forei
0230: 67 6e 20 66 75 6e 63 74 69 6f 6e 20 69 6e 74 65 gn function inte
0240: 72 66 61 63 65 20 66 6f 72 20 61 20 44 45 43 20 rface for a DEC
0250: 41 6c 70 68 61 20 77 69 74 68 20 67 63 63 2e 0a Alpha with gcc..
0260: 0a 20 20 54 68 69 73 20 63 61 6c 6c 73 20 61 20 . This calls a
0270: 43 20 66 75 6e 63 74 69 6f 6e 20 77 69 74 68 20 C function with
0280: 61 6e 20 61 72 67 75 6d 65 6e 74 20 6c 69 73 74 an argument list
0290: 20 62 75 69 6c 74 20 75 70 20 75 73 69 6e 67 20 built up using
02a0: 6d 61 63 72 6f 73 0a 20 20 64 65 66 69 6e 65 64 macros. defined
02b0: 20 69 6e 20 61 76 5f 63 61 6c 6c 2e 68 2e 0a 0a in av_call.h...
02c0: 20 20 41 6c 70 68 61 20 41 72 67 75 6d 65 6e 74 Alpha Argument
02d0: 20 50 61 73 73 69 6e 67 20 43 6f 6e 76 65 6e 74 Passing Convent
02e0: 69 6f 6e 73 0a 0a 20 20 54 68 65 20 66 69 72 73 ions.. The firs
02f0: 74 20 36 20 61 72 67 75 6d 65 6e 74 73 20 61 72 t 6 arguments ar
0300: 65 20 70 61 73 73 65 64 20 69 6e 20 72 65 67 69 e passed in regi
0310: 73 74 65 72 73 20 24 31 36 2d 24 32 31 20 66 6f sters $16-$21 fo
0320: 72 20 69 6e 74 65 67 65 72 73 2c 0a 20 20 69 6e r integers,. in
0330: 20 72 65 67 69 73 74 65 72 73 20 24 66 31 36 2d registers $f16-
0340: 24 66 32 31 20 66 6f 72 20 66 6c 6f 61 74 73 2e $f21 for floats.
0350: 20 46 72 6f 6d 20 74 68 65 6e 20 6f 6e 2c 20 65 From then on, e
0360: 76 65 72 79 74 68 69 6e 67 20 69 73 20 70 61 73 verything is pas
0370: 73 65 64 0a 20 20 6f 6e 20 74 68 65 20 73 74 61 sed. on the sta
0380: 63 6b 2e 0a 0a 20 20 45 76 65 72 79 74 68 69 6e ck... Everythin
0390: 67 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 20 69 g on the stack i
03a0: 73 20 77 6f 72 64 2d 61 6c 69 67 6e 65 64 2e 0a s word-aligned..
03b0: 0a 20 20 49 6e 74 65 67 65 72 73 20 61 6e 64 20 . Integers and
03c0: 70 6f 69 6e 74 65 72 73 20 61 72 65 20 72 65 74 pointers are ret
03d0: 75 72 6e 65 64 20 69 6e 20 24 30 2c 20 66 6c 6f urned in $0, flo
03e0: 61 74 73 20 61 6e 64 20 64 6f 75 62 6c 65 73 20 ats and doubles
03f0: 69 6e 20 24 66 30 2e 0a 20 20 54 6f 20 72 65 74 in $f0.. To ret
0400: 75 72 6e 20 61 20 73 74 72 75 63 74 75 72 65 2c urn a structure,
0410: 20 74 68 65 20 63 61 6c 6c 65 64 20 66 75 6e 63 the called func
0420: 74 69 6f 6e 20 63 6f 70 69 65 73 20 74 68 65 20 tion copies the
0430: 76 61 6c 75 65 20 74 6f 20 73 70 61 63 65 0a 20 value to space.
0440: 20 70 6f 69 6e 74 65 64 20 74 6f 20 62 79 20 69 pointed to by i
0450: 74 73 20 66 69 72 73 74 20 61 72 67 75 6d 65 6e ts first argumen
0460: 74 2c 20 61 6e 64 20 61 6c 6c 20 6f 74 68 65 72 t, and all other
0470: 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 20 73 arguments are s
0480: 68 69 66 74 65 64 0a 20 20 64 6f 77 6e 20 62 79 hifted. down by
0490: 20 6f 6e 65 2e 0a 0a 20 20 43 6f 6d 70 69 6c 65 one... Compile
04a0: 20 74 68 69 73 20 72 6f 75 74 69 6e 65 20 77 69 this routine wi
04b0: 74 68 20 67 63 63 20 66 6f 72 20 74 68 65 20 5f th gcc for the _
04c0: 5f 61 73 6d 5f 5f 20 65 78 74 65 6e 73 69 6f 6e _asm__ extension
04d0: 73 20 61 6e 64 20 77 69 74 68 0a 20 20 6f 70 74 s and with. opt
04e0: 69 6d 69 73 61 74 69 6f 6e 20 6f 6e 20 28 2d 4f imisation on (-O
04f0: 20 6f 72 20 2d 4f 32 20 6f 72 20 2d 67 20 2d 4f or -O2 or -g -O
0500: 29 20 73 6f 20 74 68 61 74 20 61 72 67 66 72 61 ) so that argfra
0510: 6d 65 20 69 73 20 73 65 74 20 74 6f 20 74 68 65 me is set to the
0520: 0a 20 20 63 6f 72 72 65 63 74 20 6f 66 66 73 65 . correct offse
0530: 74 2e 0a 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d t.. -----------
0540: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0550: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0560: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0570: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2a 2f 0a 23 69 -----------*/.#i
0580: 6e 63 6c 75 64 65 20 22 61 76 63 61 6c 6c 2e 68 nclude "avcall.h
0590: 2e 69 6e 22 0a 0a 23 64 65 66 69 6e 65 20 52 45 .in"..#define RE
05a0: 54 55 52 4e 28 54 59 50 45 2c 56 41 4c 29 09 28 TURN(TYPE,VAL).(
05b0: 2a 28 54 59 50 45 2a 29 6c 2d 3e 72 61 64 64 72 *(TYPE*)l->raddr
05c0: 20 3d 20 28 54 59 50 45 29 28 56 41 4c 29 29 0a = (TYPE)(VAL)).
05d0: 0a 69 6e 74 0a 5f 5f 62 75 69 6c 74 69 6e 5f 61 .int.__builtin_a
05e0: 76 63 61 6c 6c 28 61 76 5f 61 6c 69 73 74 2a 20 vcall(av_alist*
05f0: 6c 29 0a 7b 0a 20 20 72 65 67 69 73 74 65 72 20 l).{. register
0600: 5f 5f 61 76 77 6f 72 64 2a 09 73 70 09 5f 5f 61 __avword*.sp.__a
0610: 73 6d 5f 5f 28 22 24 33 30 22 29 3b 20 20 2f 2a sm__("$30"); /*
0620: 20 43 20 6e 61 6d 65 73 20 66 6f 72 20 72 65 67 C names for reg
0630: 69 73 74 65 72 73 20 2a 2f 0a 20 20 72 65 67 69 isters */. regi
0640: 73 74 65 72 20 6c 6f 6e 67 09 09 61 72 67 31 09 ster long..arg1.
0650: 5f 5f 61 73 6d 5f 5f 28 22 24 31 36 22 29 3b 0a __asm__("$16");.
0660: 20 20 72 65 67 69 73 74 65 72 20 6c 6f 6e 67 09 register long.
0670: 09 61 72 67 32 09 5f 5f 61 73 6d 5f 5f 28 22 24 .arg2.__asm__("$
0680: 31 37 22 29 3b 0a 20 20 72 65 67 69 73 74 65 72 17");. register
0690: 20 6c 6f 6e 67 09 09 61 72 67 33 09 5f 5f 61 73 long..arg3.__as
06a0: 6d 5f 5f 28 22 24 31 38 22 29 3b 0a 20 20 72 65 m__("$18");. re
06b0: 67 69 73 74 65 72 20 6c 6f 6e 67 09 09 61 72 67 gister long..arg
06c0: 34 09 5f 5f 61 73 6d 5f 5f 28 22 24 31 39 22 29 4.__asm__("$19")
06d0: 3b 0a 20 20 72 65 67 69 73 74 65 72 20 6c 6f 6e ;. register lon
06e0: 67 09 09 61 72 67 35 09 5f 5f 61 73 6d 5f 5f 28 g..arg5.__asm__(
06f0: 22 24 32 30 22 29 3b 0a 20 20 72 65 67 69 73 74 "$20");. regist
0700: 65 72 20 6c 6f 6e 67 09 09 61 72 67 36 09 5f 5f er long..arg6.__
0710: 61 73 6d 5f 5f 28 22 24 32 31 22 29 3b 0a 20 20 asm__("$21");.
0720: 72 65 67 69 73 74 65 72 20 64 6f 75 62 6c 65 09 register double.
0730: 66 72 65 74 09 5f 5f 61 73 6d 5f 5f 28 22 24 66 fret.__asm__("$f
0740: 30 22 29 3b 0a 20 20 72 65 67 69 73 74 65 72 20 0");. register
0750: 64 6f 75 62 6c 65 09 66 61 72 67 31 09 5f 5f 61 double.farg1.__a
0760: 73 6d 5f 5f 28 22 24 66 31 36 22 29 3b 0a 20 20 sm__("$f16");.
0770: 72 65 67 69 73 74 65 72 20 64 6f 75 62 6c 65 09 register double.
0780: 66 61 72 67 32 09 5f 5f 61 73 6d 5f 5f 28 22 24 farg2.__asm__("$
0790: 66 31 37 22 29 3b 0a 20 20 72 65 67 69 73 74 65 f17");. registe
07a0: 72 20 64 6f 75 62 6c 65 09 66 61 72 67 33 09 5f r double.farg3._
07b0: 5f 61 73 6d 5f 5f 28 22 24 66 31 38 22 29 3b 0a _asm__("$f18");.
07c0: 20 20 72 65 67 69 73 74 65 72 20 64 6f 75 62 6c register doubl
07d0: 65 09 66 61 72 67 34 09 5f 5f 61 73 6d 5f 5f 28 e.farg4.__asm__(
07e0: 22 24 66 31 39 22 29 3b 0a 20 20 72 65 67 69 73 "$f19");. regis
07f0: 74 65 72 20 64 6f 75 62 6c 65 09 66 61 72 67 35 ter double.farg5
0800: 09 5f 5f 61 73 6d 5f 5f 28 22 24 66 32 30 22 29 .__asm__("$f20")
0810: 3b 0a 20 20 72 65 67 69 73 74 65 72 20 64 6f 75 ;. register dou
0820: 62 6c 65 09 66 61 72 67 36 09 5f 5f 61 73 6d 5f ble.farg6.__asm_
0830: 5f 28 22 24 66 32 31 22 29 3b 0a 2f 2a 72 65 67 _("$f21");./*reg
0840: 69 73 74 65 72 20 5f 5f 61 76 77 6f 72 64 09 69 ister __avword.i
0850: 72 65 74 09 5f 5f 61 73 6d 5f 5f 28 22 24 30 22 ret.__asm__("$0"
0860: 29 3b 20 2a 2f 0a 20 20 72 65 67 69 73 74 65 72 ); */. register
0870: 20 5f 5f 61 76 77 6f 72 64 09 69 72 65 74 32 09 __avword.iret2.
0880: 5f 5f 61 73 6d 5f 5f 28 22 24 31 22 29 3b 0a 0a __asm__("$1");..
0890: 20 20 5f 5f 61 76 77 6f 72 64 2a 20 61 72 67 66 __avword* argf
08a0: 72 61 6d 65 20 3d 20 28 73 70 20 2d 3d 20 5f 5f rame = (sp -= __
08b0: 41 56 5f 41 4c 49 53 54 5f 57 4f 52 44 53 29 3b AV_ALIST_WORDS);
08c0: 20 2f 2a 20 6d 61 6b 65 20 72 6f 6f 6d 20 66 6f /* make room fo
08d0: 72 20 61 72 67 75 6d 65 6e 74 20 6c 69 73 74 20 r argument list
08e0: 2a 2f 0a 20 20 69 6e 74 20 61 72 67 6c 65 6e 20 */. int arglen
08f0: 3d 20 28 28 75 6e 73 69 67 6e 65 64 20 6c 6f 6e = ((unsigned lon
0900: 67 29 20 6c 2d 3e 61 70 74 72 20 2d 20 28 75 6e g) l->aptr - (un
0910: 73 69 67 6e 65 64 20 6c 6f 6e 67 29 20 6c 2d 3e signed long) l->
0920: 61 72 67 73 29 20 3e 3e 20 33 3b 0a 20 20 5f 5f args) >> 3;. __
0930: 61 76 77 6f 72 64 20 69 2c 20 69 32 3b 0a 0a 20 avword i, i2;..
0940: 20 66 6f 72 20 28 69 20 3d 20 36 3b 20 69 20 3c for (i = 6; i <
0950: 20 61 72 67 6c 65 6e 3b 20 69 2b 2b 29 09 09 2f arglen; i++)../
0960: 2a 20 70 75 73 68 20 65 78 63 65 73 73 20 66 75 * push excess fu
0970: 6e 63 74 69 6f 6e 20 61 72 67 73 20 2a 2f 0a 20 nction args */.
0980: 20 20 20 61 72 67 66 72 61 6d 65 5b 69 2d 36 5d argframe[i-6]
0990: 20 3d 20 6c 2d 3e 61 72 67 73 5b 69 5d 3b 0a 0a = l->args[i];..
09a0: 09 09 09 09 09 2f 2a 20 63 61 6c 6c 20 66 75 6e ...../* call fun
09b0: 63 74 69 6f 6e 20 77 69 74 68 20 31 73 74 20 36 ction with 1st 6
09c0: 20 61 72 67 73 20 2a 2f 0a 20 20 2f 2a 20 77 65 args */. /* we
09d0: 20 70 61 73 73 20 74 68 65 20 61 72 67 73 20 62 pass the args b
09e0: 6f 74 68 20 69 6e 20 74 68 65 20 69 6e 74 65 67 oth in the integ
09f0: 65 72 20 72 65 67 69 73 74 65 72 73 20 61 6e 64 er registers and
0a00: 20 74 68 65 20 66 6c 6f 61 74 69 6e 67 20 70 6f the floating po
0a10: 69 6e 74 0a 20 20 20 20 20 72 65 67 69 73 74 65 int. registe
0a20: 72 73 2c 20 73 6f 20 77 65 20 64 6f 6e 27 74 20 rs, so we don't
0a30: 68 61 76 65 20 74 6f 20 73 74 6f 72 65 20 74 68 have to store th
0a40: 65 20 61 72 67 75 6d 65 6e 74 20 74 79 70 65 73 e argument types
0a50: 2e 20 2a 2f 0a 20 20 5f 5f 61 73 6d 5f 5f 20 5f . */. __asm__ _
0a60: 5f 76 6f 6c 61 74 69 6c 65 5f 5f 20 28 22 6c 64 _volatile__ ("ld
0a70: 71 20 24 31 36 2c 25 30 22 20 3a 20 3a 20 22 6d q $16,%0" : : "m
0a80: 22 20 28 6c 2d 3e 61 72 67 73 5b 30 5d 29 29 3b " (l->args[0]));
0a90: 20 2f 2a 20 61 72 67 31 20 3d 20 6c 2d 3e 61 72 /* arg1 = l->ar
0aa0: 67 73 5b 30 5d 3b 20 2a 2f 0a 20 20 5f 5f 61 73 gs[0]; */. __as
0ab0: 6d 5f 5f 20 5f 5f 76 6f 6c 61 74 69 6c 65 5f 5f m__ __volatile__
0ac0: 20 28 22 6c 64 74 20 24 66 31 36 2c 25 30 22 20 ("ldt $f16,%0"
0ad0: 3a 20 3a 20 22 6d 22 20 28 6c 2d 3e 61 72 67 73 : : "m" (l->args
0ae0: 5b 30 5d 29 29 3b 20 2f 2a 20 66 61 72 67 31 20 [0])); /* farg1
0af0: 3d 20 2a 28 64 6f 75 62 6c 65 2a 29 20 26 6c 2d = *(double*) &l-
0b00: 3e 61 72 67 73 5b 30 5d 3b 20 2a 2f 0a 20 20 5f >args[0]; */. _
0b10: 5f 61 73 6d 5f 5f 20 5f 5f 76 6f 6c 61 74 69 6c _asm__ __volatil
0b20: 65 5f 5f 20 28 22 6c 64 71 20 24 31 37 2c 25 30 e__ ("ldq $17,%0
0b30: 22 20 3a 20 3a 20 22 6d 22 20 28 6c 2d 3e 61 72 " : : "m" (l->ar
0b40: 67 73 5b 31 5d 29 29 3b 20 2f 2a 20 61 72 67 32 gs[1])); /* arg2
0b50: 20 3d 20 6c 2d 3e 61 72 67 73 5b 31 5d 3b 20 2a = l->args[1]; *
0b60: 2f 0a 20 20 5f 5f 61 73 6d 5f 5f 20 5f 5f 76 6f /. __asm__ __vo
0b70: 6c 61 74 69 6c 65 5f 5f 20 28 22 6c 64 74 20 24 latile__ ("ldt $
0b80: 66 31 37 2c 25 30 22 20 3a 20 3a 20 22 6d 22 20 f17,%0" : : "m"
0b90: 28 6c 2d 3e 61 72 67 73 5b 31 5d 29 29 3b 20 2f (l->args[1])); /
0ba0: 2a 20 66 61 72 67 32 20 3d 20 2a 28 64 6f 75 62 * farg2 = *(doub
0bb0: 6c 65 2a 29 20 26 6c 2d 3e 61 72 67 73 5b 31 5d le*) &l->args[1]
0bc0: 3b 20 2a 2f 0a 20 20 5f 5f 61 73 6d 5f 5f 20 5f ; */. __asm__ _
0bd0: 5f 76 6f 6c 61 74 69 6c 65 5f 5f 20 28 22 6c 64 _volatile__ ("ld
0be0: 71 20 24 31 38 2c 25 30 22 20 3a 20 3a 20 22 6d q $18,%0" : : "m
0bf0: 22 20 28 6c 2d 3e 61 72 67 73 5b 32 5d 29 29 3b " (l->args[2]));
0c00: 20 2f 2a 20 61 72 67 33 20 3d 20 6c 2d 3e 61 72 /* arg3 = l->ar
0c10: 67 73 5b 32 5d 3b 20 2a 2f 0a 20 20 5f 5f 61 73 gs[2]; */. __as
0c20: 6d 5f 5f 20 5f 5f 76 6f 6c 61 74 69 6c 65 5f 5f m__ __volatile__
0c30: 20 28 22 6c 64 74 20 24 66 31 38 2c 25 30 22 20 ("ldt $f18,%0"
0c40: 3a 20 3a 20 22 6d 22 20 28 6c 2d 3e 61 72 67 73 : : "m" (l->args
0c50: 5b 32 5d 29 29 3b 20 2f 2a 20 66 61 72 67 33 20 [2])); /* farg3
0c60: 3d 20 2a 28 64 6f 75 62 6c 65 2a 29 20 26 6c 2d = *(double*) &l-
0c70: 3e 61 72 67 73 5b 32 5d 3b 20 2a 2f 0a 20 20 5f >args[2]; */. _
0c80: 5f 61 73 6d 5f 5f 20 5f 5f 76 6f 6c 61 74 69 6c _asm__ __volatil
0c90: 65 5f 5f 20 28 22 6c 64 71 20 24 31 39 2c 25 30 e__ ("ldq $19,%0
0ca0: 22 20 3a 20 3a 20 22 6d 22 20 28 6c 2d 3e 61 72 " : : "m" (l->ar
0cb0: 67 73 5b 33 5d 29 29 3b 20 2f 2a 20 61 72 67 34 gs[3])); /* arg4
0cc0: 20 3d 20 6c 2d 3e 61 72 67 73 5b 33 5d 3b 20 2a = l->args[3]; *
0cd0: 2f 0a 20 20 5f 5f 61 73 6d 5f 5f 20 5f 5f 76 6f /. __asm__ __vo
0ce0: 6c 61 74 69 6c 65 5f 5f 20 28 22 6c 64 74 20 24 latile__ ("ldt $
0cf0: 66 31 39 2c 25 30 22 20 3a 20 3a 20 22 6d 22 20 f19,%0" : : "m"
0d00: 28 6c 2d 3e 61 72 67 73 5b 33 5d 29 29 3b 20 2f (l->args[3])); /
0d10: 2a 20 66 61 72 67 34 20 3d 20 2a 28 64 6f 75 62 * farg4 = *(doub
0d20: 6c 65 2a 29 20 26 6c 2d 3e 61 72 67 73 5b 33 5d le*) &l->args[3]
0d30: 3b 20 2a 2f 0a 20 20 5f 5f 61 73 6d 5f 5f 20 5f ; */. __asm__ _
0d40: 5f 76 6f 6c 61 74 69 6c 65 5f 5f 20 28 22 6c 64 _volatile__ ("ld
0d50: 71 20 24 32 30 2c 25 30 22 20 3a 20 3a 20 22 6d q $20,%0" : : "m
0d60: 22 20 28 6c 2d 3e 61 72 67 73 5b 34 5d 29 29 3b " (l->args[4]));
0d70: 20 2f 2a 20 61 72 67 35 20 3d 20 6c 2d 3e 61 72 /* arg5 = l->ar
0d80: 67 73 5b 34 5d 3b 20 2a 2f 0a 20 20 5f 5f 61 73 gs[4]; */. __as
0d90: 6d 5f 5f 20 5f 5f 76 6f 6c 61 74 69 6c 65 5f 5f m__ __volatile__
0da0: 20 28 22 6c 64 74 20 24 66 32 30 2c 25 30 22 20 ("ldt $f20,%0"
0db0: 3a 20 3a 20 22 6d 22 20 28 6c 2d 3e 61 72 67 73 : : "m" (l->args
0dc0: 5b 34 5d 29 29 3b 20 2f 2a 20 66 61 72 67 35 20 [4])); /* farg5
0dd0: 3d 20 2a 28 64 6f 75 62 6c 65 2a 29 20 26 6c 2d = *(double*) &l-
0de0: 3e 61 72 67 73 5b 34 5d 3b 20 2a 2f 0a 20 20 5f >args[4]; */. _
0df0: 5f 61 73 6d 5f 5f 20 5f 5f 76 6f 6c 61 74 69 6c _asm__ __volatil
0e00: 65 5f 5f 20 28 22 6c 64 71 20 24 32 31 2c 25 30 e__ ("ldq $21,%0
0e10: 22 20 3a 20 3a 20 22 6d 22 20 28 6c 2d 3e 61 72 " : : "m" (l->ar
0e20: 67 73 5b 35 5d 29 29 3b 20 2f 2a 20 61 72 67 36 gs[5])); /* arg6
0e30: 20 3d 20 6c 2d 3e 61 72 67 73 5b 35 5d 3b 20 2a = l->args[5]; *
0e40: 2f 0a 20 20 5f 5f 61 73 6d 5f 5f 20 5f 5f 76 6f /. __asm__ __vo
0e50: 6c 61 74 69 6c 65 5f 5f 20 28 22 6c 64 74 20 24 latile__ ("ldt $
0e60: 66 32 31 2c 25 30 22 20 3a 20 3a 20 22 6d 22 20 f21,%0" : : "m"
0e70: 28 6c 2d 3e 61 72 67 73 5b 35 5d 29 29 3b 20 2f (l->args[5])); /
0e80: 2a 20 66 61 72 67 36 20 3d 20 2a 28 64 6f 75 62 * farg6 = *(doub
0e90: 6c 65 2a 29 20 26 6c 2d 3e 61 72 67 73 5b 35 5d le*) &l->args[5]
0ea0: 3b 20 2a 2f 0a 20 20 69 20 3d 20 28 2a 6c 2d 3e ; */. i = (*l->
0eb0: 66 75 6e 63 29 28 29 3b 0a 20 20 69 32 20 3d 20 func)();. i2 =
0ec0: 69 72 65 74 32 3b 0a 20 20 73 70 20 2b 3d 20 5f iret2;. sp += _
0ed0: 5f 41 56 5f 41 4c 49 53 54 5f 57 4f 52 44 53 3b _AV_ALIST_WORDS;
0ee0: 09 2f 2a 20 72 65 6d 6f 76 65 20 61 72 67 75 6d ./* remove argum
0ef0: 65 6e 74 20 6c 69 73 74 20 66 72 6f 6d 20 74 68 ent list from th
0f00: 65 20 73 74 61 63 6b 20 2a 2f 0a 20 20 2f 2a 20 e stack */. /*
0f10: 74 68 69 73 20 69 73 20 61 70 70 61 72 65 6e 74 this is apparent
0f20: 6c 79 20 6e 6f 74 20 6e 65 65 64 65 64 2c 20 62 ly not needed, b
0f30: 75 74 20 62 65 74 74 65 72 20 73 61 66 65 20 74 ut better safe t
0f40: 68 61 6e 20 73 6f 72 72 79 2e 2e 2e 20 2a 2f 0a han sorry... */.
0f50: 20 20 5f 5f 61 73 6d 5f 5f 20 5f 5f 76 6f 6c 61 __asm__ __vola
0f60: 74 69 6c 65 5f 5f 20 28 22 22 20 3a 20 3a 20 3a tile__ ("" : : :
0f70: 0a 09 09 09 2f 2a 20 63 6c 6f 62 62 65 72 20 2a ..../* clobber *
0f80: 2f 20 22 24 31 36 22 2c 20 22 24 31 37 22 2c 20 / "$16", "$17",
0f90: 22 24 31 38 22 2c 20 22 24 31 39 22 2c 20 22 24 "$18", "$19", "$
0fa0: 32 30 22 2c 20 22 24 32 31 22 2c 0a 09 09 09 09 20", "$21",.....
0fb0: 20 20 20 20 20 22 24 66 31 36 22 2c 22 24 66 31 "$f16","$f1
0fc0: 37 22 2c 22 24 66 31 38 22 2c 22 24 66 31 39 22 7","$f18","$f19"
0fd0: 2c 22 24 66 32 30 22 2c 22 24 66 32 31 22 29 3b ,"$f20","$f21");
0fe0: 0a 0a 20 20 2f 2a 20 73 61 76 65 20 72 65 74 75 .. /* save retu
0ff0: 72 6e 20 76 61 6c 75 65 20 2a 2f 0a 20 20 69 66 rn value */. if
1000: 20 28 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 5f 5f (l->rtype == __
1010: 41 56 76 6f 69 64 29 20 7b 0a 20 20 7d 20 65 6c AVvoid) {. } el
1020: 73 65 0a 20 20 69 66 20 28 6c 2d 3e 72 74 79 70 se. if (l->rtyp
1030: 65 20 3d 3d 20 5f 5f 41 56 77 6f 72 64 29 20 7b e == __AVword) {
1040: 0a 20 20 20 20 52 45 54 55 52 4e 28 5f 5f 61 76 . RETURN(__av
1050: 77 6f 72 64 2c 20 69 29 3b 0a 20 20 7d 20 65 6c word, i);. } el
1060: 73 65 0a 20 20 69 66 20 28 6c 2d 3e 72 74 79 70 se. if (l->rtyp
1070: 65 20 3d 3d 20 5f 5f 41 56 63 68 61 72 29 20 7b e == __AVchar) {
1080: 0a 20 20 20 20 52 45 54 55 52 4e 28 63 68 61 72 . RETURN(char
1090: 2c 20 69 29 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 , i);. } else.
10a0: 20 69 66 20 28 6c 2d 3e 72 74 79 70 65 20 3d 3d if (l->rtype ==
10b0: 20 5f 5f 41 56 73 63 68 61 72 29 20 7b 0a 20 20 __AVschar) {.
10c0: 20 20 52 45 54 55 52 4e 28 73 69 67 6e 65 64 20 RETURN(signed
10d0: 63 68 61 72 2c 20 69 29 3b 0a 20 20 7d 20 65 6c char, i);. } el
10e0: 73 65 0a 20 20 69 66 20 28 6c 2d 3e 72 74 79 70 se. if (l->rtyp
10f0: 65 20 3d 3d 20 5f 5f 41 56 75 63 68 61 72 29 20 e == __AVuchar)
1100: 7b 0a 20 20 20 20 52 45 54 55 52 4e 28 75 6e 73 {. RETURN(uns
1110: 69 67 6e 65 64 20 63 68 61 72 2c 20 69 29 3b 0a igned char, i);.
1120: 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c } else. if (l
1130: 2d 3e 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56 73 ->rtype == __AVs
1140: 68 6f 72 74 29 20 7b 0a 20 20 20 20 52 45 54 55 hort) {. RETU
1150: 52 4e 28 73 68 6f 72 74 2c 20 69 29 3b 0a 20 20 RN(short, i);.
1160: 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c 2d 3e } else. if (l->
1170: 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56 75 73 68 rtype == __AVush
1180: 6f 72 74 29 20 7b 0a 20 20 20 20 52 45 54 55 52 ort) {. RETUR
1190: 4e 28 75 6e 73 69 67 6e 65 64 20 73 68 6f 72 74 N(unsigned short
11a0: 2c 20 69 29 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 , i);. } else.
11b0: 20 69 66 20 28 6c 2d 3e 72 74 79 70 65 20 3d 3d if (l->rtype ==
11c0: 20 5f 5f 41 56 69 6e 74 29 20 7b 0a 20 20 20 20 __AVint) {.
11d0: 52 45 54 55 52 4e 28 69 6e 74 2c 20 69 29 3b 0a RETURN(int, i);.
11e0: 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c } else. if (l
11f0: 2d 3e 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56 75 ->rtype == __AVu
1200: 69 6e 74 29 20 7b 0a 20 20 20 20 52 45 54 55 52 int) {. RETUR
1210: 4e 28 75 6e 73 69 67 6e 65 64 20 69 6e 74 2c 20 N(unsigned int,
1220: 69 29 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 i);. } else. i
1230: 66 20 28 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 5f f (l->rtype == _
1240: 5f 41 56 6c 6f 6e 67 29 20 7b 0a 20 20 20 20 52 _AVlong) {. R
1250: 45 54 55 52 4e 28 6c 6f 6e 67 2c 20 69 29 3b 0a ETURN(long, i);.
1260: 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c } else. if (l
1270: 2d 3e 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56 75 ->rtype == __AVu
1280: 6c 6f 6e 67 29 20 7b 0a 20 20 20 20 52 45 54 55 long) {. RETU
1290: 52 4e 28 75 6e 73 69 67 6e 65 64 20 6c 6f 6e 67 RN(unsigned long
12a0: 2c 20 69 29 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 , i);. } else.
12b0: 20 69 66 20 28 6c 2d 3e 72 74 79 70 65 20 3d 3d if (l->rtype ==
12c0: 20 5f 5f 41 56 6c 6f 6e 67 6c 6f 6e 67 29 20 7b __AVlonglong) {
12d0: 0a 20 20 20 20 52 45 54 55 52 4e 28 6c 6f 6e 67 . RETURN(long
12e0: 20 6c 6f 6e 67 2c 20 69 29 3b 0a 20 20 7d 20 65 long, i);. } e
12f0: 6c 73 65 0a 20 20 69 66 20 28 6c 2d 3e 72 74 79 lse. if (l->rty
1300: 70 65 20 3d 3d 20 5f 5f 41 56 75 6c 6f 6e 67 6c pe == __AVulongl
1310: 6f 6e 67 29 20 7b 0a 20 20 20 20 52 45 54 55 52 ong) {. RETUR
1320: 4e 28 75 6e 73 69 67 6e 65 64 20 6c 6f 6e 67 20 N(unsigned long
1330: 6c 6f 6e 67 2c 20 69 29 3b 0a 20 20 7d 20 65 6c long, i);. } el
1340: 73 65 0a 20 20 69 66 20 28 6c 2d 3e 72 74 79 70 se. if (l->rtyp
1350: 65 20 3d 3d 20 5f 5f 41 56 66 6c 6f 61 74 29 20 e == __AVfloat)
1360: 7b 0a 20 20 20 20 52 45 54 55 52 4e 28 66 6c 6f {. RETURN(flo
1370: 61 74 2c 20 66 72 65 74 29 3b 0a 20 20 7d 20 65 at, fret);. } e
1380: 6c 73 65 0a 20 20 69 66 20 28 6c 2d 3e 72 74 79 lse. if (l->rty
1390: 70 65 20 3d 3d 20 5f 5f 41 56 64 6f 75 62 6c 65 pe == __AVdouble
13a0: 29 20 7b 0a 20 20 20 20 52 45 54 55 52 4e 28 64 ) {. RETURN(d
13b0: 6f 75 62 6c 65 2c 20 66 72 65 74 29 3b 0a 20 20 ouble, fret);.
13c0: 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c 2d 3e } else. if (l->
13d0: 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56 76 6f 69 rtype == __AVvoi
13e0: 64 70 29 20 7b 0a 20 20 20 20 52 45 54 55 52 4e dp) {. RETURN
13f0: 28 76 6f 69 64 2a 2c 20 69 29 3b 0a 20 20 7d 20 (void*, i);. }
1400: 65 6c 73 65 0a 20 20 69 66 20 28 6c 2d 3e 72 74 else. if (l->rt
1410: 79 70 65 20 3d 3d 20 5f 5f 41 56 73 74 72 75 63 ype == __AVstruc
1420: 74 29 20 7b 0a 20 20 20 20 69 66 20 28 6c 2d 3e t) {. if (l->
1430: 66 6c 61 67 73 20 26 20 5f 5f 41 56 5f 50 43 43 flags & __AV_PCC
1440: 5f 53 54 52 55 43 54 5f 52 45 54 55 52 4e 29 20 _STRUCT_RETURN)
1450: 7b 0a 20 20 20 20 20 20 2f 2a 20 70 63 63 20 73 {. /* pcc s
1460: 74 72 75 63 74 20 72 65 74 75 72 6e 20 63 6f 6e truct return con
1470: 76 65 6e 74 69 6f 6e 3a 20 6e 65 65 64 20 61 20 vention: need a
1480: 20 2a 28 54 59 50 45 2a 29 6c 2d 3e 72 61 64 64 *(TYPE*)l->radd
1490: 72 20 3d 20 2a 28 54 59 50 45 2a 29 69 3b 20 20 r = *(TYPE*)i;
14a0: 2a 2f 0a 20 20 20 20 20 20 69 66 20 28 6c 2d 3e */. if (l->
14b0: 72 73 69 7a 65 20 3d 3d 20 73 69 7a 65 6f 66 28 rsize == sizeof(
14c0: 63 68 61 72 29 29 20 7b 0a 20 20 20 20 20 20 20 char)) {.
14d0: 20 52 45 54 55 52 4e 28 63 68 61 72 2c 20 2a 28 RETURN(char, *(
14e0: 63 68 61 72 2a 29 69 29 3b 0a 20 20 20 20 20 20 char*)i);.
14f0: 7d 20 65 6c 73 65 0a 20 20 20 20 20 20 69 66 20 } else. if
1500: 28 6c 2d 3e 72 73 69 7a 65 20 3d 3d 20 73 69 7a (l->rsize == siz
1510: 65 6f 66 28 73 68 6f 72 74 29 29 20 7b 0a 20 20 eof(short)) {.
1520: 20 20 20 20 20 20 52 45 54 55 52 4e 28 73 68 6f RETURN(sho
1530: 72 74 2c 20 2a 28 73 68 6f 72 74 2a 29 69 29 3b rt, *(short*)i);
1540: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 0a 20 20 . } else.
1550: 20 20 20 20 69 66 20 28 6c 2d 3e 72 73 69 7a 65 if (l->rsize
1560: 20 3d 3d 20 73 69 7a 65 6f 66 28 69 6e 74 29 29 == sizeof(int))
1570: 20 7b 0a 20 20 20 20 20 20 20 20 52 45 54 55 52 {. RETUR
1580: 4e 28 69 6e 74 2c 20 2a 28 69 6e 74 2a 29 69 29 N(int, *(int*)i)
1590: 3b 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 0a 20 ;. } else.
15a0: 20 20 20 20 20 69 66 20 28 6c 2d 3e 72 73 69 7a if (l->rsiz
15b0: 65 20 3d 3d 20 73 69 7a 65 6f 66 28 6c 6f 6e 67 e == sizeof(long
15c0: 29 29 20 7b 0a 20 20 20 20 20 20 20 20 52 45 54 )) {. RET
15d0: 55 52 4e 28 6c 6f 6e 67 2c 20 2a 28 6c 6f 6e 67 URN(long, *(long
15e0: 2a 29 69 29 3b 0a 20 20 20 20 20 20 7d 20 65 6c *)i);. } el
15f0: 73 65 20 7b 0a 20 20 20 20 20 20 20 20 69 6e 74 se {. int
1600: 20 6e 20 3d 20 28 6c 2d 3e 72 73 69 7a 65 20 2b n = (l->rsize +
1610: 20 73 69 7a 65 6f 66 28 5f 5f 61 76 77 6f 72 64 sizeof(__avword
1620: 29 2d 31 29 2f 73 69 7a 65 6f 66 28 5f 5f 61 76 )-1)/sizeof(__av
1630: 77 6f 72 64 29 3b 0a 20 20 20 20 20 20 20 20 77 word);. w
1640: 68 69 6c 65 20 28 2d 2d 6e 20 3e 3d 20 30 29 0a hile (--n >= 0).
1650: 20 20 20 20 20 20 20 20 20 20 28 28 5f 5f 61 76 ((__av
1660: 77 6f 72 64 2a 29 6c 2d 3e 72 61 64 64 72 29 5b word*)l->raddr)[
1670: 6e 5d 20 3d 20 28 28 5f 5f 61 76 77 6f 72 64 2a n] = ((__avword*
1680: 29 69 29 5b 6e 5d 3b 0a 20 20 20 20 20 20 7d 0a )i)[n];. }.
1690: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 } else {.
16a0: 20 20 20 2f 2a 20 6e 6f 72 6d 61 6c 20 73 74 72 /* normal str
16b0: 75 63 74 20 72 65 74 75 72 6e 20 63 6f 6e 76 65 uct return conve
16c0: 6e 74 69 6f 6e 20 2a 2f 0a 20 20 20 20 20 20 69 ntion */. i
16d0: 66 20 28 6c 2d 3e 66 6c 61 67 73 20 26 20 5f 5f f (l->flags & __
16e0: 41 56 5f 52 45 47 49 53 54 45 52 5f 53 54 52 55 AV_REGISTER_STRU
16f0: 43 54 5f 52 45 54 55 52 4e 29 20 7b 0a 20 20 20 CT_RETURN) {.
1700: 20 20 20 20 20 69 66 20 28 6c 2d 3e 72 73 69 7a if (l->rsiz
1710: 65 20 3d 3d 20 73 69 7a 65 6f 66 28 63 68 61 72 e == sizeof(char
1720: 29 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 52 )) {. R
1730: 45 54 55 52 4e 28 63 68 61 72 2c 20 69 29 3b 0a ETURN(char, i);.
1740: 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 0a 20 } else.
1750: 20 20 20 20 20 20 20 69 66 20 28 6c 2d 3e 72 73 if (l->rs
1760: 69 7a 65 20 3d 3d 20 73 69 7a 65 6f 66 28 73 68 ize == sizeof(sh
1770: 6f 72 74 29 29 20 7b 0a 20 20 20 20 20 20 20 20 ort)) {.
1780: 20 20 52 45 54 55 52 4e 28 73 68 6f 72 74 2c 20 RETURN(short,
1790: 69 29 3b 0a 20 20 20 20 20 20 20 20 7d 20 65 6c i);. } el
17a0: 73 65 0a 20 20 20 20 20 20 20 20 69 66 20 28 6c se. if (l
17b0: 2d 3e 72 73 69 7a 65 20 3d 3d 20 73 69 7a 65 6f ->rsize == sizeo
17c0: 66 28 69 6e 74 29 29 20 7b 0a 20 20 20 20 20 20 f(int)) {.
17d0: 20 20 20 20 52 45 54 55 52 4e 28 69 6e 74 2c 20 RETURN(int,
17e0: 69 29 3b 0a 20 20 20 20 20 20 20 20 7d 20 65 6c i);. } el
17f0: 73 65 0a 20 20 20 20 20 20 20 20 69 66 20 28 6c se. if (l
1800: 2d 3e 72 73 69 7a 65 20 3d 3d 20 73 69 7a 65 6f ->rsize == sizeo
1810: 66 28 6c 6f 6e 67 29 29 20 7b 0a 20 20 20 20 20 f(long)) {.
1820: 20 20 20 20 20 52 45 54 55 52 4e 28 6c 6f 6e 67 RETURN(long
1830: 2c 20 69 29 3b 0a 20 20 20 20 20 20 20 20 7d 20 , i);. }
1840: 65 6c 73 65 0a 20 20 20 20 20 20 20 20 69 66 20 else. if
1850: 28 6c 2d 3e 72 73 69 7a 65 20 3d 3d 20 32 2a 73 (l->rsize == 2*s
1860: 69 7a 65 6f 66 28 5f 5f 61 76 77 6f 72 64 29 29 izeof(__avword))
1870: 20 7b 0a 20 20 20 20 20 20 20 20 20 20 28 28 5f {. ((_
1880: 5f 61 76 77 6f 72 64 2a 29 6c 2d 3e 72 61 64 64 _avword*)l->radd
1890: 72 29 5b 30 5d 20 3d 20 69 3b 0a 20 20 20 20 20 r)[0] = i;.
18a0: 20 20 20 20 20 28 28 5f 5f 61 76 77 6f 72 64 2a ((__avword*
18b0: 29 6c 2d 3e 72 61 64 64 72 29 5b 31 5d 20 3d 20 )l->raddr)[1] =
18c0: 69 32 3b 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 i2;. }.
18d0: 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a }. }. }.
18e0: 20 20 72 65 74 75 72 6e 20 30 3b 0a 7d 0a 0a 23 return 0;.}..#
18f0: 65 6e 64 69 66 20 2f 2a 5f 61 76 63 61 6c 6c 5f endif /*_avcall_
1900: 61 6c 70 68 61 5f 63 20 2a 2f 0a alpha_c */.