Artifact
eb0341d6047e5fce7ea6704a7b224417d17bebc5:
0000: 2f 2a 20 76 61 63 61 6c 6c 20 66 75 6e 63 74 69 /* vacall functi
0010: 6f 6e 20 66 6f 72 20 73 70 61 72 63 20 43 50 55 on for sparc CPU
0020: 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 43 6f 70 79 72 */../*. * Copyr
0030: 69 67 68 74 20 31 39 39 35 2d 32 30 30 35 20 42 ight 1995-2005 B
0040: 72 75 6e 6f 20 48 61 69 62 6c 65 2c 20 3c 62 72 runo Haible, <br
0050: 75 6e 6f 40 63 6c 69 73 70 2e 6f 72 67 3e 0a 20 uno@clisp.org>.
0060: 2a 0a 20 2a 20 54 68 69 73 20 69 73 20 66 72 65 *. * This is fre
0070: 65 20 73 6f 66 74 77 61 72 65 20 64 69 73 74 72 e software distr
0080: 69 62 75 74 65 64 20 75 6e 64 65 72 20 74 68 65 ibuted under the
0090: 20 47 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62 GNU General Pub
00a0: 6c 69 63 20 4c 69 63 65 6e 63 65 0a 20 2a 20 64 lic Licence. * d
00b0: 65 73 63 72 69 62 65 64 20 69 6e 20 74 68 65 20 escribed in the
00c0: 66 69 6c 65 20 43 4f 50 59 49 4e 47 2e 20 43 6f file COPYING. Co
00d0: 6e 74 61 63 74 20 74 68 65 20 61 75 74 68 6f 72 ntact the author
00e0: 20 69 66 20 79 6f 75 20 64 6f 6e 27 74 20 68 61 if you don't ha
00f0: 76 65 20 74 68 69 73 0a 20 2a 20 6f 72 20 63 61 ve this. * or ca
0100: 6e 27 74 20 6c 69 76 65 20 77 69 74 68 20 69 74 n't live with it
0110: 2e 20 54 68 65 72 65 20 69 73 20 41 42 53 4f 4c . There is ABSOL
0120: 55 54 45 4c 59 20 4e 4f 20 57 41 52 52 41 4e 54 UTELY NO WARRANT
0130: 59 2c 20 65 78 70 6c 69 63 69 74 20 6f 72 20 69 Y, explicit or i
0140: 6d 70 6c 69 65 64 2c 0a 20 2a 20 6f 6e 20 74 68 mplied,. * on th
0150: 69 73 20 73 6f 66 74 77 61 72 65 2e 0a 20 2a 2f is software.. */
0160: 0a 0a 23 69 66 6e 64 65 66 20 52 45 45 4e 54 52 ..#ifndef REENTR
0170: 41 4e 54 0a 23 69 6e 63 6c 75 64 65 20 22 76 61 ANT.#include "va
0180: 63 61 6c 6c 2e 68 2e 69 6e 22 0a 23 65 6c 73 65 call.h.in".#else
0190: 20 2f 2a 20 52 45 45 4e 54 52 41 4e 54 20 2a 2f /* REENTRANT */
01a0: 0a 23 69 6e 63 6c 75 64 65 20 22 76 61 63 61 6c .#include "vacal
01b0: 6c 5f 72 2e 68 2e 69 6e 22 0a 23 65 6e 64 69 66 l_r.h.in".#endif
01c0: 0a 0a 23 69 66 64 65 66 20 52 45 45 4e 54 52 41 ..#ifdef REENTRA
01d0: 4e 54 0a 23 64 65 66 69 6e 65 20 5f 5f 76 61 63 NT.#define __vac
01e0: 61 6c 6c 20 5f 5f 76 61 63 61 6c 6c 5f 72 0a 72 all __vacall_r.r
01f0: 65 67 69 73 74 65 72 20 73 74 72 75 63 74 20 7b egister struct {
0200: 20 76 6f 69 64 20 28 2a 76 61 63 61 6c 6c 5f 66 void (*vacall_f
0210: 75 6e 63 74 69 6f 6e 29 20 28 76 6f 69 64 2a 2c unction) (void*,
0220: 76 61 5f 61 6c 69 73 74 29 3b 20 76 6f 69 64 2a va_alist); void*
0230: 20 61 72 67 3b 20 7d 0a 20 20 20 20 20 20 20 20 arg; }.
0240: 20 2a 09 65 6e 76 09 5f 5f 61 73 6d 5f 5f 28 22 *.env.__asm__("
0250: 25 67 32 22 29 3b 0a 23 65 6e 64 69 66 0a 72 65 %g2");.#endif.re
0260: 67 69 73 74 65 72 20 5f 5f 76 61 77 6f 72 64 2a gister __vaword*
0270: 20 66 70 09 5f 5f 61 73 6d 5f 5f 28 22 25 66 70 fp.__asm__("%fp
0280: 22 29 3b 09 2f 2a 20 6f 75 72 20 25 66 70 2c 20 ");./* our %fp,
0290: 63 61 6c 6c 65 72 27 73 20 25 73 70 20 2a 2f 0a caller's %sp */.
02a0: 72 65 67 69 73 74 65 72 20 5f 5f 76 61 77 6f 72 register __vawor
02b0: 64 2a 20 72 65 74 09 5f 5f 61 73 6d 5f 5f 28 22 d* ret.__asm__("
02c0: 25 69 37 22 29 3b 09 2f 2a 20 25 69 37 2b 38 20 %i7");./* %i7+8
02d0: 3d 20 72 65 74 75 72 6e 20 61 64 64 72 65 73 73 = return address
02e0: 20 2a 2f 0a 72 65 67 69 73 74 65 72 20 69 6e 74 */.register int
02f0: 09 69 72 65 74 09 5f 5f 61 73 6d 5f 5f 28 22 25 .iret.__asm__("%
0300: 69 30 22 29 3b 0a 72 65 67 69 73 74 65 72 20 69 i0");.register i
0310: 6e 74 09 69 72 65 74 32 09 5f 5f 61 73 6d 5f 5f nt.iret2.__asm__
0320: 28 22 25 69 31 22 29 3b 0a 72 65 67 69 73 74 65 ("%i1");.registe
0330: 72 20 66 6c 6f 61 74 09 66 72 65 74 09 5f 5f 61 r float.fret.__a
0340: 73 6d 5f 5f 28 22 25 66 30 22 29 3b 09 2f 2a 20 sm__("%f0");./*
0350: 25 66 30 20 2a 2f 0a 72 65 67 69 73 74 65 72 20 %f0 */.register
0360: 64 6f 75 62 6c 65 09 64 72 65 74 09 5f 5f 61 73 double.dret.__as
0370: 6d 5f 5f 28 22 25 66 30 22 29 3b 09 2f 2a 20 25 m__("%f0");./* %
0380: 66 30 2c 25 66 31 20 2a 2f 0a 0a 76 6f 69 64 20 f0,%f1 */..void
0390: 2f 2a 20 74 68 65 20 72 65 74 75 72 6e 20 74 79 /* the return ty
03a0: 70 65 20 69 73 20 76 61 72 69 61 62 6c 65 2c 20 pe is variable,
03b0: 6e 6f 74 20 76 6f 69 64 21 20 2a 2f 0a 5f 5f 76 not void! */.__v
03c0: 61 63 61 6c 6c 20 28 5f 5f 76 61 77 6f 72 64 20 acall (__vaword
03d0: 77 6f 72 64 31 2c 20 5f 5f 76 61 77 6f 72 64 20 word1, __vaword
03e0: 77 6f 72 64 32 2c 20 5f 5f 76 61 77 6f 72 64 20 word2, __vaword
03f0: 77 6f 72 64 33 2c 20 5f 5f 76 61 77 6f 72 64 20 word3, __vaword
0400: 77 6f 72 64 34 2c 0a 20 20 20 20 20 20 20 20 20 word4,.
0410: 20 5f 5f 76 61 77 6f 72 64 20 77 6f 72 64 35 2c __vaword word5,
0420: 20 5f 5f 76 61 77 6f 72 64 20 77 6f 72 64 36 2c __vaword word6,
0430: 0a 20 20 20 20 20 20 20 20 20 20 5f 5f 76 61 77 . __vaw
0440: 6f 72 64 20 66 69 72 73 74 77 6f 72 64 29 0a 7b ord firstword).{
0450: 0a 20 20 5f 5f 76 61 5f 61 6c 69 73 74 20 6c 69 . __va_alist li
0460: 73 74 3b 0a 20 20 2f 2a 20 67 63 63 2d 32 2e 36 st;. /* gcc-2.6
0470: 2e 33 20 73 6f 75 72 63 65 20 73 61 79 73 3a 20 .3 source says:
0480: 57 68 65 6e 20 61 20 70 61 72 61 6d 65 74 65 72 When a parameter
0490: 20 69 73 20 70 61 73 73 65 64 20 69 6e 20 61 20 is passed in a
04a0: 72 65 67 69 73 74 65 72 2c 0a 20 20 20 2a 20 73 register,. * s
04b0: 74 61 63 6b 20 73 70 61 63 65 20 69 73 20 73 74 tack space is st
04c0: 69 6c 6c 20 61 6c 6c 6f 63 61 74 65 64 20 66 6f ill allocated fo
04d0: 72 20 69 74 2e 0a 20 20 20 2a 2f 0a 20 20 2f 2a r it.. */. /*
04e0: 20 4d 6f 76 65 20 74 68 65 20 61 72 67 75 6d 65 Move the argume
04f0: 6e 74 73 20 70 61 73 73 65 64 20 69 6e 20 72 65 nts passed in re
0500: 67 69 73 74 65 72 73 20 74 6f 20 74 68 65 69 72 gisters to their
0510: 20 73 74 61 63 6b 20 6c 6f 63 61 74 69 6f 6e 73 stack locations
0520: 2e 20 2a 2f 0a 20 20 28 26 66 69 72 73 74 77 6f . */. (&firstwo
0530: 72 64 29 5b 2d 36 5d 20 3d 20 77 6f 72 64 31 3b rd)[-6] = word1;
0540: 0a 20 20 28 26 66 69 72 73 74 77 6f 72 64 29 5b . (&firstword)[
0550: 2d 35 5d 20 3d 20 77 6f 72 64 32 3b 0a 20 20 28 -5] = word2;. (
0560: 26 66 69 72 73 74 77 6f 72 64 29 5b 2d 34 5d 20 &firstword)[-4]
0570: 3d 20 77 6f 72 64 33 3b 0a 20 20 28 26 66 69 72 = word3;. (&fir
0580: 73 74 77 6f 72 64 29 5b 2d 33 5d 20 3d 20 77 6f stword)[-3] = wo
0590: 72 64 34 3b 0a 20 20 28 26 66 69 72 73 74 77 6f rd4;. (&firstwo
05a0: 72 64 29 5b 2d 32 5d 20 3d 20 77 6f 72 64 35 3b rd)[-2] = word5;
05b0: 0a 20 20 28 26 66 69 72 73 74 77 6f 72 64 29 5b . (&firstword)[
05c0: 2d 31 5d 20 3d 20 77 6f 72 64 36 3b 0a 20 20 2f -1] = word6;. /
05d0: 2a 20 50 72 65 70 61 72 65 20 74 68 65 20 76 61 * Prepare the va
05e0: 5f 61 6c 69 73 74 2e 20 2a 2f 0a 20 20 6c 69 73 _alist. */. lis
05f0: 74 2e 66 6c 61 67 73 20 3d 20 30 3b 0a 20 20 6c t.flags = 0;. l
0600: 69 73 74 2e 61 70 74 72 20 3d 20 28 6c 6f 6e 67 ist.aptr = (long
0610: 29 28 26 66 69 72 73 74 77 6f 72 64 20 2d 20 36 )(&firstword - 6
0620: 29 3b 0a 20 20 6c 69 73 74 2e 72 61 64 64 72 20 );. list.raddr
0630: 3d 20 28 76 6f 69 64 2a 29 30 3b 0a 20 20 6c 69 = (void*)0;. li
0640: 73 74 2e 72 74 79 70 65 20 3d 20 5f 5f 56 41 76 st.rtype = __VAv
0650: 6f 69 64 3b 0a 20 20 6c 69 73 74 2e 73 74 72 75 oid;. list.stru
0660: 63 74 72 61 64 64 72 20 3d 20 28 76 6f 69 64 2a ctraddr = (void*
0670: 29 28 28 26 66 69 72 73 74 77 6f 72 64 29 5b 2d )((&firstword)[-
0680: 37 5d 29 3b 20 2f 2a 20 3d 20 28 76 6f 69 64 2a 7]); /* = (void*
0690: 29 20 66 70 5b 31 36 5d 20 2a 2f 0a 20 20 2f 2a ) fp[16] */. /*
06a0: 20 43 61 6c 6c 20 76 61 63 61 6c 6c 5f 66 75 6e Call vacall_fun
06b0: 63 74 69 6f 6e 2e 20 54 68 65 20 6d 61 63 72 6f ction. The macro
06c0: 73 20 64 6f 20 61 6c 6c 20 74 68 65 20 72 65 73 s do all the res
06d0: 74 2e 20 2a 2f 0a 23 69 66 6e 64 65 66 20 52 45 t. */.#ifndef RE
06e0: 45 4e 54 52 41 4e 54 0a 20 20 28 2a 76 61 63 61 ENTRANT. (*vaca
06f0: 6c 6c 5f 66 75 6e 63 74 69 6f 6e 29 20 28 26 6c ll_function) (&l
0700: 69 73 74 29 3b 0a 23 65 6c 73 65 20 2f 2a 20 52 ist);.#else /* R
0710: 45 45 4e 54 52 41 4e 54 20 2a 2f 0a 20 20 28 2a EENTRANT */. (*
0720: 65 6e 76 2d 3e 76 61 63 61 6c 6c 5f 66 75 6e 63 env->vacall_func
0730: 74 69 6f 6e 29 20 28 65 6e 76 2d 3e 61 72 67 2c tion) (env->arg,
0740: 26 6c 69 73 74 29 3b 0a 23 65 6e 64 69 66 0a 20 &list);.#endif.
0750: 20 2f 2a 20 50 75 74 20 72 65 74 75 72 6e 20 76 /* Put return v
0760: 61 6c 75 65 20 69 6e 74 6f 20 70 72 6f 70 65 72 alue into proper
0770: 20 72 65 67 69 73 74 65 72 2e 20 2a 2f 0a 20 20 register. */.
0780: 69 66 20 28 6c 69 73 74 2e 72 74 79 70 65 20 3d if (list.rtype =
0790: 3d 20 5f 5f 56 41 76 6f 69 64 29 20 7b 0a 20 20 = __VAvoid) {.
07a0: 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c 69 73 } else. if (lis
07b0: 74 2e 72 74 79 70 65 20 3d 3d 20 5f 5f 56 41 63 t.rtype == __VAc
07c0: 68 61 72 29 20 7b 0a 20 20 20 20 69 72 65 74 20 har) {. iret
07d0: 3d 20 6c 69 73 74 2e 74 6d 70 2e 5f 63 68 61 72 = list.tmp._char
07e0: 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 ;. } else. if
07f0: 28 6c 69 73 74 2e 72 74 79 70 65 20 3d 3d 20 5f (list.rtype == _
0800: 5f 56 41 73 63 68 61 72 29 20 7b 0a 20 20 20 20 _VAschar) {.
0810: 69 72 65 74 20 3d 20 6c 69 73 74 2e 74 6d 70 2e iret = list.tmp.
0820: 5f 73 63 68 61 72 3b 0a 20 20 7d 20 65 6c 73 65 _schar;. } else
0830: 0a 20 20 69 66 20 28 6c 69 73 74 2e 72 74 79 70 . if (list.rtyp
0840: 65 20 3d 3d 20 5f 5f 56 41 75 63 68 61 72 29 20 e == __VAuchar)
0850: 7b 0a 20 20 20 20 69 72 65 74 20 3d 20 6c 69 73 {. iret = lis
0860: 74 2e 74 6d 70 2e 5f 75 63 68 61 72 3b 0a 20 20 t.tmp._uchar;.
0870: 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c 69 73 } else. if (lis
0880: 74 2e 72 74 79 70 65 20 3d 3d 20 5f 5f 56 41 73 t.rtype == __VAs
0890: 68 6f 72 74 29 20 7b 0a 20 20 20 20 69 72 65 74 hort) {. iret
08a0: 20 3d 20 6c 69 73 74 2e 74 6d 70 2e 5f 73 68 6f = list.tmp._sho
08b0: 72 74 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 rt;. } else. i
08c0: 66 20 28 6c 69 73 74 2e 72 74 79 70 65 20 3d 3d f (list.rtype ==
08d0: 20 5f 5f 56 41 75 73 68 6f 72 74 29 20 7b 0a 20 __VAushort) {.
08e0: 20 20 20 69 72 65 74 20 3d 20 6c 69 73 74 2e 74 iret = list.t
08f0: 6d 70 2e 5f 75 73 68 6f 72 74 3b 0a 20 20 7d 20 mp._ushort;. }
0900: 65 6c 73 65 0a 20 20 69 66 20 28 6c 69 73 74 2e else. if (list.
0910: 72 74 79 70 65 20 3d 3d 20 5f 5f 56 41 69 6e 74 rtype == __VAint
0920: 29 20 7b 0a 20 20 20 20 69 72 65 74 20 3d 20 6c ) {. iret = l
0930: 69 73 74 2e 74 6d 70 2e 5f 69 6e 74 3b 0a 20 20 ist.tmp._int;.
0940: 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c 69 73 } else. if (lis
0950: 74 2e 72 74 79 70 65 20 3d 3d 20 5f 5f 56 41 75 t.rtype == __VAu
0960: 69 6e 74 29 20 7b 0a 20 20 20 20 69 72 65 74 20 int) {. iret
0970: 3d 20 6c 69 73 74 2e 74 6d 70 2e 5f 75 69 6e 74 = list.tmp._uint
0980: 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 ;. } else. if
0990: 28 6c 69 73 74 2e 72 74 79 70 65 20 3d 3d 20 5f (list.rtype == _
09a0: 5f 56 41 6c 6f 6e 67 29 20 7b 0a 20 20 20 20 69 _VAlong) {. i
09b0: 72 65 74 20 3d 20 6c 69 73 74 2e 74 6d 70 2e 5f ret = list.tmp._
09c0: 6c 6f 6e 67 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 long;. } else.
09d0: 20 69 66 20 28 6c 69 73 74 2e 72 74 79 70 65 20 if (list.rtype
09e0: 3d 3d 20 5f 5f 56 41 75 6c 6f 6e 67 29 20 7b 0a == __VAulong) {.
09f0: 20 20 20 20 69 72 65 74 20 3d 20 6c 69 73 74 2e iret = list.
0a00: 74 6d 70 2e 5f 75 6c 6f 6e 67 3b 0a 20 20 7d 20 tmp._ulong;. }
0a10: 65 6c 73 65 0a 20 20 69 66 20 28 6c 69 73 74 2e else. if (list.
0a20: 72 74 79 70 65 20 3d 3d 20 5f 5f 56 41 6c 6f 6e rtype == __VAlon
0a30: 67 6c 6f 6e 67 20 7c 7c 20 6c 69 73 74 2e 72 74 glong || list.rt
0a40: 79 70 65 20 3d 3d 20 5f 5f 56 41 75 6c 6f 6e 67 ype == __VAulong
0a50: 6c 6f 6e 67 29 20 7b 0a 20 20 20 20 69 72 65 74 long) {. iret
0a60: 20 20 3d 20 28 28 5f 5f 76 61 77 6f 72 64 20 2a = ((__vaword *
0a70: 29 20 26 6c 69 73 74 2e 74 6d 70 2e 5f 6c 6f 6e ) &list.tmp._lon
0a80: 67 6c 6f 6e 67 29 5b 30 5d 3b 0a 20 20 20 20 69 glong)[0];. i
0a90: 72 65 74 32 20 3d 20 28 28 5f 5f 76 61 77 6f 72 ret2 = ((__vawor
0aa0: 64 20 2a 29 20 26 6c 69 73 74 2e 74 6d 70 2e 5f d *) &list.tmp._
0ab0: 6c 6f 6e 67 6c 6f 6e 67 29 5b 31 5d 3b 0a 20 20 longlong)[1];.
0ac0: 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c 69 73 } else. if (lis
0ad0: 74 2e 72 74 79 70 65 20 3d 3d 20 5f 5f 56 41 66 t.rtype == __VAf
0ae0: 6c 6f 61 74 29 20 7b 0a 20 20 20 20 69 66 20 28 loat) {. if (
0af0: 6c 69 73 74 2e 66 6c 61 67 73 20 26 20 5f 5f 56 list.flags & __V
0b00: 41 5f 53 55 4e 43 43 5f 46 4c 4f 41 54 5f 52 45 A_SUNCC_FLOAT_RE
0b10: 54 55 52 4e 29 20 7b 0a 20 20 20 20 20 20 64 72 TURN) {. dr
0b20: 65 74 20 3d 20 28 64 6f 75 62 6c 65 29 6c 69 73 et = (double)lis
0b30: 74 2e 74 6d 70 2e 5f 66 6c 6f 61 74 3b 0a 20 20 t.tmp._float;.
0b40: 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 } else {.
0b50: 20 66 72 65 74 20 3d 20 6c 69 73 74 2e 74 6d 70 fret = list.tmp
0b60: 2e 5f 66 6c 6f 61 74 3b 0a 20 20 20 20 7d 0a 20 ._float;. }.
0b70: 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c 69 } else. if (li
0b80: 73 74 2e 72 74 79 70 65 20 3d 3d 20 5f 5f 56 41 st.rtype == __VA
0b90: 64 6f 75 62 6c 65 29 20 7b 0a 20 20 20 20 64 72 double) {. dr
0ba0: 65 74 20 3d 20 6c 69 73 74 2e 74 6d 70 2e 5f 64 et = list.tmp._d
0bb0: 6f 75 62 6c 65 3b 0a 20 20 7d 20 65 6c 73 65 0a ouble;. } else.
0bc0: 20 20 69 66 20 28 6c 69 73 74 2e 72 74 79 70 65 if (list.rtype
0bd0: 20 3d 3d 20 5f 5f 56 41 76 6f 69 64 70 29 20 7b == __VAvoidp) {
0be0: 0a 20 20 20 20 69 72 65 74 20 3d 20 28 6c 6f 6e . iret = (lon
0bf0: 67 29 6c 69 73 74 2e 74 6d 70 2e 5f 70 74 72 3b g)list.tmp._ptr;
0c00: 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 . } else. if (
0c10: 6c 69 73 74 2e 72 74 79 70 65 20 3d 3d 20 5f 5f list.rtype == __
0c20: 56 41 73 74 72 75 63 74 29 20 7b 0a 20 20 20 20 VAstruct) {.
0c30: 69 66 20 28 6c 69 73 74 2e 66 6c 61 67 73 20 26 if (list.flags &
0c40: 20 5f 5f 56 41 5f 53 55 4e 50 52 4f 43 43 5f 53 __VA_SUNPROCC_S
0c50: 54 52 55 43 54 5f 52 45 54 55 52 4e 29 20 7b 0a TRUCT_RETURN) {.
0c60: 20 20 20 20 20 20 2f 2a 20 53 75 6e 20 63 63 20 /* Sun cc
0c70: 73 74 72 75 63 74 20 72 65 74 75 72 6e 20 63 6f struct return co
0c80: 6e 76 65 6e 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20 nvention. */.
0c90: 20 20 20 2f 2a 20 54 68 65 20 64 65 73 69 72 65 /* The desire
0ca0: 64 20 73 74 72 75 63 74 20 72 65 74 75 72 6e 20 d struct return
0cb0: 61 64 64 72 65 73 73 20 77 61 73 20 70 61 73 73 address was pass
0cc0: 65 64 20 69 6e 20 66 70 5b 31 36 5d 2c 20 6c 61 ed in fp[16], la
0cd0: 74 65 72 20 6f 6e 0a 20 20 20 20 20 20 20 2a 20 ter on. *
0ce0: 6c 69 73 74 2e 72 61 64 64 72 20 3d 20 6c 69 73 list.raddr = lis
0cf0: 74 2e 73 74 72 75 63 74 72 61 64 64 72 20 3d 20 t.structraddr =
0d00: 66 70 5b 31 36 5d 2e 20 4e 6f 77 20 74 68 65 20 fp[16]. Now the
0d10: 72 65 73 75 6c 74 20 68 61 73 0a 20 20 20 20 20 result has.
0d20: 20 20 2a 20 61 6c 72 65 61 64 79 20 62 65 65 6e * already been
0d30: 20 63 6f 70 69 65 64 20 74 68 65 72 65 2e 20 4e copied there. N
0d40: 6f 20 6e 65 65 64 20 74 6f 20 63 6f 70 79 20 74 o need to copy t
0d50: 68 65 20 72 65 73 75 6c 74 20 6f 6e 63 65 20 6d he result once m
0d60: 6f 72 65 2e 0a 20 20 20 20 20 20 20 2a 20 54 68 ore.. * Th
0d70: 65 20 63 61 6c 6c 65 72 20 65 78 70 65 63 74 73 e caller expects
0d80: 20 74 6f 20 72 65 63 65 69 76 65 20 74 68 65 20 to receive the
0d90: 73 74 72 75 63 74 20 72 65 74 75 72 6e 20 61 64 struct return ad
0da0: 64 72 65 73 73 20 69 6e 20 25 6f 30 2e 0a 20 20 dress in %o0..
0db0: 20 20 20 20 20 2a 2f 0a 20 20 20 20 20 20 69 72 */. ir
0dc0: 65 74 20 3d 20 28 6c 6f 6e 67 29 20 6c 69 73 74 et = (long) list
0dd0: 2e 72 61 64 64 72 3b 0a 20 20 20 20 20 20 69 66 .raddr;. if
0de0: 20 28 28 6c 69 73 74 2e 72 73 69 7a 65 20 26 20 ((list.rsize &
0df0: 30 78 66 66 66 29 20 3d 3d 20 72 65 74 5b 32 5d 0xfff) == ret[2]
0e00: 29 0a 20 20 20 20 20 20 20 20 72 65 74 2b 2b 3b ). ret++;
0e10: 20 2f 2a 20 73 6b 69 70 20 74 68 65 20 22 75 6e /* skip the "un
0e20: 69 6d 70 20 6e 22 20 69 6e 73 74 72 75 63 74 69 imp n" instructi
0e30: 6f 6e 20 61 74 20 74 68 65 20 72 65 74 75 72 6e on at the return
0e40: 20 61 64 64 72 65 73 73 20 2a 2f 0a 20 20 20 20 address */.
0e50: 20 20 20 20 2f 2a 20 65 6c 73 65 20 74 68 65 20 /* else the
0e60: 22 75 6e 69 6d 70 20 6e 22 20 69 6e 73 74 72 75 "unimp n" instru
0e70: 63 74 69 6f 6e 20 77 69 6c 6c 20 63 61 75 73 65 ction will cause
0e80: 20 61 20 63 6f 72 65 20 64 75 6d 70 20 2a 2f 0a a core dump */.
0e90: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 } else {.
0ea0: 20 20 20 69 66 20 28 6c 69 73 74 2e 66 6c 61 67 if (list.flag
0eb0: 73 20 26 20 5f 5f 56 41 5f 50 43 43 5f 53 54 52 s & __VA_PCC_STR
0ec0: 55 43 54 5f 52 45 54 55 52 4e 29 20 7b 0a 20 20 UCT_RETURN) {.
0ed0: 20 20 20 20 20 20 2f 2a 20 70 63 63 20 73 74 72 /* pcc str
0ee0: 75 63 74 20 72 65 74 75 72 6e 20 63 6f 6e 76 65 uct return conve
0ef0: 6e 74 69 6f 6e 20 2a 2f 0a 20 20 20 20 20 20 20 ntion */.
0f00: 20 69 72 65 74 20 3d 20 28 6c 6f 6e 67 29 20 6c iret = (long) l
0f10: 69 73 74 2e 72 61 64 64 72 3b 0a 20 20 20 20 20 ist.raddr;.
0f20: 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 } else {.
0f30: 20 20 2f 2a 20 6e 6f 72 6d 61 6c 20 73 74 72 75 /* normal stru
0f40: 63 74 20 72 65 74 75 72 6e 20 63 6f 6e 76 65 6e ct return conven
0f50: 74 69 6f 6e 20 2a 2f 0a 20 20 20 20 20 20 20 20 tion */.
0f60: 69 66 20 28 6c 69 73 74 2e 66 6c 61 67 73 20 26 if (list.flags &
0f70: 20 5f 5f 56 41 5f 53 4d 41 4c 4c 5f 53 54 52 55 __VA_SMALL_STRU
0f80: 43 54 5f 52 45 54 55 52 4e 29 20 7b 0a 20 20 20 CT_RETURN) {.
0f90: 20 20 20 20 20 20 20 69 66 20 28 6c 69 73 74 2e if (list.
0fa0: 72 73 69 7a 65 20 3d 3d 20 73 69 7a 65 6f 66 28 rsize == sizeof(
0fb0: 63 68 61 72 29 29 20 7b 0a 20 20 20 20 20 20 20 char)) {.
0fc0: 20 20 20 20 20 69 72 65 74 20 3d 20 2a 28 75 6e iret = *(un
0fd0: 73 69 67 6e 65 64 20 63 68 61 72 20 2a 29 20 6c signed char *) l
0fe0: 69 73 74 2e 72 61 64 64 72 3b 0a 20 20 20 20 20 ist.raddr;.
0ff0: 20 20 20 20 20 20 20 67 6f 74 6f 20 64 6f 6e 65 goto done
1000: 3b 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c ;. } el
1010: 73 65 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 se. if
1020: 28 6c 69 73 74 2e 72 73 69 7a 65 20 3d 3d 20 73 (list.rsize == s
1030: 69 7a 65 6f 66 28 73 68 6f 72 74 29 29 20 7b 0a izeof(short)) {.
1040: 20 20 20 20 20 20 20 20 20 20 20 20 69 72 65 74 iret
1050: 20 3d 20 2a 28 75 6e 73 69 67 6e 65 64 20 73 68 = *(unsigned sh
1060: 6f 72 74 20 2a 29 20 6c 69 73 74 2e 72 61 64 64 ort *) list.radd
1070: 72 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 67 r;. g
1080: 6f 74 6f 20 64 6f 6e 65 3b 0a 20 20 20 20 20 20 oto done;.
1090: 20 20 20 20 7d 20 65 6c 73 65 0a 20 20 20 20 20 } else.
10a0: 20 20 20 20 20 69 66 20 28 6c 69 73 74 2e 72 73 if (list.rs
10b0: 69 7a 65 20 3d 3d 20 73 69 7a 65 6f 66 28 69 6e ize == sizeof(in
10c0: 74 29 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 t)) {.
10d0: 20 20 69 72 65 74 20 3d 20 2a 28 75 6e 73 69 67 iret = *(unsig
10e0: 6e 65 64 20 69 6e 74 20 2a 29 20 6c 69 73 74 2e ned int *) list.
10f0: 72 61 64 64 72 3b 0a 20 20 20 20 20 20 20 20 20 raddr;.
1100: 20 20 20 67 6f 74 6f 20 64 6f 6e 65 3b 0a 20 20 goto done;.
1110: 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 }.
1120: 20 20 7d 0a 20 20 20 20 20 20 20 20 72 65 74 2b }. ret+
1130: 2b 3b 20 2f 2a 20 73 6b 69 70 20 74 68 65 20 22 +; /* skip the "
1140: 75 6e 69 6d 70 20 6e 22 20 69 6e 73 74 72 75 63 unimp n" instruc
1150: 74 69 6f 6e 20 61 74 20 74 68 65 20 72 65 74 75 tion at the retu
1160: 72 6e 20 61 64 64 72 65 73 73 20 2a 2f 0a 20 20 rn address */.
1170: 20 20 20 20 20 20 64 6f 6e 65 3a 20 3b 0a 20 20 done: ;.
1180: 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a }. }. }.
1190: 7d 0a }.