Artifact
367866faaf3f8c96e8284a7ece91f5154edb2eec:
0000: 23 69 66 6e 64 65 66 20 5f 61 76 63 61 6c 6c 5f #ifndef _avcall_
0010: 6d 69 70 73 5f 63 09 09 09 09 2f 2a 2d 2a 2d 20 mips_c..../*-*-
0020: 43 20 2d 2a 2d 2a 2f 0a 23 64 65 66 69 6e 65 20 C -*-*/.#define
0030: 5f 61 76 63 61 6c 6c 5f 6d 69 70 73 5f 63 0a 2f _avcall_mips_c./
0040: 2a 2a 0a 20 20 43 6f 70 79 72 69 67 68 74 20 31 **. Copyright 1
0050: 39 39 33 20 42 69 6c 6c 20 54 72 69 67 67 73 2c 993 Bill Triggs,
0060: 20 3c 42 69 6c 6c 2e 54 72 69 67 67 73 40 69 6e <Bill.Triggs@in
0070: 72 69 61 6c 70 65 73 2e 66 72 3e 0a 20 20 43 6f rialpes.fr>. Co
0080: 70 79 72 69 67 68 74 20 31 39 39 35 2d 31 39 39 pyright 1995-199
0090: 39 20 42 72 75 6e 6f 20 48 61 69 62 6c 65 2c 20 9 Bruno Haible,
00a0: 3c 62 72 75 6e 6f 40 63 6c 69 73 70 2e 6f 72 67 <bruno@clisp.org
00b0: 3e 0a 0a 20 20 54 68 69 73 20 69 73 20 66 72 65 >.. This is fre
00c0: 65 20 73 6f 66 74 77 61 72 65 20 64 69 73 74 72 e software distr
00d0: 69 62 75 74 65 64 20 75 6e 64 65 72 20 74 68 65 ibuted under the
00e0: 20 47 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62 GNU General Pub
00f0: 6c 69 63 0a 20 20 4c 69 63 65 6e 63 65 20 64 65 lic. Licence de
0100: 73 63 72 69 62 65 64 20 69 6e 20 74 68 65 20 66 scribed in the f
0110: 69 6c 65 20 43 4f 50 59 49 4e 47 2e 20 43 6f 6e ile COPYING. Con
0120: 74 61 63 74 20 74 68 65 20 61 75 74 68 6f 72 20 tact the author
0130: 69 66 0a 20 20 79 6f 75 20 64 6f 6e 27 74 20 68 if. you don't h
0140: 61 76 65 20 74 68 69 73 20 6f 72 20 63 61 6e 27 ave this or can'
0150: 74 20 6c 69 76 65 20 77 69 74 68 20 69 74 2e 20 t live with it.
0160: 54 68 65 72 65 20 69 73 20 41 42 53 4f 4c 55 54 There is ABSOLUT
0170: 45 4c 59 0a 20 20 4e 4f 20 57 41 52 52 41 4e 54 ELY. NO WARRANT
0180: 59 2c 20 65 78 70 6c 69 63 69 74 20 6f 72 20 69 Y, explicit or i
0190: 6d 70 6c 69 65 64 2c 20 6f 6e 20 74 68 69 73 20 mplied, on this
01a0: 73 6f 66 74 77 61 72 65 2e 0a 2a 2a 2f 0a 2f 2a software..**/./*
01b0: 2d 2d 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 0a 20 20 21 21 21 20 54 48 49 ------. !!! THI
0200: 53 20 52 4f 55 54 49 4e 45 20 4d 55 53 54 20 42 S ROUTINE MUST B
0210: 45 20 43 4f 4d 50 49 4c 45 44 20 67 63 63 20 2d E COMPILED gcc -
0220: 4f 20 21 21 21 0a 0a 20 20 46 6f 72 65 69 67 6e O !!!.. Foreign
0230: 20 66 75 6e 63 74 69 6f 6e 20 69 6e 74 65 72 66 function interf
0240: 61 63 65 20 66 6f 72 20 61 6e 20 53 47 49 20 4d ace for an SGI M
0250: 49 50 53 20 77 69 74 68 20 67 63 63 2f 73 67 69 IPS with gcc/sgi
0260: 2d 63 63 2e 0a 0a 20 20 54 68 69 73 20 63 61 6c -cc... This cal
0270: 6c 73 20 61 20 43 20 66 75 6e 63 74 69 6f 6e 20 ls a C function
0280: 77 69 74 68 20 61 6e 20 61 72 67 75 6d 65 6e 74 with an argument
0290: 20 6c 69 73 74 20 62 75 69 6c 74 20 75 70 20 75 list built up u
02a0: 73 69 6e 67 20 6d 61 63 72 6f 73 0a 20 20 64 65 sing macros. de
02b0: 66 69 6e 65 64 20 69 6e 20 61 76 5f 63 61 6c 6c fined in av_call
02c0: 2e 68 2e 0a 0a 20 20 53 47 49 20 4d 49 50 53 20 .h... SGI MIPS
02d0: 41 72 67 75 6d 65 6e 74 20 50 61 73 73 69 6e 67 Argument Passing
02e0: 20 43 6f 6e 76 65 6e 74 69 6f 6e 73 0a 0a 20 20 Conventions..
02f0: 2d 20 54 68 65 20 65 6e 74 69 72 65 20 61 72 67 - The entire arg
0300: 75 6d 65 6e 74 20 6c 69 73 74 20 66 6f 72 6d 73 ument list forms
0310: 20 61 20 73 74 72 75 63 74 75 72 65 20 77 69 74 a structure wit
0320: 68 20 61 6c 6c 20 74 68 65 20 61 70 70 72 6f 70 h all the approp
0330: 72 69 61 74 65 0a 20 20 20 20 68 6f 6c 65 73 20 riate. holes
0340: 26 20 61 6c 69 67 6e 6d 65 6e 74 73 2c 20 61 6e & alignments, an
0350: 64 20 73 70 61 63 65 20 66 6f 72 20 74 68 69 73 d space for this
0360: 20 69 73 20 61 6c 6c 6f 63 61 74 65 64 20 69 6e is allocated in
0370: 20 74 68 65 20 73 74 61 63 6b 20 66 72 61 6d 65 the stack frame
0380: 2e 0a 20 20 2d 20 53 68 6f 72 74 65 72 20 69 6e .. - Shorter in
0390: 74 65 67 65 72 73 20 61 72 65 20 70 72 6f 6d 6f tegers are promo
03a0: 74 65 64 20 74 6f 20 77 6f 72 64 20 6c 65 6e 67 ted to word leng
03b0: 74 68 20 28 73 69 7a 65 6f 66 28 69 6e 74 29 3d th (sizeof(int)=
03c0: 73 69 7a 65 6f 66 28 6c 6f 6e 67 29 3d 34 29 2e sizeof(long)=4).
03d0: 0a 20 20 2d 20 44 6f 75 62 6c 65 73 20 61 72 65 . - Doubles are
03e0: 20 32 20 77 6f 72 64 73 20 61 6c 69 67 6e 65 64 2 words aligned
03f0: 20 6f 6e 20 65 76 65 6e 20 62 6f 75 6e 64 61 72 on even boundar
0400: 69 65 73 2e 0a 20 20 2d 20 54 68 65 20 66 69 72 ies.. - The fir
0410: 73 74 20 34 20 77 6f 72 64 73 20 6f 66 20 74 68 st 4 words of th
0420: 65 20 73 74 72 75 63 74 75 72 65 20 61 72 65 20 e structure are
0430: 70 61 73 73 65 64 20 69 6e 20 72 65 67 69 73 74 passed in regist
0440: 65 72 73 20 24 34 2e 2e 2e 24 37 2c 20 73 74 61 ers $4...$7, sta
0450: 63 6b 0a 20 20 20 20 73 70 61 63 65 20 66 6f 72 ck. space for
0460: 20 74 68 65 73 65 20 69 73 20 61 6c 77 61 79 73 these is always
0470: 20 61 6c 6c 6f 63 61 74 65 64 2e 20 52 65 6d 61 allocated. Rema
0480: 69 6e 69 6e 67 20 77 6f 72 64 73 20 61 72 65 20 ining words are
0490: 70 61 73 73 65 64 20 6f 6e 20 74 68 65 0a 20 20 passed on the.
04a0: 20 20 73 74 61 63 6b 2e 0a 20 20 2d 20 49 66 20 stack.. - If
04b0: 74 68 65 20 66 69 72 73 74 20 74 77 6f 20 61 72 the first two ar
04c0: 67 73 20 61 72 65 20 66 6c 6f 61 74 73 20 6f 72 gs are floats or
04d0: 20 64 6f 75 62 6c 65 73 2c 20 74 68 65 79 20 61 doubles, they a
04e0: 72 65 20 61 6c 73 6f 20 70 61 73 73 65 64 20 69 re also passed i
04f0: 6e 20 24 66 31 32 0a 20 20 20 20 61 6e 64 20 24 n $f12. and $
0500: 66 31 34 2e 20 42 75 74 20 76 61 72 61 72 67 73 f14. But varargs
0510: 20 66 75 6e 63 74 69 6f 6e 73 20 77 69 6c 6c 20 functions will
0520: 65 78 70 65 63 74 20 74 68 65 6d 20 69 6e 20 74 expect them in t
0530: 68 65 20 69 6e 74 65 67 65 72 20 72 65 67 69 73 he integer regis
0540: 74 65 72 73 0a 20 20 20 20 61 6e 64 20 77 65 20 ters. and we
0550: 63 61 6e 27 74 20 74 65 6c 6c 20 77 68 65 74 68 can't tell wheth
0560: 65 72 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 er the function
0570: 69 73 20 76 61 72 61 72 67 73 20 73 6f 20 77 65 is varargs so we
0580: 20 70 61 73 73 20 74 68 65 6d 20 62 6f 74 68 20 pass them both
0590: 77 61 79 73 2e 0a 20 20 2d 20 53 74 72 75 63 74 ways.. - Struct
05a0: 75 72 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72 ure arguments ar
05b0: 65 20 63 6f 70 69 65 73 20 65 6d 62 65 64 64 65 e copies embedde
05c0: 64 20 69 6e 20 74 68 65 20 61 72 67 6c 69 73 74 d in the arglist
05d0: 20 73 74 72 75 63 74 75 72 65 2e 0a 20 20 2d 20 structure.. -
05e0: 53 74 72 75 63 74 75 72 65 20 72 65 74 75 72 6e Structure return
05f0: 73 20 61 72 65 20 70 6f 69 6e 74 65 72 73 20 74 s are pointers t
0600: 6f 20 63 61 6c 6c 65 72 2d 61 6c 6c 6f 63 61 74 o caller-allocat
0610: 65 64 20 73 70 61 63 65 20 70 61 73 73 65 64 20 ed space passed
0620: 69 6e 20 61 73 20 74 68 65 0a 20 20 20 20 66 69 in as the. fi
0630: 72 73 74 20 61 72 67 75 6d 65 6e 74 20 6f 66 20 rst argument of
0640: 74 68 65 20 6c 69 73 74 2e 20 54 68 65 20 66 75 the list. The fu
0650: 6e 63 74 69 6f 6e 20 61 6c 73 6f 20 72 65 74 75 nction also retu
0660: 72 6e 73 20 74 68 65 20 70 6f 69 6e 74 65 72 2e rns the pointer.
0670: 0a 20 20 2d 20 49 6e 74 65 67 65 72 2f 70 6f 69 . - Integer/poi
0680: 6e 74 65 72 20 72 65 74 75 72 6e 73 20 61 72 65 nter returns are
0690: 20 69 6e 20 24 32 2c 20 66 6c 6f 61 74 2f 64 6f in $2, float/do
06a0: 75 62 6c 65 20 72 65 74 75 72 6e 73 20 69 6e 20 uble returns in
06b0: 24 66 30 2e 0a 20 20 2d 20 55 6e 64 65 72 20 49 $f0.. - Under I
06c0: 52 49 58 20 35 2c 20 74 68 65 20 63 61 6c 6c 65 RIX 5, the calle
06d0: 64 20 66 75 6e 63 74 69 6f 6e 20 65 78 70 65 63 d function expec
06e0: 74 73 20 74 6f 20 73 65 65 20 69 74 73 20 6f 77 ts to see its ow
06f0: 6e 20 61 64 64 72 65 73 73 20 69 6e 20 24 32 35 n address in $25
0700: 2e 0a 0a 20 20 54 68 69 73 20 66 69 6c 65 20 6e ... This file n
0710: 65 65 64 73 20 74 6f 20 62 65 20 63 6f 6d 70 69 eeds to be compi
0720: 6c 65 64 20 77 69 74 68 20 67 63 63 20 66 6f 72 led with gcc for
0730: 20 74 68 65 20 61 73 6d 20 65 78 74 65 6e 73 69 the asm extensi
0740: 6f 6e 73 2c 20 62 75 74 20 74 68 65 0a 20 20 61 ons, but the. a
0750: 73 73 65 6d 62 6c 79 20 76 65 72 73 69 6f 6e 20 ssembly version
0760: 6f 66 20 69 74 20 61 6e 64 20 74 68 65 20 68 65 of it and the he
0770: 61 64 65 72 20 66 69 6c 65 20 73 65 65 6d 20 74 ader file seem t
0780: 6f 20 77 6f 72 6b 20 77 69 74 68 20 53 47 49 20 o work with SGI
0790: 63 63 2e 0a 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d cc.. ----------
07a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
07b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
07c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
07d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2a 2f 0a 23 ------------*/.#
07e0: 69 6e 63 6c 75 64 65 20 22 61 76 63 61 6c 6c 2e include "avcall.
07f0: 68 2e 69 6e 22 0a 0a 23 64 65 66 69 6e 65 20 52 h.in"..#define R
0800: 45 54 55 52 4e 28 54 59 50 45 2c 56 41 4c 29 09 ETURN(TYPE,VAL).
0810: 28 2a 28 54 59 50 45 2a 29 6c 2d 3e 72 61 64 64 (*(TYPE*)l->radd
0820: 72 20 3d 20 28 54 59 50 45 29 28 56 41 4c 29 29 r = (TYPE)(VAL))
0830: 0a 23 64 65 66 69 6e 65 20 4f 46 46 53 45 54 4f .#define OFFSETO
0840: 46 28 73 74 72 75 63 74 2c 6d 65 6d 62 65 72 29 F(struct,member)
0850: 20 28 28 69 6e 74 29 26 28 28 28 73 74 72 75 63 ((int)&(((struc
0860: 74 2a 29 30 29 2d 3e 6d 65 6d 62 65 72 29 29 0a t*)0)->member)).
0870: 0a 74 79 70 65 64 65 66 20 5f 5f 61 76 77 6f 72 .typedef __avwor
0880: 64 20 28 2a 66 75 6e 63 5f 70 6f 69 6e 74 65 72 d (*func_pointer
0890: 29 28 29 3b 0a 72 65 67 69 73 74 65 72 20 66 75 )();.register fu
08a0: 6e 63 5f 70 6f 69 6e 74 65 72 09 74 39 09 5f 5f nc_pointer.t9.__
08b0: 61 73 6d 5f 5f 28 22 24 32 35 22 29 3b 0a 0a 69 asm__("$25");..i
08c0: 6e 74 0a 5f 5f 62 75 69 6c 74 69 6e 5f 61 76 63 nt.__builtin_avc
08d0: 61 6c 6c 28 61 76 5f 61 6c 69 73 74 2a 20 6c 29 all(av_alist* l)
08e0: 0a 7b 0a 20 20 72 65 67 69 73 74 65 72 20 5f 5f .{. register __
08f0: 61 76 77 6f 72 64 2a 09 73 70 09 5f 5f 61 73 6d avword*.sp.__asm
0900: 5f 5f 28 22 24 73 70 22 29 3b 20 20 2f 2a 20 43 __("$sp"); /* C
0910: 20 6e 61 6d 65 73 20 66 6f 72 20 72 65 67 69 73 names for regis
0920: 74 65 72 73 20 2a 2f 0a 20 20 72 65 67 69 73 74 ters */. regist
0930: 65 72 20 5f 5f 61 76 77 6f 72 64 09 69 72 65 74 er __avword.iret
0940: 32 09 5f 5f 61 73 6d 5f 5f 28 22 24 33 22 29 3b 2.__asm__("$3");
0950: 0a 20 20 72 65 67 69 73 74 65 72 20 66 6c 6f 61 . register floa
0960: 74 09 66 72 65 74 09 5f 5f 61 73 6d 5f 5f 28 22 t.fret.__asm__("
0970: 24 66 30 22 29 3b 0a 20 20 72 65 67 69 73 74 65 $f0");. registe
0980: 72 20 64 6f 75 62 6c 65 09 64 72 65 74 09 5f 5f r double.dret.__
0990: 61 73 6d 5f 5f 28 22 24 66 30 22 29 3b 0a 20 20 asm__("$f0");.
09a0: 5f 5f 61 76 77 6f 72 64 20 2a 73 70 61 63 65 20 __avword *space
09b0: 3d 20 5f 5f 62 75 69 6c 74 69 6e 5f 61 6c 6c 6f = __builtin_allo
09c0: 63 61 28 5f 5f 41 56 5f 41 4c 49 53 54 5f 57 4f ca(__AV_ALIST_WO
09d0: 52 44 53 20 2a 20 73 69 7a 65 6f 66 28 5f 5f 61 RDS * sizeof(__a
09e0: 76 77 6f 72 64 29 29 3b 09 2f 2a 20 62 69 67 20 vword));./* big
09f0: 73 70 61 63 65 20 66 6f 72 20 63 68 69 6c 64 27 space for child'
0a00: 73 20 73 74 61 63 6b 20 66 72 61 6d 65 20 2a 2f s stack frame */
0a10: 0a 20 20 5f 5f 61 76 77 6f 72 64 20 2a 61 72 67 . __avword *arg
0a20: 66 72 61 6d 65 20 3d 20 28 5f 5f 61 76 77 6f 72 frame = (__avwor
0a30: 64 2a 29 73 70 3b 09 2f 2a 20 73 74 61 63 6b 20 d*)sp;./* stack
0a40: 6f 66 66 73 65 74 20 66 6f 72 20 61 72 67 75 6d offset for argum
0a50: 65 6e 74 20 6c 69 73 74 20 69 73 20 30 20 2a 2f ent list is 0 */
0a60: 0a 20 20 69 6e 74 20 61 72 67 6c 65 6e 20 3d 20 . int arglen =
0a70: 6c 2d 3e 61 70 74 72 20 2d 20 6c 2d 3e 61 72 67 l->aptr - l->arg
0a80: 73 3b 0a 20 20 5f 5f 61 76 77 6f 72 64 20 69 3b s;. __avword i;
0a90: 0a 0a 20 20 69 66 20 28 6c 2d 3e 66 6c 61 67 73 .. if (l->flags
0aa0: 20 26 20 5f 5f 41 56 5f 46 4c 4f 41 54 5f 31 29 & __AV_FLOAT_1)
0ab0: 09 09 2f 2a 20 70 75 73 68 20 6c 65 61 64 69 6e ../* push leadin
0ac0: 67 20 66 6c 6f 61 74 20 61 72 67 73 20 2a 2f 0a g float args */.
0ad0: 20 20 7b 0a 20 20 20 20 5f 5f 61 73 6d 5f 5f 28 {. __asm__(
0ae0: 22 6c 2e 64 20 24 66 31 32 2c 25 31 28 25 30 29 "l.d $f12,%1(%0)
0af0: 22 20 3a 20 3a 20 22 70 22 20 28 6c 29 2c 20 22 " : : "p" (l), "
0b00: 69 22 20 4f 46 46 53 45 54 4f 46 28 61 76 5f 61 i" OFFSETOF(av_a
0b10: 6c 69 73 74 2c 66 6c 6f 61 74 61 72 67 5b 30 5d list,floatarg[0]
0b20: 29 29 3b 0a 20 20 20 20 69 66 20 28 6c 2d 3e 66 ));. if (l->f
0b30: 6c 61 67 73 20 26 20 5f 5f 41 56 5f 46 4c 4f 41 lags & __AV_FLOA
0b40: 54 5f 32 29 0a 20 20 20 20 20 20 5f 5f 61 73 6d T_2). __asm
0b50: 5f 5f 28 22 6c 2e 64 20 24 66 31 34 2c 25 31 28 __("l.d $f14,%1(
0b60: 25 30 29 22 20 3a 20 3a 20 22 70 22 20 28 6c 29 %0)" : : "p" (l)
0b70: 2c 20 22 69 22 20 4f 46 46 53 45 54 4f 46 28 61 , "i" OFFSETOF(a
0b80: 76 5f 61 6c 69 73 74 2c 66 6c 6f 61 74 61 72 67 v_alist,floatarg
0b90: 5b 31 5d 29 29 3b 0a 20 20 7d 0a 0a 20 20 66 6f [1]));. }.. fo
0ba0: 72 20 28 69 20 3d 20 34 3b 20 69 20 3c 20 61 72 r (i = 4; i < ar
0bb0: 67 6c 65 6e 3b 20 69 2b 2b 29 09 09 2f 2a 20 70 glen; i++)../* p
0bc0: 75 73 68 20 65 78 63 65 73 73 20 66 75 6e 63 74 ush excess funct
0bd0: 69 6f 6e 20 61 72 67 73 20 2a 2f 0a 20 20 20 20 ion args */.
0be0: 61 72 67 66 72 61 6d 65 5b 69 5d 20 3d 20 6c 2d argframe[i] = l-
0bf0: 3e 61 72 67 73 5b 69 5d 3b 0a 0a 20 20 69 20 3d >args[i];.. i =
0c00: 20 28 2a 28 74 39 20 3d 20 6c 2d 3e 66 75 6e 63 (*(t9 = l->func
0c10: 29 29 28 6c 2d 3e 61 72 67 73 5b 30 5d 2c 20 6c ))(l->args[0], l
0c20: 2d 3e 61 72 67 73 5b 31 5d 2c 20 20 2f 2a 20 63 ->args[1], /* c
0c30: 61 6c 6c 20 66 75 6e 63 74 69 6f 6e 20 77 69 74 all function wit
0c40: 68 20 31 73 74 20 34 20 61 72 67 73 20 2a 2f 0a h 1st 4 args */.
0c50: 09 09 09 6c 2d 3e 61 72 67 73 5b 32 5d 2c 20 6c ...l->args[2], l
0c60: 2d 3e 61 72 67 73 5b 33 5d 29 3b 0a 0a 20 20 2f ->args[3]);.. /
0c70: 2a 20 73 61 76 65 20 72 65 74 75 72 6e 20 76 61 * save return va
0c80: 6c 75 65 20 2a 2f 0a 20 20 69 66 20 28 6c 2d 3e lue */. if (l->
0c90: 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56 76 6f 69 rtype == __AVvoi
0ca0: 64 29 20 7b 0a 20 20 7d 20 65 6c 73 65 0a 20 20 d) {. } else.
0cb0: 69 66 20 28 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 if (l->rtype ==
0cc0: 5f 5f 41 56 77 6f 72 64 29 20 7b 0a 20 20 20 20 __AVword) {.
0cd0: 52 45 54 55 52 4e 28 5f 5f 61 76 77 6f 72 64 2c RETURN(__avword,
0ce0: 20 69 29 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 20 i);. } else.
0cf0: 69 66 20 28 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 if (l->rtype ==
0d00: 5f 5f 41 56 63 68 61 72 29 20 7b 0a 20 20 20 20 __AVchar) {.
0d10: 52 45 54 55 52 4e 28 63 68 61 72 2c 20 69 29 3b RETURN(char, i);
0d20: 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 . } else. if (
0d30: 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56 l->rtype == __AV
0d40: 73 63 68 61 72 29 20 7b 0a 20 20 20 20 52 45 54 schar) {. RET
0d50: 55 52 4e 28 73 69 67 6e 65 64 20 63 68 61 72 2c URN(signed char,
0d60: 20 69 29 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 20 i);. } else.
0d70: 69 66 20 28 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 if (l->rtype ==
0d80: 5f 5f 41 56 75 63 68 61 72 29 20 7b 0a 20 20 20 __AVuchar) {.
0d90: 20 52 45 54 55 52 4e 28 75 6e 73 69 67 6e 65 64 RETURN(unsigned
0da0: 20 63 68 61 72 2c 20 69 29 3b 0a 20 20 7d 20 65 char, i);. } e
0db0: 6c 73 65 0a 20 20 69 66 20 28 6c 2d 3e 72 74 79 lse. if (l->rty
0dc0: 70 65 20 3d 3d 20 5f 5f 41 56 73 68 6f 72 74 29 pe == __AVshort)
0dd0: 20 7b 0a 20 20 20 20 52 45 54 55 52 4e 28 73 68 {. RETURN(sh
0de0: 6f 72 74 2c 20 69 29 3b 0a 20 20 7d 20 65 6c 73 ort, i);. } els
0df0: 65 0a 20 20 69 66 20 28 6c 2d 3e 72 74 79 70 65 e. if (l->rtype
0e00: 20 3d 3d 20 5f 5f 41 56 75 73 68 6f 72 74 29 20 == __AVushort)
0e10: 7b 0a 20 20 20 20 52 45 54 55 52 4e 28 75 6e 73 {. RETURN(uns
0e20: 69 67 6e 65 64 20 73 68 6f 72 74 2c 20 69 29 3b igned short, i);
0e30: 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 . } else. if (
0e40: 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56 l->rtype == __AV
0e50: 69 6e 74 29 20 7b 0a 20 20 20 20 52 45 54 55 52 int) {. RETUR
0e60: 4e 28 69 6e 74 2c 20 69 29 3b 0a 20 20 7d 20 65 N(int, i);. } e
0e70: 6c 73 65 0a 20 20 69 66 20 28 6c 2d 3e 72 74 79 lse. if (l->rty
0e80: 70 65 20 3d 3d 20 5f 5f 41 56 75 69 6e 74 29 20 pe == __AVuint)
0e90: 7b 0a 20 20 20 20 52 45 54 55 52 4e 28 75 6e 73 {. RETURN(uns
0ea0: 69 67 6e 65 64 20 69 6e 74 2c 20 69 29 3b 0a 20 igned int, i);.
0eb0: 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c 2d } else. if (l-
0ec0: 3e 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56 6c 6f >rtype == __AVlo
0ed0: 6e 67 29 20 7b 0a 20 20 20 20 52 45 54 55 52 4e ng) {. RETURN
0ee0: 28 6c 6f 6e 67 2c 20 69 29 3b 0a 20 20 7d 20 65 (long, i);. } e
0ef0: 6c 73 65 0a 20 20 69 66 20 28 6c 2d 3e 72 74 79 lse. if (l->rty
0f00: 70 65 20 3d 3d 20 5f 5f 41 56 75 6c 6f 6e 67 29 pe == __AVulong)
0f10: 20 7b 0a 20 20 20 20 52 45 54 55 52 4e 28 75 6e {. RETURN(un
0f20: 73 69 67 6e 65 64 20 6c 6f 6e 67 2c 20 69 29 3b signed long, i);
0f30: 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 . } else. if (
0f40: 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56 l->rtype == __AV
0f50: 6c 6f 6e 67 6c 6f 6e 67 20 7c 7c 20 6c 2d 3e 72 longlong || l->r
0f60: 74 79 70 65 20 3d 3d 20 5f 5f 41 56 75 6c 6f 6e type == __AVulon
0f70: 67 6c 6f 6e 67 29 20 7b 0a 20 20 20 20 28 28 5f glong) {. ((_
0f80: 5f 61 76 77 6f 72 64 2a 29 6c 2d 3e 72 61 64 64 _avword*)l->radd
0f90: 72 29 5b 30 5d 20 3d 20 69 3b 0a 20 20 20 20 28 r)[0] = i;. (
0fa0: 28 5f 5f 61 76 77 6f 72 64 2a 29 6c 2d 3e 72 61 (__avword*)l->ra
0fb0: 64 64 72 29 5b 31 5d 20 3d 20 69 72 65 74 32 3b ddr)[1] = iret2;
0fc0: 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 . } else. if (
0fd0: 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56 l->rtype == __AV
0fe0: 66 6c 6f 61 74 29 20 7b 0a 20 20 20 20 52 45 54 float) {. RET
0ff0: 55 52 4e 28 66 6c 6f 61 74 2c 20 66 72 65 74 29 URN(float, fret)
1000: 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 ;. } else. if
1010: 28 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 5f 5f 41 (l->rtype == __A
1020: 56 64 6f 75 62 6c 65 29 20 7b 0a 20 20 20 20 52 Vdouble) {. R
1030: 45 54 55 52 4e 28 64 6f 75 62 6c 65 2c 20 64 72 ETURN(double, dr
1040: 65 74 29 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 20 et);. } else.
1050: 69 66 20 28 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 if (l->rtype ==
1060: 5f 5f 41 56 76 6f 69 64 70 29 20 7b 0a 20 20 20 __AVvoidp) {.
1070: 20 52 45 54 55 52 4e 28 76 6f 69 64 2a 2c 20 69 RETURN(void*, i
1080: 29 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 );. } else. if
1090: 20 28 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 5f 5f (l->rtype == __
10a0: 41 56 73 74 72 75 63 74 29 20 7b 0a 20 20 20 20 AVstruct) {.
10b0: 69 66 20 28 6c 2d 3e 66 6c 61 67 73 20 26 20 5f if (l->flags & _
10c0: 5f 41 56 5f 50 43 43 5f 53 54 52 55 43 54 5f 52 _AV_PCC_STRUCT_R
10d0: 45 54 55 52 4e 29 20 7b 0a 20 20 20 20 20 20 2f ETURN) {. /
10e0: 2a 20 70 63 63 20 73 74 72 75 63 74 20 72 65 74 * pcc struct ret
10f0: 75 72 6e 20 63 6f 6e 76 65 6e 74 69 6f 6e 3a 20 urn convention:
1100: 6e 65 65 64 20 61 20 20 2a 28 54 59 50 45 2a 29 need a *(TYPE*)
1110: 6c 2d 3e 72 61 64 64 72 20 3d 20 2a 28 54 59 50 l->raddr = *(TYP
1120: 45 2a 29 69 3b 20 20 2a 2f 0a 20 20 20 20 20 20 E*)i; */.
1130: 69 66 20 28 6c 2d 3e 72 73 69 7a 65 20 3d 3d 20 if (l->rsize ==
1140: 73 69 7a 65 6f 66 28 63 68 61 72 29 29 20 7b 0a sizeof(char)) {.
1150: 20 20 20 20 20 20 20 20 52 45 54 55 52 4e 28 63 RETURN(c
1160: 68 61 72 2c 20 2a 28 63 68 61 72 2a 29 69 29 3b har, *(char*)i);
1170: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 0a 20 20 . } else.
1180: 20 20 20 20 69 66 20 28 6c 2d 3e 72 73 69 7a 65 if (l->rsize
1190: 20 3d 3d 20 73 69 7a 65 6f 66 28 73 68 6f 72 74 == sizeof(short
11a0: 29 29 20 7b 0a 20 20 20 20 20 20 20 20 52 45 54 )) {. RET
11b0: 55 52 4e 28 73 68 6f 72 74 2c 20 2a 28 73 68 6f URN(short, *(sho
11c0: 72 74 2a 29 69 29 3b 0a 20 20 20 20 20 20 7d 20 rt*)i);. }
11d0: 65 6c 73 65 0a 20 20 20 20 20 20 69 66 20 28 6c else. if (l
11e0: 2d 3e 72 73 69 7a 65 20 3d 3d 20 73 69 7a 65 6f ->rsize == sizeo
11f0: 66 28 69 6e 74 29 29 20 7b 0a 20 20 20 20 20 20 f(int)) {.
1200: 20 20 52 45 54 55 52 4e 28 69 6e 74 2c 20 2a 28 RETURN(int, *(
1210: 69 6e 74 2a 29 69 29 3b 0a 20 20 20 20 20 20 7d int*)i);. }
1220: 20 65 6c 73 65 0a 20 20 20 20 20 20 69 66 20 28 else. if (
1230: 6c 2d 3e 72 73 69 7a 65 20 3d 3d 20 73 69 7a 65 l->rsize == size
1240: 6f 66 28 64 6f 75 62 6c 65 29 29 20 7b 0a 20 20 of(double)) {.
1250: 20 20 20 20 20 20 28 28 69 6e 74 2a 29 6c 2d 3e ((int*)l->
1260: 72 61 64 64 72 29 5b 30 5d 20 3d 20 28 28 69 6e raddr)[0] = ((in
1270: 74 2a 29 69 29 5b 30 5d 3b 0a 20 20 20 20 20 20 t*)i)[0];.
1280: 20 20 28 28 69 6e 74 2a 29 6c 2d 3e 72 61 64 64 ((int*)l->radd
1290: 72 29 5b 31 5d 20 3d 20 28 28 69 6e 74 2a 29 69 r)[1] = ((int*)i
12a0: 29 5b 31 5d 3b 0a 20 20 20 20 20 20 7d 20 65 6c )[1];. } el
12b0: 73 65 20 7b 0a 20 20 20 20 20 20 20 20 69 6e 74 se {. int
12c0: 20 6e 20 3d 20 28 6c 2d 3e 72 73 69 7a 65 20 2b n = (l->rsize +
12d0: 20 73 69 7a 65 6f 66 28 5f 5f 61 76 77 6f 72 64 sizeof(__avword
12e0: 29 2d 31 29 2f 73 69 7a 65 6f 66 28 5f 5f 61 76 )-1)/sizeof(__av
12f0: 77 6f 72 64 29 3b 0a 20 20 20 20 20 20 20 20 77 word);. w
1300: 68 69 6c 65 20 28 2d 2d 6e 20 3e 3d 20 30 29 0a hile (--n >= 0).
1310: 20 20 20 20 20 20 20 20 20 20 28 28 5f 5f 61 76 ((__av
1320: 77 6f 72 64 2a 29 6c 2d 3e 72 61 64 64 72 29 5b word*)l->raddr)[
1330: 6e 5d 20 3d 20 28 28 5f 5f 61 76 77 6f 72 64 2a n] = ((__avword*
1340: 29 69 29 5b 6e 5d 3b 0a 20 20 20 20 20 20 7d 0a )i)[n];. }.
1350: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 } else {.
1360: 20 20 20 2f 2a 20 6e 6f 72 6d 61 6c 20 73 74 72 /* normal str
1370: 75 63 74 20 72 65 74 75 72 6e 20 63 6f 6e 76 65 uct return conve
1380: 6e 74 69 6f 6e 20 2a 2f 0a 20 20 20 20 20 20 69 ntion */. i
1390: 66 20 28 6c 2d 3e 66 6c 61 67 73 20 26 20 5f 5f f (l->flags & __
13a0: 41 56 5f 53 4d 41 4c 4c 5f 53 54 52 55 43 54 5f AV_SMALL_STRUCT_
13b0: 52 45 54 55 52 4e 29 20 7b 0a 20 20 20 20 20 20 RETURN) {.
13c0: 20 20 69 66 20 28 6c 2d 3e 72 73 69 7a 65 20 3d if (l->rsize =
13d0: 3d 20 73 69 7a 65 6f 66 28 63 68 61 72 29 29 20 = sizeof(char))
13e0: 7b 0a 20 20 20 20 20 20 20 20 20 20 52 45 54 55 {. RETU
13f0: 52 4e 28 63 68 61 72 2c 20 69 29 3b 0a 20 20 20 RN(char, i);.
1400: 20 20 20 20 20 7d 20 65 6c 73 65 0a 20 20 20 20 } else.
1410: 20 20 20 20 69 66 20 28 6c 2d 3e 72 73 69 7a 65 if (l->rsize
1420: 20 3d 3d 20 73 69 7a 65 6f 66 28 73 68 6f 72 74 == sizeof(short
1430: 29 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 52 )) {. R
1440: 45 54 55 52 4e 28 73 68 6f 72 74 2c 20 69 29 3b ETURN(short, i);
1450: 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 0a . } else.
1460: 20 20 20 20 20 20 20 20 69 66 20 28 6c 2d 3e 72 if (l->r
1470: 73 69 7a 65 20 3d 3d 20 73 69 7a 65 6f 66 28 69 size == sizeof(i
1480: 6e 74 29 29 20 7b 0a 20 20 20 20 20 20 20 20 20 nt)) {.
1490: 20 52 45 54 55 52 4e 28 69 6e 74 2c 20 69 29 3b RETURN(int, i);
14a0: 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 . }.
14b0: 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 72 }. }. }. r
14c0: 65 74 75 72 6e 20 30 3b 0a 7d 0a 0a 23 65 6e 64 eturn 0;.}..#end
14d0: 69 66 20 2f 2a 5f 61 76 63 61 6c 6c 5f 6d 69 70 if /*_avcall_mip
14e0: 73 5f 63 20 2a 2f 0a s_c */.