Artifact
0dbf56d3de510c1a1052614262f841445db1b474:
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 61 72 6d 20 43 50 55 20 2a on for arm CPU *
0020: 2f 0a 0a 2f 2a 0a 20 2a 20 43 6f 70 79 72 69 67 /../*. * Copyrig
0030: 68 74 20 31 39 39 35 2d 32 30 30 34 20 42 72 75 ht 1995-2004 Bru
0040: 6e 6f 20 48 61 69 62 6c 65 2c 20 3c 62 72 75 6e no Haible, <brun
0050: 6f 40 63 6c 69 73 70 2e 6f 72 67 3e 0a 20 2a 0a o@clisp.org>. *.
0060: 20 2a 20 54 68 69 73 20 69 73 20 66 72 65 65 20 * This is free
0070: 73 6f 66 74 77 61 72 65 20 64 69 73 74 72 69 62 software distrib
0080: 75 74 65 64 20 75 6e 64 65 72 20 74 68 65 20 47 uted under the G
0090: 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 NU General Publi
00a0: 63 20 4c 69 63 65 6e 63 65 0a 20 2a 20 64 65 73 c Licence. * des
00b0: 63 72 69 62 65 64 20 69 6e 20 74 68 65 20 66 69 cribed in the fi
00c0: 6c 65 20 43 4f 50 59 49 4e 47 2e 20 43 6f 6e 74 le COPYING. Cont
00d0: 61 63 74 20 74 68 65 20 61 75 74 68 6f 72 20 69 act the author i
00e0: 66 20 79 6f 75 20 64 6f 6e 27 74 20 68 61 76 65 f you don't have
00f0: 20 74 68 69 73 0a 20 2a 20 6f 72 20 63 61 6e 27 this. * or can'
0100: 74 20 6c 69 76 65 20 77 69 74 68 20 69 74 2e 20 t live with it.
0110: 54 68 65 72 65 20 69 73 20 41 42 53 4f 4c 55 54 There is ABSOLUT
0120: 45 4c 59 20 4e 4f 20 57 41 52 52 41 4e 54 59 2c ELY NO WARRANTY,
0130: 20 65 78 70 6c 69 63 69 74 20 6f 72 20 69 6d 70 explicit or imp
0140: 6c 69 65 64 2c 0a 20 2a 20 6f 6e 20 74 68 69 73 lied,. * on this
0150: 20 73 6f 66 74 77 61 72 65 2e 0a 20 2a 2f 0a 0a software.. */..
0160: 23 69 66 6e 64 65 66 20 52 45 45 4e 54 52 41 4e #ifndef REENTRAN
0170: 54 0a 23 69 6e 63 6c 75 64 65 20 22 76 61 63 61 T.#include "vaca
0180: 6c 6c 2e 68 2e 69 6e 22 0a 23 65 6c 73 65 20 2f ll.h.in".#else /
0190: 2a 20 52 45 45 4e 54 52 41 4e 54 20 2a 2f 0a 23 * REENTRANT */.#
01a0: 69 6e 63 6c 75 64 65 20 22 76 61 63 61 6c 6c 5f include "vacall_
01b0: 72 2e 68 2e 69 6e 22 0a 23 65 6e 64 69 66 0a 0a r.h.in".#endif..
01c0: 23 69 66 64 65 66 20 52 45 45 4e 54 52 41 4e 54 #ifdef REENTRANT
01d0: 0a 23 64 65 66 69 6e 65 20 5f 5f 76 61 63 61 6c .#define __vacal
01e0: 6c 20 5f 5f 76 61 63 61 6c 6c 5f 72 0a 72 65 67 l __vacall_r.reg
01f0: 69 73 74 65 72 20 73 74 72 75 63 74 20 7b 20 76 ister struct { v
0200: 6f 69 64 20 28 2a 76 61 63 61 6c 6c 5f 66 75 6e oid (*vacall_fun
0210: 63 74 69 6f 6e 29 20 28 76 6f 69 64 2a 2c 76 61 ction) (void*,va
0220: 5f 61 6c 69 73 74 29 3b 20 76 6f 69 64 2a 20 61 _alist); void* a
0230: 72 67 3b 20 7d 0a 20 20 20 20 20 20 20 20 20 2a rg; }. *
0240: 09 09 65 6e 76 09 5f 5f 61 73 6d 5f 5f 28 22 72 ..env.__asm__("r
0250: 31 32 22 29 3b 0a 23 65 6e 64 69 66 0a 0a 2f 2a 12");.#endif../*
0260: 20 61 72 6d 65 6c 20 68 61 76 65 20 6f 6e 6c 79 armel have only
0270: 20 73 6f 66 74 76 66 70 20 77 68 69 63 68 20 75 softvfp which u
0280: 73 65 73 20 67 65 6e 65 72 69 63 20 72 65 67 69 ses generic regi
0290: 73 74 65 72 73 20 2a 2f 0a 72 65 67 69 73 74 65 sters */.registe
02a0: 72 20 5f 5f 76 61 77 6f 72 64 09 69 72 65 74 09 r __vaword.iret.
02b0: 5f 5f 61 73 6d 5f 5f 28 22 72 30 22 29 3b 0a 72 __asm__("r0");.r
02c0: 65 67 69 73 74 65 72 20 5f 5f 76 61 77 6f 72 64 egister __vaword
02d0: 09 69 72 65 74 32 09 5f 5f 61 73 6d 5f 5f 28 22 .iret2.__asm__("
02e0: 72 31 22 29 3b 0a 72 65 67 69 73 74 65 72 20 66 r1");.register f
02f0: 6c 6f 61 74 09 09 66 72 65 74 09 5f 5f 61 73 6d loat..fret.__asm
0300: 5f 5f 28 22 72 30 22 29 3b 0a 72 65 67 69 73 74 __("r0");.regist
0310: 65 72 20 5f 5f 76 61 77 6f 72 64 09 64 72 65 74 er __vaword.dret
0320: 31 09 5f 5f 61 73 6d 5f 5f 28 22 72 30 22 29 3b 1.__asm__("r0");
0330: 0a 72 65 67 69 73 74 65 72 20 5f 5f 76 61 77 6f .register __vawo
0340: 72 64 09 64 72 65 74 32 09 5f 5f 61 73 6d 5f 5f rd.dret2.__asm__
0350: 28 22 72 31 22 29 3b 0a 0a 76 6f 69 64 20 2f 2a ("r1");..void /*
0360: 20 74 68 65 20 72 65 74 75 72 6e 20 74 79 70 65 the return type
0370: 20 69 73 20 76 61 72 69 61 62 6c 65 2c 20 6e 6f is variable, no
0380: 74 20 76 6f 69 64 21 20 2a 2f 0a 5f 5f 76 61 63 t void! */.__vac
0390: 61 6c 6c 20 28 5f 5f 76 61 77 6f 72 64 20 77 6f all (__vaword wo
03a0: 72 64 31 2c 20 5f 5f 76 61 77 6f 72 64 20 77 6f rd1, __vaword wo
03b0: 72 64 32 2c 20 5f 5f 76 61 77 6f 72 64 20 77 6f rd2, __vaword wo
03c0: 72 64 33 2c 20 5f 5f 76 61 77 6f 72 64 20 77 6f rd3, __vaword wo
03d0: 72 64 34 2c 0a 20 20 20 20 20 20 20 20 20 20 5f rd4,. _
03e0: 5f 76 61 77 6f 72 64 20 66 69 72 73 74 77 6f 72 _vaword firstwor
03f0: 64 29 0a 7b 0a 20 20 73 74 72 75 63 74 20 7b 20 d).{. struct {
0400: 6c 6f 6e 67 20 72 65 74 61 64 64 72 2c 20 73 61 long retaddr, sa
0410: 76 31 2c 20 73 61 76 32 2c 20 73 61 76 33 2c 20 v1, sav2, sav3,
0420: 73 61 76 34 2c 20 61 72 67 31 2c 20 61 72 67 32 sav4, arg1, arg2
0430: 2c 20 61 72 67 33 2c 20 61 72 67 34 3b 20 7d 20 , arg3, arg4; }
0440: 61 72 67 73 3b 0a 20 20 5f 5f 76 61 5f 61 6c 69 args;. __va_ali
0450: 73 74 20 6c 69 73 74 3b 0a 20 20 2f 2a 20 4d 41 st list;. /* MA
0460: 47 49 43 20 41 4c 45 52 54 21 0a 20 20 20 2a 20 GIC ALERT!. *
0470: 54 68 69 73 20 69 73 20 74 68 65 20 6c 61 73 74 This is the last
0480: 20 73 74 72 75 63 74 20 6f 6e 20 74 68 65 20 73 struct on the s
0490: 74 61 63 6b 2c 20 73 6f 20 74 68 61 74 0a 20 20 tack, so that.
04a0: 20 2a 20 26 61 72 67 73 20 2b 20 31 20 3d 3d 20 * &args + 1 ==
04b0: 26 72 65 74 75 72 6e 5f 61 64 64 72 65 73 73 20 &return_address
04c0: 3d 3d 20 26 66 69 72 73 74 77 6f 72 64 20 2d 20 == &firstword -
04d0: 31 2e 0a 20 20 20 2a 20 4c 6f 6f 6b 20 61 74 20 1.. * Look at
04e0: 74 68 65 20 61 73 73 65 6d 62 6c 79 20 63 6f 64 the assembly cod
04f0: 65 20 74 6f 20 63 6f 6e 76 69 6e 63 65 20 79 6f e to convince yo
0500: 75 72 73 65 6c 66 2e 0a 20 20 20 2a 2f 0a 20 20 urself.. */.
0510: 2f 2a 20 4d 6f 76 65 20 74 68 65 20 61 72 67 75 /* Move the argu
0520: 6d 65 6e 74 73 20 70 61 73 73 65 64 20 69 6e 20 ments passed in
0530: 72 65 67 69 73 74 65 72 73 20 74 6f 20 74 68 65 registers to the
0540: 69 72 20 73 74 61 63 6b 20 6c 6f 63 61 74 69 6f ir stack locatio
0550: 6e 73 2e 20 2a 2f 0a 20 20 61 72 67 73 2e 72 65 ns. */. args.re
0560: 74 61 64 64 72 20 3d 20 28 26 66 69 72 73 74 77 taddr = (&firstw
0570: 6f 72 64 29 5b 2d 31 5d 3b 20 2f 2a 20 73 61 76 ord)[-1]; /* sav
0580: 65 20 74 68 65 20 72 65 74 75 72 6e 20 61 64 64 e the return add
0590: 72 65 73 73 20 61 6e 64 20 73 61 76 65 64 20 72 ress and saved r
05a0: 65 67 69 73 74 65 72 73 20 2a 2f 0a 20 20 61 72 egisters */. ar
05b0: 67 73 2e 73 61 76 31 20 3d 20 28 26 66 69 72 73 gs.sav1 = (&firs
05c0: 74 77 6f 72 64 29 5b 2d 32 5d 3b 0a 20 20 61 72 tword)[-2];. ar
05d0: 67 73 2e 73 61 76 32 20 3d 20 28 26 66 69 72 73 gs.sav2 = (&firs
05e0: 74 77 6f 72 64 29 5b 2d 33 5d 3b 0a 20 20 61 72 tword)[-3];. ar
05f0: 67 73 2e 73 61 76 33 20 3d 20 28 26 66 69 72 73 gs.sav3 = (&firs
0600: 74 77 6f 72 64 29 5b 2d 34 5d 3b 0a 20 20 61 72 tword)[-4];. ar
0610: 67 73 2e 73 61 76 34 20 3d 20 28 26 66 69 72 73 gs.sav4 = (&firs
0620: 74 77 6f 72 64 29 5b 2d 35 5d 3b 0a 20 20 61 72 tword)[-5];. ar
0630: 67 73 2e 61 72 67 31 20 3d 20 77 6f 72 64 31 3b gs.arg1 = word1;
0640: 0a 20 20 61 72 67 73 2e 61 72 67 32 20 3d 20 77 . args.arg2 = w
0650: 6f 72 64 32 3b 0a 20 20 61 72 67 73 2e 61 72 67 ord2;. args.arg
0660: 33 20 3d 20 77 6f 72 64 33 3b 0a 20 20 61 72 67 3 = word3;. arg
0670: 73 2e 61 72 67 34 20 3d 20 77 6f 72 64 34 3b 0a s.arg4 = word4;.
0680: 20 20 28 26 66 69 72 73 74 77 6f 72 64 29 5b 2d (&firstword)[-
0690: 34 5d 20 3d 20 61 72 67 73 2e 61 72 67 31 3b 0a 4] = args.arg1;.
06a0: 20 20 28 26 66 69 72 73 74 77 6f 72 64 29 5b 2d (&firstword)[-
06b0: 33 5d 20 3d 20 61 72 67 73 2e 61 72 67 32 3b 0a 3] = args.arg2;.
06c0: 20 20 28 26 66 69 72 73 74 77 6f 72 64 29 5b 2d (&firstword)[-
06d0: 32 5d 20 3d 20 61 72 67 73 2e 61 72 67 33 3b 0a 2] = args.arg3;.
06e0: 20 20 28 26 66 69 72 73 74 77 6f 72 64 29 5b 2d (&firstword)[-
06f0: 31 5d 20 3d 20 61 72 67 73 2e 61 72 67 34 3b 0a 1] = args.arg4;.
0700: 20 20 2f 2a 20 50 72 65 70 61 72 65 20 74 68 65 /* Prepare the
0710: 20 76 61 5f 61 6c 69 73 74 2e 20 2a 2f 0a 20 20 va_alist. */.
0720: 6c 69 73 74 2e 66 6c 61 67 73 20 3d 20 30 3b 0a list.flags = 0;.
0730: 20 20 6c 69 73 74 2e 61 70 74 72 20 3d 20 28 6c list.aptr = (l
0740: 6f 6e 67 29 28 26 66 69 72 73 74 77 6f 72 64 20 ong)(&firstword
0750: 2d 20 34 29 3b 0a 20 20 6c 69 73 74 2e 72 61 64 - 4);. list.rad
0760: 64 72 20 3d 20 28 76 6f 69 64 2a 29 30 3b 0a 20 dr = (void*)0;.
0770: 20 6c 69 73 74 2e 72 74 79 70 65 20 3d 20 5f 5f list.rtype = __
0780: 56 41 76 6f 69 64 3b 0a 20 20 2f 2a 20 43 61 6c VAvoid;. /* Cal
0790: 6c 20 76 61 63 61 6c 6c 5f 66 75 6e 63 74 69 6f l vacall_functio
07a0: 6e 2e 20 54 68 65 20 6d 61 63 72 6f 73 20 64 6f n. The macros do
07b0: 20 61 6c 6c 20 74 68 65 20 72 65 73 74 2e 20 2a all the rest. *
07c0: 2f 0a 23 69 66 6e 64 65 66 20 52 45 45 4e 54 52 /.#ifndef REENTR
07d0: 41 4e 54 0a 20 20 28 2a 76 61 63 61 6c 6c 5f 66 ANT. (*vacall_f
07e0: 75 6e 63 74 69 6f 6e 29 20 28 26 6c 69 73 74 29 unction) (&list)
07f0: 3b 0a 23 65 6c 73 65 20 2f 2a 20 52 45 45 4e 54 ;.#else /* REENT
0800: 52 41 4e 54 20 2a 2f 0a 20 20 28 2a 65 6e 76 2d RANT */. (*env-
0810: 3e 76 61 63 61 6c 6c 5f 66 75 6e 63 74 69 6f 6e >vacall_function
0820: 29 20 28 65 6e 76 2d 3e 61 72 67 2c 26 6c 69 73 ) (env->arg,&lis
0830: 74 29 3b 0a 23 65 6e 64 69 66 0a 20 20 2f 2a 20 t);.#endif. /*
0840: 50 75 74 20 72 65 74 75 72 6e 20 76 61 6c 75 65 Put return value
0850: 20 69 6e 74 6f 20 70 72 6f 70 65 72 20 72 65 67 into proper reg
0860: 69 73 74 65 72 2e 20 2a 2f 0a 20 20 69 66 20 28 ister. */. if (
0870: 6c 69 73 74 2e 72 74 79 70 65 20 3d 3d 20 5f 5f list.rtype == __
0880: 56 41 76 6f 69 64 29 20 7b 0a 20 20 7d 20 65 6c VAvoid) {. } el
0890: 73 65 0a 20 20 69 66 20 28 6c 69 73 74 2e 72 74 se. if (list.rt
08a0: 79 70 65 20 3d 3d 20 5f 5f 56 41 63 68 61 72 29 ype == __VAchar)
08b0: 20 7b 0a 20 20 20 20 69 72 65 74 20 3d 20 6c 69 {. iret = li
08c0: 73 74 2e 74 6d 70 2e 5f 63 68 61 72 3b 0a 20 20 st.tmp._char;.
08d0: 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c 69 73 } else. if (lis
08e0: 74 2e 72 74 79 70 65 20 3d 3d 20 5f 5f 56 41 73 t.rtype == __VAs
08f0: 63 68 61 72 29 20 7b 0a 20 20 20 20 69 72 65 74 char) {. iret
0900: 20 3d 20 6c 69 73 74 2e 74 6d 70 2e 5f 73 63 68 = list.tmp._sch
0910: 61 72 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 ar;. } else. i
0920: 66 20 28 6c 69 73 74 2e 72 74 79 70 65 20 3d 3d f (list.rtype ==
0930: 20 5f 5f 56 41 75 63 68 61 72 29 20 7b 0a 20 20 __VAuchar) {.
0940: 20 20 69 72 65 74 20 3d 20 6c 69 73 74 2e 74 6d iret = list.tm
0950: 70 2e 5f 75 63 68 61 72 3b 0a 20 20 7d 20 65 6c p._uchar;. } el
0960: 73 65 0a 20 20 69 66 20 28 6c 69 73 74 2e 72 74 se. if (list.rt
0970: 79 70 65 20 3d 3d 20 5f 5f 56 41 73 68 6f 72 74 ype == __VAshort
0980: 29 20 7b 0a 20 20 20 20 69 72 65 74 20 3d 20 6c ) {. iret = l
0990: 69 73 74 2e 74 6d 70 2e 5f 73 68 6f 72 74 3b 0a ist.tmp._short;.
09a0: 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c } else. if (l
09b0: 69 73 74 2e 72 74 79 70 65 20 3d 3d 20 5f 5f 56 ist.rtype == __V
09c0: 41 75 73 68 6f 72 74 29 20 7b 0a 20 20 20 20 69 Aushort) {. i
09d0: 72 65 74 20 3d 20 6c 69 73 74 2e 74 6d 70 2e 5f ret = list.tmp._
09e0: 75 73 68 6f 72 74 3b 0a 20 20 7d 20 65 6c 73 65 ushort;. } else
09f0: 0a 20 20 69 66 20 28 6c 69 73 74 2e 72 74 79 70 . if (list.rtyp
0a00: 65 20 3d 3d 20 5f 5f 56 41 69 6e 74 29 20 7b 0a e == __VAint) {.
0a10: 20 20 20 20 69 72 65 74 20 3d 20 6c 69 73 74 2e iret = list.
0a20: 74 6d 70 2e 5f 69 6e 74 3b 0a 20 20 7d 20 65 6c tmp._int;. } el
0a30: 73 65 0a 20 20 69 66 20 28 6c 69 73 74 2e 72 74 se. if (list.rt
0a40: 79 70 65 20 3d 3d 20 5f 5f 56 41 75 69 6e 74 29 ype == __VAuint)
0a50: 20 7b 0a 20 20 20 20 69 72 65 74 20 3d 20 6c 69 {. iret = li
0a60: 73 74 2e 74 6d 70 2e 5f 75 69 6e 74 3b 0a 20 20 st.tmp._uint;.
0a70: 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c 69 73 } else. if (lis
0a80: 74 2e 72 74 79 70 65 20 3d 3d 20 5f 5f 56 41 6c t.rtype == __VAl
0a90: 6f 6e 67 29 20 7b 0a 20 20 20 20 69 72 65 74 20 ong) {. iret
0aa0: 3d 20 6c 69 73 74 2e 74 6d 70 2e 5f 6c 6f 6e 67 = list.tmp._long
0ab0: 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 ;. } else. if
0ac0: 28 6c 69 73 74 2e 72 74 79 70 65 20 3d 3d 20 5f (list.rtype == _
0ad0: 5f 56 41 75 6c 6f 6e 67 29 20 7b 0a 20 20 20 20 _VAulong) {.
0ae0: 69 72 65 74 20 3d 20 6c 69 73 74 2e 74 6d 70 2e iret = list.tmp.
0af0: 5f 75 6c 6f 6e 67 3b 0a 20 20 7d 20 65 6c 73 65 _ulong;. } else
0b00: 0a 20 20 69 66 20 28 6c 69 73 74 2e 72 74 79 70 . if (list.rtyp
0b10: 65 20 3d 3d 20 5f 5f 56 41 6c 6f 6e 67 6c 6f 6e e == __VAlonglon
0b20: 67 20 7c 7c 20 6c 69 73 74 2e 72 74 79 70 65 20 g || list.rtype
0b30: 3d 3d 20 5f 5f 56 41 75 6c 6f 6e 67 6c 6f 6e 67 == __VAulonglong
0b40: 29 20 7b 0a 20 20 20 20 69 72 65 74 20 20 3d 20 ) {. iret =
0b50: 28 28 5f 5f 76 61 77 6f 72 64 20 2a 29 20 26 6c ((__vaword *) &l
0b60: 69 73 74 2e 74 6d 70 2e 5f 6c 6f 6e 67 6c 6f 6e ist.tmp._longlon
0b70: 67 29 5b 30 5d 3b 0a 20 20 20 20 69 72 65 74 32 g)[0];. iret2
0b80: 20 3d 20 28 28 5f 5f 76 61 77 6f 72 64 20 2a 29 = ((__vaword *)
0b90: 20 26 6c 69 73 74 2e 74 6d 70 2e 5f 6c 6f 6e 67 &list.tmp._long
0ba0: 6c 6f 6e 67 29 5b 31 5d 3b 0a 20 20 7d 20 65 6c long)[1];. } el
0bb0: 73 65 0a 20 20 69 66 20 28 6c 69 73 74 2e 72 74 se. if (list.rt
0bc0: 79 70 65 20 3d 3d 20 5f 5f 56 41 66 6c 6f 61 74 ype == __VAfloat
0bd0: 29 20 7b 0a 20 20 20 20 66 72 65 74 20 3d 20 6c ) {. fret = l
0be0: 69 73 74 2e 74 6d 70 2e 5f 66 6c 6f 61 74 3b 0a ist.tmp._float;.
0bf0: 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c } else. if (l
0c00: 69 73 74 2e 72 74 79 70 65 20 3d 3d 20 5f 5f 56 ist.rtype == __V
0c10: 41 64 6f 75 62 6c 65 29 20 7b 0a 20 20 20 20 20 Adouble) {.
0c20: 20 64 72 65 74 31 20 3d 20 28 28 5f 5f 76 61 77 dret1 = ((__vaw
0c30: 6f 72 64 20 2a 29 20 26 6c 69 73 74 2e 74 6d 70 ord *) &list.tmp
0c40: 2e 5f 64 6f 75 62 6c 65 29 5b 30 5d 3b 0a 20 20 ._double)[0];.
0c50: 20 20 20 20 64 72 65 74 32 20 3d 20 28 28 5f 5f dret2 = ((__
0c60: 76 61 77 6f 72 64 20 2a 29 20 26 6c 69 73 74 2e vaword *) &list.
0c70: 74 6d 70 2e 5f 64 6f 75 62 6c 65 29 5b 31 5d 3b tmp._double)[1];
0c80: 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 . } else. if (
0c90: 6c 69 73 74 2e 72 74 79 70 65 20 3d 3d 20 5f 5f list.rtype == __
0ca0: 56 41 76 6f 69 64 70 29 20 7b 0a 20 20 20 20 69 VAvoidp) {. i
0cb0: 72 65 74 20 3d 20 28 6c 6f 6e 67 29 6c 69 73 74 ret = (long)list
0cc0: 2e 74 6d 70 2e 5f 70 74 72 3b 0a 20 20 7d 20 65 .tmp._ptr;. } e
0cd0: 6c 73 65 0a 20 20 69 66 20 28 6c 69 73 74 2e 72 lse. if (list.r
0ce0: 74 79 70 65 20 3d 3d 20 5f 5f 56 41 73 74 72 75 type == __VAstru
0cf0: 63 74 29 20 7b 0a 20 20 20 20 2f 2a 20 4e 42 3a ct) {. /* NB:
0d00: 20 4f 6e 20 61 72 6d 2c 20 61 6c 6c 20 73 74 72 On arm, all str
0d10: 75 63 74 75 72 65 20 73 69 7a 65 73 20 61 72 65 ucture sizes are
0d20: 20 64 69 76 69 73 69 62 6c 65 20 62 79 20 34 2e divisible by 4.
0d30: 20 2a 2f 0a 20 20 20 20 69 66 20 28 6c 69 73 74 */. if (list
0d40: 2e 66 6c 61 67 73 20 26 20 5f 5f 56 41 5f 50 43 .flags & __VA_PC
0d50: 43 5f 53 54 52 55 43 54 5f 52 45 54 55 52 4e 29 C_STRUCT_RETURN)
0d60: 20 7b 0a 20 20 20 20 20 20 2f 2a 20 70 63 63 20 {. /* pcc
0d70: 73 74 72 75 63 74 20 72 65 74 75 72 6e 20 63 6f struct return co
0d80: 6e 76 65 6e 74 69 6f 6e 20 2a 2f 0a 20 20 20 20 nvention */.
0d90: 20 20 69 72 65 74 20 3d 20 28 6c 6f 6e 67 29 20 iret = (long)
0da0: 6c 69 73 74 2e 72 61 64 64 72 3b 0a 20 20 20 20 list.raddr;.
0db0: 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 2f } else {. /
0dc0: 2a 20 6e 6f 72 6d 61 6c 20 73 74 72 75 63 74 20 * normal struct
0dd0: 72 65 74 75 72 6e 20 63 6f 6e 76 65 6e 74 69 6f return conventio
0de0: 6e 20 2a 2f 0a 20 20 20 20 20 20 69 66 20 28 6c n */. if (l
0df0: 69 73 74 2e 66 6c 61 67 73 20 26 20 5f 5f 56 41 ist.flags & __VA
0e00: 5f 52 45 47 49 53 54 45 52 5f 53 54 52 55 43 54 _REGISTER_STRUCT
0e10: 5f 52 45 54 55 52 4e 29 20 7b 0a 20 20 20 20 20 _RETURN) {.
0e20: 20 20 20 69 66 20 28 6c 69 73 74 2e 72 73 69 7a if (list.rsiz
0e30: 65 20 3d 3d 20 73 69 7a 65 6f 66 28 63 68 61 72 e == sizeof(char
0e40: 29 29 20 7b 20 2f 2a 20 63 61 6e 27 74 20 6f 63 )) { /* can't oc
0e50: 63 75 72 20 2a 2f 0a 20 20 20 20 20 20 20 20 20 cur */.
0e60: 20 69 72 65 74 20 3d 20 2a 28 75 6e 73 69 67 6e iret = *(unsign
0e70: 65 64 20 63 68 61 72 20 2a 29 20 6c 69 73 74 2e ed char *) list.
0e80: 72 61 64 64 72 3b 0a 20 20 20 20 20 20 20 20 7d raddr;. }
0e90: 20 65 6c 73 65 0a 20 20 20 20 20 20 20 20 69 66 else. if
0ea0: 20 28 6c 69 73 74 2e 72 73 69 7a 65 20 3d 3d 20 (list.rsize ==
0eb0: 73 69 7a 65 6f 66 28 73 68 6f 72 74 29 29 20 7b sizeof(short)) {
0ec0: 20 2f 2a 20 63 61 6e 27 74 20 6f 63 63 75 72 20 /* can't occur
0ed0: 2a 2f 0a 20 20 20 20 20 20 20 20 20 20 69 72 65 */. ire
0ee0: 74 20 3d 20 2a 28 75 6e 73 69 67 6e 65 64 20 73 t = *(unsigned s
0ef0: 68 6f 72 74 20 2a 29 20 6c 69 73 74 2e 72 61 64 hort *) list.rad
0f00: 64 72 3b 0a 20 20 20 20 20 20 20 20 7d 20 65 6c dr;. } el
0f10: 73 65 0a 20 20 20 20 20 20 20 20 20 20 69 72 65 se. ire
0f20: 74 20 3d 20 2a 28 75 6e 73 69 67 6e 65 64 20 69 t = *(unsigned i
0f30: 6e 74 20 2a 29 20 6c 69 73 74 2e 72 61 64 64 72 nt *) list.raddr
0f40: 3b 20 2f 2a 20 73 74 72 75 63 74 20 6f 66 20 73 ; /* struct of s
0f50: 69 7a 65 20 33 20 3a 29 20 2a 2f 0a 20 20 20 20 ize 3 :) */.
0f60: 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 }. }. }.
0f70: 28 26 66 69 72 73 74 77 6f 72 64 29 5b 2d 31 5d (&firstword)[-1]
0f80: 20 3d 20 61 72 67 73 2e 72 65 74 61 64 64 72 3b = args.retaddr;
0f90: 20 2f 2a 20 72 65 73 74 6f 72 65 20 74 68 65 20 /* restore the
0fa0: 72 65 74 75 72 6e 20 61 64 64 72 65 73 73 20 61 return address a
0fb0: 6e 64 20 73 61 76 65 64 20 72 65 67 69 73 74 65 nd saved registe
0fc0: 72 73 20 2a 2f 0a 20 20 28 26 66 69 72 73 74 77 rs */. (&firstw
0fd0: 6f 72 64 29 5b 2d 32 5d 20 3d 20 61 72 67 73 2e ord)[-2] = args.
0fe0: 73 61 76 31 3b 0a 20 20 28 26 66 69 72 73 74 77 sav1;. (&firstw
0ff0: 6f 72 64 29 5b 2d 33 5d 20 3d 20 61 72 67 73 2e ord)[-3] = args.
1000: 73 61 76 32 3b 0a 20 20 28 26 66 69 72 73 74 77 sav2;. (&firstw
1010: 6f 72 64 29 5b 2d 34 5d 20 3d 20 61 72 67 73 2e ord)[-4] = args.
1020: 73 61 76 33 3b 0a 20 20 28 26 66 69 72 73 74 77 sav3;. (&firstw
1030: 6f 72 64 29 5b 2d 35 5d 20 3d 20 61 72 67 73 2e ord)[-5] = args.
1040: 73 61 76 34 3b 0a 7d 0a sav4;.}.